Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F16571307
D2416.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D2416.diff
View Options
diff --git a/docker/migrate/Dockerfile b/docker/migrate/Dockerfile
new file mode 100644
--- /dev/null
+++ b/docker/migrate/Dockerfile
@@ -0,0 +1,32 @@
+FROM fedora:33
+
+MAINTAINER Jeroen van Meeuwen <vanmeeuwen@apheleia-it.ch>
+
+ENV HOME=/opt/app-root/src
+
+RUN dnf -y install \
+ composer \
+ file \
+ git \
+ make \
+ npm \
+ openssl-devel \
+ php-cli \
+ php-common \
+ php-ldap \
+ php-opcache \
+ php-pecl-apcu \
+ php-mysqlnd \
+ wget \
+ libpst
+
+
+RUN id default || (groupadd -g 1001 default && useradd -d /opt/app-root/ -u 1001 -g 1001 default)
+
+RUN mkdir ${HOME} && chown 1001:1001 ${HOME}
+
+USER 1001
+
+WORKDIR ${HOME}
+
+COPY /rootfs /
diff --git a/docker/migrate/Makefile b/docker/migrate/Makefile
new file mode 100644
--- /dev/null
+++ b/docker/migrate/Makefile
@@ -0,0 +1,27 @@
+IMAP_URI=ssl://127.0.0.1:993
+IMAP_ADMIN_LOGIN=cyrus-admin
+IMAP_ADMIN_PASSWORD=Welcome2KolabSystems
+IMAP_VERIFY_HOST=false
+IMAP_VERIFY_PEER=false
+PST_FILE=/home/mollekopf/src/kolab/test2.pst
+USERNAME=john@kolab.org
+PASSWORD=simple123
+DAV_URI="http://localhost:9080/iRony"
+
+run:
+ docker run --network=host --rm -ti \
+ -e IMAP_URI=${IMAP_URI} \
+ -e IMAP_ADMIN_LOGIN=${IMAP_ADMIN_LOGIN} \
+ -e IMAP_ADMIN_PASSWORD=${IMAP_ADMIN_PASSWORD} \
+ -e IMAP_VERIFY_PEER=${IMAP_VERIFY_PEER} \
+ -e IMAP_VERIFY_HOST=${IMAP_VERIFY_HOST} \
+ -v ${PST_FILE}:/opt/app-root/src.pst \
+ -w /opt/app-root/src/kolab/src migrate-s2i \
+ ./artisan migrate:userdata \
+ --importpst=/opt/app-root/src.pst \
+ --username=${USERNAME} --password=${PASSWORD} \
+ --clear-target --subscribe --debug \
+ --davUrl=${DAV_URI} \
+ --exclude-target="Sync Issues (This computer only)" \
+ --exclude-target="Drafts (This computer only)"
+
diff --git a/docker/migrate/do-it-again.sh b/docker/migrate/do-it-again.sh
new file mode 100755
--- /dev/null
+++ b/docker/migrate/do-it-again.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+export APP_DEBUG="true"
+export APP_KEY=
+export APP_PUBLIC_URL=http://127.0.0.1:8000/
+export APP_SRC=src/
+export APP_URL=http://127.0.0.1:8000/
+export CACHE_DRIVER="array"
+export COMPOSER_ARGS="--no-dev"
+export DB_CONNECTION="sqlite"
+export DB_DATABASE=":memory:"
+export GIT_URI=https://git.kolab.org/source/kolab.git
+export GIT_BRANCH=dev/pstimport
+export LARAVEL_ENV=production
+export LOG_CHANNEL="stderr"
+export MAIL_DRIVER="array"
+export QUEUE_CONNECTION="sync"
+export SESSION_DRIVER="array"
+
+docker build -t migrate .
+
+docker kill migrate
+
+docker rm migrate
+
+docker_opts="\
+ -e APP_DEBUG=${APP_DEBUG} \
+ -e APP_KEY=${APP_KEY} \
+ -e APP_PUBLIC_URL=${APP_PUBLIC_URL} \
+ -e APP_SRC=${APP_SRC} \
+ -e APP_URL=${APP_URL} \
+ -e CACHE_DRIVER=${CACHE_DRIVER} \
+ -e COMPOSER_ARGS=${COMPOSER_ARGS} \
+ -e DB_CONNECTION=${DB_CONNECTION} \
+ -e DB_DATABASE=${DB_DATABASE} \
+ -e GIT_URI=${GIT_URI} \
+ -e GIT_BRANCH=${GIT_BRANCH} \
+ -e LARAVEL_ENV=${LARAVEL_ENV} \
+ -e LOG_CHANNEL=${LOG_CHANNEL} \
+ -e MAIL_DRIVER=${MAIL_DRIVER} \
+ -e QUEUE_CONNECTION=${QUEUE_CONNECTION} \
+ -e SESSION_DRIVER=${SESSION_DRIVER}"
+
+docker run -it \
+ ${docker_opts} \
+ --name migrate migrate /usr/local/bin/build-image
+
+docker commit migrate migrate-s2i
+
+docker kill migrate-s2i
+
+docker rm migrate-s2i
diff --git a/docker/migrate/rootfs/usr/local/bin/build-image b/docker/migrate/rootfs/usr/local/bin/build-image
new file mode 100755
--- /dev/null
+++ b/docker/migrate/rootfs/usr/local/bin/build-image
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+set -x
+
+set -e
+
+pwd
+
+if [ -z "${GIT_URI}" ]; then
+ echo "No GIT_URI specified. Exiting."
+ exit 1
+fi
+
+git clone -b ${GIT_BRANCH:-master} ${GIT_URI}
+
+cd $(basename ${GIT_URI} .git)
+
+if [ ! -z "${APP_SRC}" ]; then
+ cd ${APP_SRC}
+fi
+
+if [ -f "composer.json" ]; then
+ echo "Detected composer.json, running install"
+ php -dmemory_limit=${COMPOSER_MEMORY_LIMIT:--1} /usr/bin/composer install ${COMPOSER_ARGS}
+ rm -rf ~/.cache/composer/
+fi
+
+if [ -z "${LARAVEL_ENV}" ]; then
+ LARAVEL_ENV=prod
+fi
+
+npm install
+
+npm run ${LARAVEL_ENV} && rm -rf ~/.npm/
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Oct 31, 10:06 AM (19 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
10076373
Default Alt Text
D2416.diff (4 KB)
Attached To
Mode
D2416: A docker container for the migration command
Attached
Detach File
Event Timeline
Log In to Comment