LXCize OMK setup
This commit is contained in:
parent
44546c4816
commit
f2a9529e29
@ -1,18 +1,17 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/openmapkit
|
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
|
||||||
|
|
||||||
# Build Docker container
|
|
||||||
docker build -t openmapkit ${SOURCE_DIR}
|
|
||||||
cp ${SOURCE_DIR}/etc/init.d/openmapkit /etc/init.d/openmapkit
|
|
||||||
rc-update -u
|
|
||||||
|
|
||||||
# Configure OpenMapKit
|
# Configure OpenMapKit
|
||||||
export OPENMAPKIT_ADMIN_USER="admin"
|
export OPENMAPKIT_ADMIN_USER="admin"
|
||||||
export OPENMAPKIT_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
|
export OPENMAPKIT_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
|
||||||
mkdir -p /srv/openmapkit/conf /srv/openmapkit/data
|
mkdir -p /srv/openmapkit/conf /srv/openmapkit/data
|
||||||
chown -R 8007:8007 /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
|
envsubst <${SOURCE_DIR}/srv/openmapkit/conf/settings.js >/srv/openmapkit/conf/settings.js
|
||||||
vmmgr update-login openmapkit "${OPENMAPKIT_ADMIN_USER}" "${OPENMAPKIT_ADMIN_PWD}"
|
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
|
||||||
|
@ -1,18 +1,13 @@
|
|||||||
#!/sbin/openrc-run
|
#!/sbin/openrc-run
|
||||||
|
|
||||||
description="OpenMapKit docker container"
|
description="OpenMapKit container"
|
||||||
|
|
||||||
depend() {
|
depend() {
|
||||||
need docker
|
need cgroups
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
/usr/bin/docker run -d --rm \
|
lxc-start openmapkit
|
||||||
--name openmapkit \
|
|
||||||
-h openmapkit \
|
|
||||||
-v /srv/openmapkit/conf/settings.js:/srv/openmapkit/settings.js \
|
|
||||||
-v /srv/openmapkit/data:/srv/openmapkit/data \
|
|
||||||
openmapkit
|
|
||||||
}
|
}
|
||||||
|
|
||||||
start_post() {
|
start_post() {
|
||||||
@ -24,5 +19,5 @@ stop_pre() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
/usr/bin/docker stop openmapkit
|
lxc-stop openmapkit
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user