LXCize OMK setup

This commit is contained in:
Disassembler 2018-09-13 21:54:36 +02:00
parent 44546c4816
commit f2a9529e29
Signed by: Disassembler
GPG Key ID: 524BD33A0EE29499
2 changed files with 10 additions and 16 deletions

View File

@ -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

View File

@ -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
}