Revert long naming for OpenMapKit

This commit is contained in:
Disassembler 2018-04-21 23:10:55 +02:00
parent 53b470118d
commit 0756d354bb
Signed by: Disassembler
GPG Key ID: 524BD33A0EE29499
7 changed files with 58 additions and 58 deletions

View File

@ -19,7 +19,7 @@ ${SOURCE_DIR}/mifosx.sh
${SOURCE_DIR}/motech.sh
${SOURCE_DIR}/opendatakit-build.sh
${SOURCE_DIR}/opendatakit.sh
${SOURCE_DIR}/omk.sh
${SOURCE_DIR}/openmapkit.sh
${SOURCE_DIR}/pandora.sh
${SOURCE_DIR}/sahana.sh
${SOURCE_DIR}/sambro.sh

20
omk.sh
View File

@ -1,20 +0,0 @@
#!/bin/sh
SOURCE_DIR=$(realpath $(dirname "${0}"))/omk
# Check prerequisites
docker image ls | grep -q java || $(realpath $(dirname "${0}"))/java.sh
# Build Docker container
docker build -t omk ${SOURCE_DIR}
cp ${SOURCE_DIR}/etc/init.d/omk /etc/init.d/omk
rc-update -u
# 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
chown -R 8007:8007 /srv/omk/data
docker run --rm -v /srv/omk/data:/mnt/data omk cp -rp /srv/omk/data/. /mnt/data
envsubst <${SOURCE_DIR}/srv/omk/conf/settings.js >/srv/omk/conf/settings.js
spotter-appmgr update-login omk "${OMK_ADMIN_USER}" "${OMK_ADMIN_PWD}"

View File

@ -1,28 +0,0 @@
#!/sbin/openrc-run
description="OpenMapKit docker container"
depend() {
need docker
}
start() {
/usr/bin/docker run -d --rm \
--name omk \
-h omk \
-v /srv/omk/conf/settings.js:/srv/omk/settings.js \
-v /srv/omk/data:/srv/omk/data \
omk
}
start_post() {
/usr/bin/spotter-appmgr register-proxy omk
}
stop_pre() {
/usr/bin/spotter-appmgr unregister-proxy omk
}
stop() {
/usr/bin/docker stop omk
}

20
openmapkit.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/sh
SOURCE_DIR=$(realpath $(dirname "${0}"))/openmapkit
# Check prerequisites
docker image ls | grep -q java || $(realpath $(dirname "${0}"))/java.sh
# 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
export OPENMAPKIT_ADMIN_USER="admin"
export OPENMAPKIT_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
mkdir -p /srv/openmapkit/conf /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
envsubst <${SOURCE_DIR}/srv/openmapkit/conf/settings.js >/srv/openmapkit/conf/settings.js
spotter-appmgr update-login openmapkit "${OPENMAPKIT_ADMIN_USER}" "${OPENMAPKIT_ADMIN_PWD}"

View File

@ -17,8 +17,8 @@ RUN \
# Install build dependencies
apk --no-cache add --virtual .deps build-base git py2-pip \
# Clone OpenMapKit
&& git clone --depth 1 https://github.com/posm/OpenMapKitServer /srv/omk \
&& cd /srv/omk \
&& git clone --depth 1 https://github.com/posm/OpenMapKitServer /srv/openmapkit \
&& cd /srv/openmapkit \
&& git submodule update --init \
# Install OpenMapKit dependencies
&& pip install -r requirements.txt \
@ -26,17 +26,17 @@ RUN \
&& npm install \
# Create OS user
&& addgroup -S -g 8007 omk \
&& adduser -S -u 8007 -h /srv/omk -s /bin/false -g omk -G omk omk \
&& chown -R omk:omk /srv/omk \
&& adduser -S -u 8007 -h /srv/openmapkit -s /bin/false -g omk -G omk omk \
&& chown -R omk:omk /srv/openmapkit \
# Cleanup
&& apk --no-cache del .deps \
&& find /srv/omk -name '.git*' -exec rm -rf {} + \
&& find /srv/openmapkit -name '.git*' -exec rm -rf {} + \
&& rm -rf /usr/local/share/.cache \
&& rm -rf /root/.cache /root/.config /root/.node-gyp /root/.npm
VOLUME ["/srv/omk/data"]
VOLUME ["/srv/openmapkit/data"]
EXPOSE 8080
USER omk
ENV NODE_ENV production
CMD ["node", "/srv/omk/server.js"]
CMD ["node", "/srv/openmapkit/server.js"]

View File

@ -0,0 +1,28 @@
#!/sbin/openrc-run
description="OpenMapKit docker container"
depend() {
need docker
}
start() {
/usr/bin/docker run -d --rm \
--name openmapkit \
-h openmapkit \
-v /srv/openmapkit/conf/settings.js:/srv/openmapkit/settings.js \
-v /srv/openmapkit/data:/srv/openmapkit/data \
openmapkit
}
start_post() {
/usr/bin/spotter-appmgr register-proxy openmapkit
}
stop_pre() {
/usr/bin/spotter-appmgr unregister-proxy openmapkit
}
stop() {
/usr/bin/docker stop openmapkit
}

View File

@ -13,8 +13,8 @@ module.exports = {
// To do simple authentication, you can have an object like so:
auth: {
user: '${OMK_ADMIN_USER}',
pass: '${OMK_ADMIN_PWD}'
user: '${OPENMAPKIT_ADMIN_USER}',
pass: '${OPENMAPKIT_ADMIN_PWD}'
}
};