Add UID/GID for OpenMapKit, change path from omk to openmapkit

This commit is contained in:
Disassembler 2017-12-13 17:16:08 +01:00
parent d973836b8c
commit ae2eea1933
4 changed files with 17 additions and 19 deletions

View File

@ -2,16 +2,15 @@
SOURCE_DIR=$(realpath $(dirname "${0}"))/openmapkit
# Prepare Docker mount structure
mkdir -p /srv/omk/data/{deployments,submissions}
# Build Docker container
docker build -t openmapkit ${SOURCE_DIR}
# 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
# Build Docker container
docker build -t openmapkit ${SOURCE_DIR}
mkdir -p /srv/openmapkit/data/{deployments,submissions}
envsubst <${SOURCE_DIR}/srv/openmapkit/settings.js >/srv/openmapkit/settings.js
chown -R 8007:8007 /srv/openmapkit/data
# Configure OpenMapKit service
cp ${SOURCE_DIR}/lib/systemd/system/openmapkit.service /lib/systemd/system/openmapkit.service
@ -27,5 +26,5 @@ ln -s /etc/nginx/sites-available/openmapkit /etc/nginx/sites-enabled/openmapkit
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"
portal-app-manager openmapkit "https://{host}:8407/" admin "${OMK_ADMIN_PWD}"
portal-app-manager openmapkit-clients -p clienturl "http://{host}:8007"

View File

@ -4,23 +4,22 @@ MAINTAINER Disassembler <disassembler@dasm.cz>
RUN apk --no-cache add python2
RUN apk --no-cache add nodejs git build-base openjdk8-jre-base py2-pip \
&& git clone --depth 1 https://github.com/AmericanRedCross/OpenMapKitServer /srv/omk \
&& cd /srv/omk \
&& git clone --depth 1 https://github.com/AmericanRedCross/OpenMapKitServer /srv/openmapkit \
&& cd /srv/openmapkit \
&& git submodule update --init \
&& pip install -r requirements.txt \
&& npm install -g yarn \
&& npm install libxmljs \
&& yarn \
&& addgroup -S omk \
&& adduser -S -h /srv/omk -H -s /bin/sh -g omk -G omk omk \
&& chown -R omk:omk /srv/omk/data/deployments /srv/omk/data/submissions \
&& addgroup -S -g 8007 omk \
&& adduser -S -u 8007 -h /srv/openmapkit -s /bin/false -g omk -G omk omk \
&& apk --no-cache del git build-base py2-pip \
&& rm -rf /srv/omk/.git* /srv/omk/api/odk/pyxform/.git* \
&& rm -rf /srv/openmapkit/.git* /srv/openmapkit/api/odk/pyxform/.git* \
&& rm -rf /root/* || true
VOLUME ["/srv/omk/data"]
EXPOSE 3210
VOLUME ["/srv/openmapkit/data"]
EXPOSE 8007
USER omk
ENV NODE_ENV production
CMD ["node", "/srv/omk/server.js"]
CMD ["node", "/srv/openmapkit/server.js"]

View File

@ -4,7 +4,7 @@ After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/docker run --rm --tmpfs /tmp --name openmapkit -v /srv/omk/settings.js:/srv/omk/settings.js -v /srv/omk/data:/srv/omk/data openmapkit
ExecStart=/usr/bin/docker run --rm --tmpfs /tmp --name openmapkit -v /srv/openmapkit/settings.js:/srv/openmapkit/settings.js -v /srv/openmapkit/data:/srv/openmapkit/data openmapkit
ExecStop=/usr/bin/docker kill openmapkit
[Install]

View File

@ -1,7 +1,7 @@
module.exports = {
name: 'OpenMapKit Server',
description: 'OpenMapKit Server is the lightweight server component of OpenMapKit that handles the collection and aggregation of OpenStreetMap and OpenDataKit data.',
port: 8096,
port: 8007,
dataDir: __dirname + '/data',
pagesDir: __dirname + '/pages',
hostUrl: 'http://posm.io',