From ecfafd0c4a15faa859c48f35cbea80b7588f505f Mon Sep 17 00:00:00 2001 From: Disassembler Date: Mon, 23 Mar 2020 13:43:53 +0100 Subject: [PATCH] Make Sigmah SPOC-compatible --- lxc-apps/sigmah/app | 27 ++++++++++++ lxc-apps/sigmah/{lxcfile => image} | 8 ++-- .../sigmah/WEB-INF/classes/logback.xml | 0 lxc-apps/sigmah/install.sh | 43 ++++++++++--------- lxc-apps/sigmah/meta | 27 ------------ lxc-apps/sigmah/uninstall.sh | 2 +- 6 files changed, 54 insertions(+), 53 deletions(-) create mode 100644 lxc-apps/sigmah/app rename lxc-apps/sigmah/{lxcfile => image} (92%) rename lxc-apps/sigmah/{lxc => image.d}/srv/tomcat/webapps/sigmah/WEB-INF/classes/logback.xml (100%) delete mode 100644 lxc-apps/sigmah/meta diff --git a/lxc-apps/sigmah/app b/lxc-apps/sigmah/app new file mode 100644 index 0000000..5a169aa --- /dev/null +++ b/lxc-apps/sigmah/app @@ -0,0 +1,27 @@ +{ + "version": "2.0.2-200313", + "meta": { + "title": "Sigmah", + "desc-cs": "Finanční řízení sbírek", + "desc-en": "Donation management", + "license": "GPL" + }, + "containers": { + "sigmah": { + "image": "sigmah_2.0.2-200313", + "depends": [ + "sigmah-postgres" + ], + "mounts": { + "sigmah/sigmah_conf": "srv/sigmah/conf", + "sigmah/sigmah_data": "srv/sigmah/data" + } + }, + "sigmah-postgres": { + "image": "postgres_12.2.0-200313", + "mounts": { + "sigmah/postgres_data": "var/lib/postgresql" + } + } + } +} diff --git a/lxc-apps/sigmah/lxcfile b/lxc-apps/sigmah/image similarity index 92% rename from lxc-apps/sigmah/lxcfile rename to lxc-apps/sigmah/image index c98303a..99e0c97 100644 --- a/lxc-apps/sigmah/lxcfile +++ b/lxc-apps/sigmah/image @@ -1,5 +1,5 @@ -IMAGE sigmah_2.0.2-190620 -FROM alpine3.9-tomcat8.5_8.5.41-190620 +IMAGE sigmah_2.0.2-200313 +FROM alpine3.11-tomcat8.5_8.5.51-200313 RUN EOF # Download Sigmah @@ -25,8 +25,8 @@ RUN EOF rm /tmp/sigmah.war EOF -COPY lxc +COPY image.d -USER 8080 8080 +USER tomcat WORKDIR /srv/tomcat CMD /usr/bin/catalina.sh run diff --git a/lxc-apps/sigmah/lxc/srv/tomcat/webapps/sigmah/WEB-INF/classes/logback.xml b/lxc-apps/sigmah/image.d/srv/tomcat/webapps/sigmah/WEB-INF/classes/logback.xml similarity index 100% rename from lxc-apps/sigmah/lxc/srv/tomcat/webapps/sigmah/WEB-INF/classes/logback.xml rename to lxc-apps/sigmah/image.d/srv/tomcat/webapps/sigmah/WEB-INF/classes/logback.xml diff --git a/lxc-apps/sigmah/install.sh b/lxc-apps/sigmah/install.sh index 396d3fc..2337a0d 100755 --- a/lxc-apps/sigmah/install.sh +++ b/lxc-apps/sigmah/install.sh @@ -1,36 +1,40 @@ #!/bin/sh set -ev +# Volumes +POSTGRES_DATA="${VOLUMES_DIR}/sigmah/postgres_data" +SIGMAH_DATA="${VOLUMES_DIR}/sigmah/sigmah_data" +SIGMAH_CONF="${VOLUMES_DIR}/sigmah/sigmah_conf" +SIGMAH_LAYER="${LAYERS_DIR}/sigmah_2.0.2-200313" + # Create Postgres instance -mkdir -p /srv/sigmah/postgres_data -chown -R 105432:105432 /srv/sigmah/postgres_data -chmod 700 /srv/sigmah/postgres_data -lxc-execute -n sigmah-postgres -- initdb -D /var/lib/postgresql +install -o 105432 -g 105432 -m 700 -d ${POSTGRES_DATA} +spoc-container exec sigmah-postgres -- initdb -D /var/lib/postgresql # Configure Postgres -cp postgres_data/postgresql.conf /srv/sigmah/postgres_data/postgresql.conf -cp postgres_data/pg_hba.conf /srv/sigmah/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 SIGMAH_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=') -service lxc-sigmah-postgres start -envsubst /srv/sigmah/sigmah_conf/persistence.xml -cp sigmah_conf/sigmah.properties /srv/sigmah/sigmah_conf/sigmah.properties -chown -R 108080:108080 /srv/sigmah/sigmah_conf -lxchelper extract sigmah /srv/tomcat/webapps/sigmah/sigmah/images/header/org-default-logo.png /srv/sigmah/sigmah_data/files/logo.png +install -o 108080 -g 108080 -m 750 -d ${SIGMAH_CONF} +install -o 108080 -g 108080 -m 750 -d ${SIGMAH_DATA}/files +install -o 108080 -g 108080 -m 750 -d ${SIGMAH_DATA}/archives +envsubst