Spotter-VM/omk.sh

24 lines
792 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)
mkdir -p /srv/omk/conf /srv/omk/data/deployments /srv/omk/data/forms /srv/omk/data/submissions
chown -R 8007:8007 /srv/omk/data
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
spotter-appmgr add-app omk "https://omk.{host}/" admin "${OMK_ADMIN_PWD}"
spotter-appmgr add-app omk-clients -p clienturl "https://omk.{host}"
spotter-appmgr add-app geoodk-clients -p clienturl "https://omk.{host}"