Rework OpenMapKit
This commit is contained in:
parent
6c16aedadd
commit
ed3aeb60d8
@ -6,14 +6,10 @@ cd $(realpath $(dirname "${0}"))/install
|
|||||||
# Configure OpenMapKit
|
# Configure OpenMapKit
|
||||||
export OPENMAPKIT_ADMIN_USER="admin"
|
export OPENMAPKIT_ADMIN_USER="admin"
|
||||||
export OPENMAPKIT_ADMIN_PWD=$(head -c 12 /dev/urandom | base64 | tr -d '+/=')
|
export OPENMAPKIT_ADMIN_PWD=$(head -c 12 /dev/urandom | base64 | tr -d '+/=')
|
||||||
mkdir -p /srv/openmapkit/conf /srv/openmapkit/data
|
mkdir -p /srv/openmapkit/omk_conf /srv/openmapkit/omk_data
|
||||||
chown -R 8007:8007 /srv/openmapkit/data
|
chown -R 108007:108007 /srv/openmapkit/omk_data
|
||||||
cp -rp /var/lib/lxc/openmapkit/openmapkit/srv/openmapkit/data/. /srv/openmapkit/data
|
lxc-execute openmapkit -- tar -cC /srv/openmapkit/data . | tar -xC /srv/openmapkit/omk_data
|
||||||
envsubst <srv/openmapkit/conf/settings.js >/srv/openmapkit/conf/settings.js
|
envsubst <omk_conf/settings.js >/srv/openmapkit/omk_conf/settings.js
|
||||||
|
|
||||||
# Install service
|
|
||||||
cp etc/init.d/openmapkit /etc/init.d/openmapkit
|
|
||||||
rc-update -u
|
|
||||||
|
|
||||||
# Register application
|
# Register application
|
||||||
vmmgr register-app openmapkit omk "${OPENMAPKIT_ADMIN_USER}" "${OPENMAPKIT_ADMIN_PWD}"
|
vmmgr register-app openmapkit omk "${OPENMAPKIT_ADMIN_USER}" "${OPENMAPKIT_ADMIN_PWD}"
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
#!/sbin/openrc-run
|
|
||||||
|
|
||||||
description="OpenMapKit container"
|
|
||||||
|
|
||||||
start() {
|
|
||||||
lxc-start openmapkit
|
|
||||||
}
|
|
||||||
|
|
||||||
start_post() {
|
|
||||||
vmmgr register-proxy openmapkit
|
|
||||||
}
|
|
||||||
|
|
||||||
stop_pre() {
|
|
||||||
vmmgr unregister-proxy openmapkit
|
|
||||||
}
|
|
||||||
|
|
||||||
stop() {
|
|
||||||
lxc-stop openmapkit
|
|
||||||
}
|
|
18
lxc-apps/openmapkit/meta
Normal file
18
lxc-apps/openmapkit/meta
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"version": "0.12.0-190620",
|
||||||
|
"meta": {
|
||||||
|
"title": "OpenMapKit",
|
||||||
|
"desc-cs": "Sběr mapových dat",
|
||||||
|
"desc-en": "Map data collection",
|
||||||
|
"license": "GPL",
|
||||||
|
},
|
||||||
|
"containers": {
|
||||||
|
"openmapkit": {
|
||||||
|
"image": "openmapkit_0.12.0-190620",
|
||||||
|
"mounts": [
|
||||||
|
["FILE", "/srv/openmapkit/omk_conf/settings.js", "/srv/openmapkit/settings.js"],
|
||||||
|
["DIR", "/srv/openmapkit/omk_data", "/srv/openmapkit/data"]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,14 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -ev
|
set -ev
|
||||||
|
|
||||||
# Remove service
|
# Remove persistent data
|
||||||
rm -f /etc/init.d/openmapkit
|
rm -rf /srv/openmapkit
|
||||||
rc-update -u
|
|
||||||
|
|
||||||
# Drop database and user
|
|
||||||
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
|
|
||||||
echo 'DROP DATABASE IF EXISTS openmapkit; DROP ROLE IF EXISTS openmapkit;' | lxc-attach -u 5432 -g 5432 postgres -- psql
|
|
||||||
[ ! -z ${STOP_POSTGRES} ] && service postgres stop
|
|
||||||
|
|
||||||
# Unregister application
|
# Unregister application
|
||||||
vmmgr unregister-app openmapkit
|
vmmgr unregister-app openmapkit
|
||||||
|
Loading…
Reference in New Issue
Block a user