Spotter-VM/omk.sh

25 lines
828 B
Bash
Raw Normal View History

2018-03-25 14:42:23 +02:00
#!/bin/sh
SOURCE_DIR=$(realpath $(dirname "${0}"))/omk
# Build Docker container
docker build -t omk ${SOURCE_DIR}
# Configure OpenMapKit
export OMK_ADMIN_USER="admin"
export OMK_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
2018-03-26 19:53:54 +02:00
mkdir -p /srv/omk/conf /srv/omk/data
2018-03-25 14:42:23 +02:00
chown -R 8007:8007 /srv/omk/data
2018-03-26 19:53:54 +02:00
docker run --rm -v /srv/omk/data:/mnt/data omk cp -rp /srv/omk/data/. /mnt/data
2018-03-25 14:42:23 +02:00
envsubst <${SOURCE_DIR}/srv/omk/conf/settings.js >/srv/omk/conf/settings.js
# Configure OpenMapKit service
cp ${SOURCE_DIR}/etc/init.d/omk /etc/init.d/omk
rc-update add omk
service omk start
# Add application definition
2018-03-26 19:53:54 +02:00
spotter-appmgr add-app omk "https://omk.{host}/" "${OMK_ADMIN_USER}" "${OMK_ADMIN_PWD}"
2018-03-25 14:42:23 +02:00
spotter-appmgr add-app omk-clients -p clienturl "https://omk.{host}"
spotter-appmgr add-app geoodk-clients -p clienturl "https://omk.{host}"