From 7a45daf8535c124fac296a0354ab52ea53dac281 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sun, 22 Mar 2020 10:28:57 +0100 Subject: [PATCH] Make OMK SPOC-compatible --- doc/toolchain/vm-creation.md | 2 +- lxc-apps/ckan/ckan-datapusher.image.d/run | 2 +- lxc-apps/openmapkit/app | 18 ++++++++++++++++++ lxc-apps/openmapkit/{lxcfile => image} | 11 +++++------ .../etc/services.d/.s6-svscan/finish | 0 .../etc/services.d/openmapkit/run | 0 lxc-apps/openmapkit/install.sh | 11 +++++++---- lxc-apps/openmapkit/meta | 18 ------------------ 8 files changed, 32 insertions(+), 30 deletions(-) create mode 100644 lxc-apps/openmapkit/app rename lxc-apps/openmapkit/{lxcfile => image} (80%) rename lxc-apps/openmapkit/{lxc => image.d}/etc/services.d/.s6-svscan/finish (100%) rename lxc-apps/openmapkit/{lxc => image.d}/etc/services.d/openmapkit/run (100%) delete mode 100644 lxc-apps/openmapkit/meta diff --git a/doc/toolchain/vm-creation.md b/doc/toolchain/vm-creation.md index e9130c4..fac7ae0 100644 --- a/doc/toolchain/vm-creation.md +++ b/doc/toolchain/vm-creation.md @@ -46,7 +46,7 @@ Assign the newly generated key to your GitLab account ```bash # Clone the repository -git clone --recurse-submodules ssh://git@git.spotter.cz:2222/Spotter-Cluster/Spotter-Cluster.git +git clone --recursive ssh://git@git.spotter.cz:2222/Spotter-Cluster/Spotter-Cluster.git # Install the build toolchain Spotter-Cluster/build/install-toolchain.sh diff --git a/lxc-apps/ckan/ckan-datapusher.image.d/run b/lxc-apps/ckan/ckan-datapusher.image.d/run index b6b51f8..93317c0 100755 --- a/lxc-apps/ckan/ckan-datapusher.image.d/run +++ b/lxc-apps/ckan/ckan-datapusher.image.d/run @@ -1,5 +1,5 @@ #!/bin/execlineb -P -foreground { add-ca-cert } +foreground { /bin/add-ca-cert } s6-setuidgid ckandp uwsgi --plugin python --http-socket 0.0.0.0:8080 --wsgi-file /etc/ckan-datapusher/datapusher.wsgi --enable-threads diff --git a/lxc-apps/openmapkit/app b/lxc-apps/openmapkit/app new file mode 100644 index 0000000..4c79b9a --- /dev/null +++ b/lxc-apps/openmapkit/app @@ -0,0 +1,18 @@ +{ + "version": "0.12.0-200313", + "meta": { + "title": "OpenMapKit", + "desc-cs": "Sběr mapových dat", + "desc-en": "Map data collection", + "license": "GPL" + }, + "containers": { + "openmapkit": { + "image": "openmapkit_0.12.0-200313", + "mounts": { + "openmapkit/omk_conf/settings.js": "srv/openmapkit/settings.js:file", + "openmapkit/omk_data": "srv/openmapkit/data" + } + } + } +} diff --git a/lxc-apps/openmapkit/lxcfile b/lxc-apps/openmapkit/image similarity index 80% rename from lxc-apps/openmapkit/lxcfile rename to lxc-apps/openmapkit/image index 6068a27..0166811 100644 --- a/lxc-apps/openmapkit/lxcfile +++ b/lxc-apps/openmapkit/image @@ -1,5 +1,5 @@ -IMAGE openmapkit_0.12.0-190620 -FROM alpine3.9-java8_8.212.04-190620 +IMAGE openmapkit_0.12.0-200313 +FROM alpine3.11-java8_8.242.08-200313 RUN EOF # Install runtime dependencies @@ -9,11 +9,10 @@ RUN EOF apk --no-cache add --virtual .deps build-base git py2-pip yarn # Clone OpenMapKit - git clone --depth 1 https://github.com/posm/OpenMapKitServer /srv/openmapkit - cd /srv/openmapkit - git submodule update --init #TODO: Why does this fail? + git clone --recursive --depth 1 https://github.com/posm/OpenMapKitServer /srv/openmapkit # Install OpenMapKit dependencies + cd /srv/openmapkit pip install -r requirements.txt yarn add libxmljs yarn @@ -34,6 +33,6 @@ RUN EOF EOF # s6 required for single service due to inability of nodejs to process signals when running as PID 1 -COPY lxc +COPY image.d CMD /bin/s6-svscan /etc/services.d diff --git a/lxc-apps/openmapkit/lxc/etc/services.d/.s6-svscan/finish b/lxc-apps/openmapkit/image.d/etc/services.d/.s6-svscan/finish similarity index 100% rename from lxc-apps/openmapkit/lxc/etc/services.d/.s6-svscan/finish rename to lxc-apps/openmapkit/image.d/etc/services.d/.s6-svscan/finish diff --git a/lxc-apps/openmapkit/lxc/etc/services.d/openmapkit/run b/lxc-apps/openmapkit/image.d/etc/services.d/openmapkit/run similarity index 100% rename from lxc-apps/openmapkit/lxc/etc/services.d/openmapkit/run rename to lxc-apps/openmapkit/image.d/etc/services.d/openmapkit/run diff --git a/lxc-apps/openmapkit/install.sh b/lxc-apps/openmapkit/install.sh index a384c0d..f2fb98d 100755 --- a/lxc-apps/openmapkit/install.sh +++ b/lxc-apps/openmapkit/install.sh @@ -1,15 +1,18 @@ #!/bin/sh set -ev +# Volumes +OMK_CONF="${VOLUMES_DIR}/openmapkit/omk_conf" +OMK_DATA="${VOLUMES_DIR}/openmapkit/omk_data" + # Configure OpenMapKit export OPENMAPKIT_ADMIN_USER="admin" export OPENMAPKIT_ADMIN_PWD=$(head -c 12 /dev/urandom | base64 | tr -d '+/=') -mkdir -p /srv/openmapkit/omk_conf -chown -R 108080:108080 /srv/openmapkit/omk_conf -envsubst /srv/openmapkit/omk_conf/settings.js +install -o 108080 -g 108080 -m 750 -d ${OMK_CONF} +envsubst