From 5782083921d03b1eb05e3cf870117d7170ffb458 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Tue, 17 Mar 2020 10:43:46 +0100 Subject: [PATCH] Make EgoGIS SPOC-compatible --- lxc-apps/ecogis/app | 27 +++++++++++++++++++ lxc-apps/ecogis/{lxcfile => image} | 6 ++--- .../{lxc => image.d}/etc/nginx/nginx.conf | 0 .../{lxc => image.d}/etc/php5/php-fpm.conf | 0 .../etc/services.d/.s6-svscan/finish | 0 .../{lxc => image.d}/etc/services.d/nginx/run | 0 .../etc/services.d/php-fpm/run | 0 lxc-apps/ecogis/install.sh | 27 ++++++++++--------- lxc-apps/ecogis/meta | 27 ------------------- lxc-apps/ecogis/uninstall.sh | 2 +- 10 files changed, 46 insertions(+), 43 deletions(-) create mode 100644 lxc-apps/ecogis/app rename lxc-apps/ecogis/{lxcfile => image} (91%) rename lxc-apps/ecogis/{lxc => image.d}/etc/nginx/nginx.conf (100%) rename lxc-apps/ecogis/{lxc => image.d}/etc/php5/php-fpm.conf (100%) rename lxc-apps/ecogis/{lxc => image.d}/etc/services.d/.s6-svscan/finish (100%) rename lxc-apps/ecogis/{lxc => image.d}/etc/services.d/nginx/run (100%) rename lxc-apps/ecogis/{lxc => image.d}/etc/services.d/php-fpm/run (100%) delete mode 100644 lxc-apps/ecogis/meta diff --git a/lxc-apps/ecogis/app b/lxc-apps/ecogis/app new file mode 100644 index 0000000..b341fd6 --- /dev/null +++ b/lxc-apps/ecogis/app @@ -0,0 +1,27 @@ +{ + "version": "2.10.1-200313", + "meta": { + "title": "EcoGIS", + "desc-cs": "EcoGIS", + "desc-en": "EcoGIS", + "license": "GPL" + }, + "containers": { + "ecogis": { + "image": "ecogis_2.10.1-200313", + "depends": [ + "ecogis-postgres" + ], + "mounts": { + "ecogis/ecogis_data": "srv/ecogis/data/files", + "ecogis/ecogis_conf/config.php": "srv/ecogis/etc/config.php:file" + } + }, + "ecogis-postgres": { + "image": "postgres_11.3.0-190620", + "mounts": { + "ecogis/postgres_data": "var/lib/postgresql" + } + } + } +} diff --git a/lxc-apps/ecogis/lxcfile b/lxc-apps/ecogis/image similarity index 91% rename from lxc-apps/ecogis/lxcfile rename to lxc-apps/ecogis/image index c6107a0..eef6655 100644 --- a/lxc-apps/ecogis/lxcfile +++ b/lxc-apps/ecogis/image @@ -1,5 +1,5 @@ -IMAGE ecogis_0.0.1-190620 -FROM alpine3.8-php5.6_5.6.40-190620 +IMAGE ecogis_2.10.1-200313 +FROM alpine3.8-php5.6_5.6.40-200313 RUN EOF # Install runtime dependencies @@ -30,6 +30,6 @@ RUN EOF rm -rf /usr/bin/composer /tmp/.composer EOF -COPY lxc +COPY image.d CMD /bin/s6-svscan /etc/services.d diff --git a/lxc-apps/ecogis/lxc/etc/nginx/nginx.conf b/lxc-apps/ecogis/image.d/etc/nginx/nginx.conf similarity index 100% rename from lxc-apps/ecogis/lxc/etc/nginx/nginx.conf rename to lxc-apps/ecogis/image.d/etc/nginx/nginx.conf diff --git a/lxc-apps/ecogis/lxc/etc/php5/php-fpm.conf b/lxc-apps/ecogis/image.d/etc/php5/php-fpm.conf similarity index 100% rename from lxc-apps/ecogis/lxc/etc/php5/php-fpm.conf rename to lxc-apps/ecogis/image.d/etc/php5/php-fpm.conf diff --git a/lxc-apps/ecogis/lxc/etc/services.d/.s6-svscan/finish b/lxc-apps/ecogis/image.d/etc/services.d/.s6-svscan/finish similarity index 100% rename from lxc-apps/ecogis/lxc/etc/services.d/.s6-svscan/finish rename to lxc-apps/ecogis/image.d/etc/services.d/.s6-svscan/finish diff --git a/lxc-apps/ecogis/lxc/etc/services.d/nginx/run b/lxc-apps/ecogis/image.d/etc/services.d/nginx/run similarity index 100% rename from lxc-apps/ecogis/lxc/etc/services.d/nginx/run rename to lxc-apps/ecogis/image.d/etc/services.d/nginx/run diff --git a/lxc-apps/ecogis/lxc/etc/services.d/php-fpm/run b/lxc-apps/ecogis/image.d/etc/services.d/php-fpm/run similarity index 100% rename from lxc-apps/ecogis/lxc/etc/services.d/php-fpm/run rename to lxc-apps/ecogis/image.d/etc/services.d/php-fpm/run diff --git a/lxc-apps/ecogis/install.sh b/lxc-apps/ecogis/install.sh index 791ee92..bd3cbaa 100755 --- a/lxc-apps/ecogis/install.sh +++ b/lxc-apps/ecogis/install.sh @@ -1,28 +1,31 @@ #!/bin/sh set -ev +# Volumes +POSTGRES_DATA="${VOLUMES_DIR}/ecogis/postgres_data" +ECOGIS_CONF="${VOLUMES_DIR}/ecogis/ecogis_conf" +ECOGIS_DATA="${VOLUMES_DIR}/ecogis/ecogis_data" + # Create Postgres instance -mkdir -p /srv/ecogis/postgres_data -chown -R 105432:105432 /srv/ecogis/postgres_data -chmod 700 /srv/ecogis/postgres_data -lxc-execute -n ecogis-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/ecogis/postgres_data/postgresql.conf -cp postgres_data/pg_hba.conf /srv/ecogis/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 # Populate database export ECOGIS_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=') -service lxc-ecogis-postgres start -envsubst /srv/ecogis/ecogis_conf/config.php -chown -R 108080:108080 /srv/ecogis/ecogis_conf /srv/ecogis/ecogis_data +install -o 108080 -g 108080 -m 750 ${ECOGIS_CONF} +install -o 108080 -g 108080 -m 750 ${ECOGIS_DATA} +envsubst