diff --git a/openmapkit/setup.sh b/openmapkit/setup.sh index a7e0f24..b8e8c5c 100755 --- a/openmapkit/setup.sh +++ b/openmapkit/setup.sh @@ -1,18 +1,17 @@ #!/bin/sh set -e -SOURCE_DIR=$(realpath $(dirname "${0}"))/openmapkit - -# Build Docker container -docker build -t openmapkit ${SOURCE_DIR} -cp ${SOURCE_DIR}/etc/init.d/openmapkit /etc/init.d/openmapkit -rc-update -u +SOURCE_DIR=$(realpath $(dirname "${0}"))/setup # Configure OpenMapKit export OPENMAPKIT_ADMIN_USER="admin" export OPENMAPKIT_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) mkdir -p /srv/openmapkit/conf /srv/openmapkit/data chown -R 8007:8007 /srv/openmapkit/data -docker run --rm -v /srv/openmapkit/data:/mnt/data openmapkit cp -rp /srv/openmapkit/data/. /mnt/data +cp -rp /var/lib/lxc/openmapkit/openmapkit/srv/openmapkit/data/. /srv/openmapkit/data envsubst <${SOURCE_DIR}/srv/openmapkit/conf/settings.js >/srv/openmapkit/conf/settings.js vmmgr update-login openmapkit "${OPENMAPKIT_ADMIN_USER}" "${OPENMAPKIT_ADMIN_PWD}" + +# Install service +cp ${SOURCE_DIR}/etc/init.d/openmapkit /etc/init.d/openmapkit +rc-update -u diff --git a/openmapkit/setup/etc/init.d/openmapkit b/openmapkit/setup/etc/init.d/openmapkit index 511ab56..bc2a769 100755 --- a/openmapkit/setup/etc/init.d/openmapkit +++ b/openmapkit/setup/etc/init.d/openmapkit @@ -1,18 +1,13 @@ #!/sbin/openrc-run -description="OpenMapKit docker container" +description="OpenMapKit container" depend() { - need docker + need cgroups } start() { - /usr/bin/docker run -d --rm \ - --name openmapkit \ - -h openmapkit \ - -v /srv/openmapkit/conf/settings.js:/srv/openmapkit/settings.js \ - -v /srv/openmapkit/data:/srv/openmapkit/data \ - openmapkit + lxc-start openmapkit } start_post() { @@ -24,5 +19,5 @@ stop_pre() { } stop() { - /usr/bin/docker stop openmapkit + lxc-stop openmapkit }