From 512895a6f2343098be4b031ab4046963ac22ff4c Mon Sep 17 00:00:00 2001 From: Disassembler Date: Mon, 16 Mar 2020 21:35:33 +0100 Subject: [PATCH] Make CTS SPOC-compatible --- lxc-apps/cts/app | 26 ++++++++++++++++++++++++ lxc-apps/cts/{lxcfile => image} | 6 +++--- lxc-apps/cts/install.sh | 35 ++++++++++++++++----------------- lxc-apps/cts/meta | 26 ------------------------ lxc-apps/cts/uninstall.sh | 2 +- 5 files changed, 47 insertions(+), 48 deletions(-) create mode 100644 lxc-apps/cts/app rename lxc-apps/cts/{lxcfile => image} (91%) delete mode 100644 lxc-apps/cts/meta diff --git a/lxc-apps/cts/app b/lxc-apps/cts/app new file mode 100644 index 0000000..b7207b0 --- /dev/null +++ b/lxc-apps/cts/app @@ -0,0 +1,26 @@ +{ + "version": "0.8.0-200313", + "meta": { + "title": "CTS", + "desc-cs": "Sledovací systém komodit", + "desc-en": "Commodity tracking system", + "license": "GPL" + }, + "containers": { + "cts": { + "image": "cts_0.8.0-200313", + "depends": [ + "cts-postgres" + ], + "mounts": { + "cts/cts_conf": "srv/cts/cts/settings" + } + }, + "cts-postgres": { + "image": "postgis_3.0.0-200313", + "mounts": { + "cts/postgres_data": "var/lib/postgresql" + } + } + } +} diff --git a/lxc-apps/cts/lxcfile b/lxc-apps/cts/image similarity index 91% rename from lxc-apps/cts/lxcfile rename to lxc-apps/cts/image index 80f9ea0..e49faa0 100644 --- a/lxc-apps/cts/lxcfile +++ b/lxc-apps/cts/image @@ -1,9 +1,9 @@ -IMAGE cts_0.8.0-190620 -FROM alpine3.9-python2.7_2.7.16-190620 +IMAGE cts_0.8.0-200313 +FROM alpine3.11-python2.7_2.7.16-200313 RUN EOF # Install runtime dependencies - apk --no-cache add geos@vm libpq nginx zlib + apk --no-cache add geos libpq nginx zlib # Install build dependencies apk --no-cache add --virtual .deps build-base git postgresql-dev python2-dev py2-pip zlib-dev diff --git a/lxc-apps/cts/install.sh b/lxc-apps/cts/install.sh index 07e9ec9..0a8723b 100755 --- a/lxc-apps/cts/install.sh +++ b/lxc-apps/cts/install.sh @@ -1,44 +1,43 @@ #!/bin/sh set -ev +# Volumes +POSTGRES_DATA="${VOLUMES_DIR}/cts/postgres_data" +CTS_CONF="${VOLUMES_DIR}/cts/cts_conf" + # Create Postgres instance -mkdir -p /srv/cts/postgres_data -chown -R 105432:105432 /srv/cts/postgres_data -chmod 700 /srv/cts/postgres_data -lxc-execute -n cts-postgres -- initdb -D /var/lib/postgresql +install -o 105432 -g 105432 -m 700 -d ${POSTGRES_DATA} +spoc-container exec cts-postgres -- initdb -D /var/lib/postgresql # Configure Postgres -cp postgres_data/postgresql.conf /srv/cts/postgres_data/postgresql.conf -cp postgres_data/pg_hba.conf /srv/cts/postgres_data/pg_hba.conf +install -o 105432 -g 105432 -m 600 postgres_data/postgresql.conf ${POSTGRES_DATA}/postgresql.conf +install -o 105432 -g 105432 -m 600 postgres_data/pg_hba.conf ${POSTGRES_DATA}/pg_hba.conf # Create database export CTS_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=') -service lxc-cts-postgres start -envsubst /srv/cts/cts_conf/spotter.py -touch /srv/cts/cts_conf/__init__.py +envsubst