diff --git a/00-install.sh b/00-install.sh index 120fa62..e2f04ec 100755 --- a/00-install.sh +++ b/00-install.sh @@ -18,7 +18,7 @@ ${SOURCE_DIR}/mifosx.sh ${SOURCE_DIR}/motech.sh ${SOURCE_DIR}/odkbuild.sh ${SOURCE_DIR}/odk.sh -${SOURCE_DIR}/openmapkit.sh +${SOURCE_DIR}/omk.sh ${SOURCE_DIR}/pandora.sh ${SOURCE_DIR}/sahana.sh ${SOURCE_DIR}/sambro.sh diff --git a/basic/srv/portal/index.html b/basic/srv/portal/index.html index 886858a..299a884 100644 --- a/basic/srv/portal/index.html +++ b/basic/srv/portal/index.html @@ -102,7 +102,7 @@ -
+

Open Map KitOpenMapKit Server

Sběr dat s pomocí smartphone.

-
+

Open Map KitOpenMapKit

Mobilní aplikace
ODK CollectODK Collect pro Android
diff --git a/omk.sh b/omk.sh new file mode 100755 index 0000000..f52b29d --- /dev/null +++ b/omk.sh @@ -0,0 +1,23 @@ +#!/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}" diff --git a/openmapkit/Dockerfile b/omk/Dockerfile similarity index 77% rename from openmapkit/Dockerfile rename to omk/Dockerfile index a7ed6b5..238d8fe 100644 --- a/openmapkit/Dockerfile +++ b/omk/Dockerfile @@ -26,8 +26,8 @@ RUN \ # Install build dependencies apk --no-cache add --virtual .deps build-base git py2-pip yarn \ # Clone OpenMapKit - && git clone --depth 1 https://github.com/AmericanRedCross/OpenMapKitServer /srv/openmapkit \ - && cd /srv/openmapkit \ + && git clone --depth 1 https://github.com/AmericanRedCross/OpenMapKitServer /srv/omk \ + && cd /srv/omk \ && git submodule update --init \ # Install OpenMapKit dependencies && pip install -r requirements.txt \ @@ -35,17 +35,17 @@ RUN \ && yarn \ # Create OS user && addgroup -S -g 8007 omk \ - && adduser -S -u 8007 -h /srv/openmapkit -s /bin/false -g omk -G omk omk \ - && chown -R omk:omk /srv/openmapkit \ + && adduser -S -u 8007 -h /srv/omk -s /bin/false -g omk -G omk omk \ + && chown -R omk:omk /srv/omk \ # Cleanup && apk --no-cache del .deps \ - && find /srv/openmapkit -name '.git*' -exec rm -rf {} + \ + && find /srv/omk -name '.git*' -exec rm -rf {} + \ && rm -rf /usr/local/share/.cache \ && rm -rf /root/.cache /root/.config /root/.node-gyp /root/.npm -VOLUME ["/srv/openmapkit/data"] +VOLUME ["/srv/omk/data"] EXPOSE 8080 USER omk ENV NODE_ENV production -CMD ["node", "/srv/openmapkit/server.js"] +CMD ["node", "/srv/omk/server.js"] diff --git a/omk/etc/init.d/omk b/omk/etc/init.d/omk new file mode 100755 index 0000000..812aa5f --- /dev/null +++ b/omk/etc/init.d/omk @@ -0,0 +1,25 @@ +#!/sbin/openrc-run + +description="OpenMapKit docker container" + +depend() { + need docker net + use dns logger netmount +} + +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/local/bin/spotter-appmgr update-hosts omk +} + +stop() { + /usr/bin/docker stop omk +} diff --git a/openmapkit/srv/openmapkit/conf/settings.js b/omk/srv/omk/conf/settings.js similarity index 100% rename from openmapkit/srv/openmapkit/conf/settings.js rename to omk/srv/omk/conf/settings.js diff --git a/openmapkit.sh b/openmapkit.sh deleted file mode 100755 index 52b98de..0000000 --- a/openmapkit.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -SOURCE_DIR=$(realpath $(dirname "${0}"))/openmapkit - -# 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) -mkdir -p /srv/openmapkit/conf /srv/openmapkit/data/deployments /srv/openmapkit/data/forms /srv/openmapkit/data/submissions -chown -R 8007:8007 /srv/openmapkit/data -envsubst <${SOURCE_DIR}/srv/openmapkit/conf/settings.js >/srv/openmapkit/conf/settings.js - -# Configure OpenMapKit service -cp ${SOURCE_DIR}/etc/init.d/openmapkit /etc/init.d/openmapkit -rc-update add openmapkit -service openmapkit start - -# Add application definition -spotter-appmgr add-app openmapkit "https://openmapkit.{host}/" admin "${OMK_ADMIN_PWD}" -spotter-appmgr add-app openmapkit-clients -p clienturl "https://openmapkit.{host}" -spotter-appmgr add-app geoodk-clients -p clienturl "https://openmapkit.{host}" diff --git a/openmapkit/etc/init.d/openmapkit b/openmapkit/etc/init.d/openmapkit deleted file mode 100755 index f02fd0e..0000000 --- a/openmapkit/etc/init.d/openmapkit +++ /dev/null @@ -1,25 +0,0 @@ -#!/sbin/openrc-run - -description="OpenMapKit docker container" - -depend() { - need docker net - use dns logger netmount -} - -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/local/bin/spotter-appmgr update-hosts openmapkit -} - -stop() { - /usr/bin/docker stop openmapkit -}