Spotter-VM/openmapkit.sh

32 lines
1.0 KiB
Bash
Raw Normal View History

#!/bin/bash
SOURCE_DIR=$(realpath $(dirname "${0}"))/openmapkit
2017-12-12 13:29:33 +01:00
# Prepare Docker mount structure
mkdir -p /srv/omk/data/{deployments,submissions}
# Configure OpenMapKit
export OMK_ADMIN_USER="admin"
export OMK_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/srv/omk/settings.js >/srv/omk/settings.js
2017-12-12 13:29:33 +01:00
# Build Docker container
docker build -t openmapkit ${SOURCE_DIR}
# Configure OpenMapKit service
cp ${SOURCE_DIR}/lib/systemd/system/openmapkit.service /lib/systemd/system/openmapkit.service
systemctl daemon-reload
systemctl enable openmapkit
systemctl start openmapkit
# Create nginx site definition
cp ${SOURCE_DIR}/etc/nginx/sites-available/openmapkit /etc/nginx/sites-available/openmapkit
ln -s /etc/nginx/sites-available/openmapkit /etc/nginx/sites-enabled/openmapkit
# Restart services
systemctl restart nginx
# Add portal application definition
portal-app-manager openmapkit "https://{host}:8007/" admin "${OMK_ADMIN_PWD}"
portal-app-manager openmapkit-clients -p clienturl "http://{host}:8096"