diff --git a/lxc-apps/motech/app b/lxc-apps/motech/app new file mode 100644 index 0000000..24009cc --- /dev/null +++ b/lxc-apps/motech/app @@ -0,0 +1,34 @@ +{ + "version": "1.3.0-200313", + "meta": { + "title": "Motech", + "desc-cs": "Automatizace komunikace", + "desc-en": "Communication automation", + "license": "GPL" + }, + "containers": { + "motech": { + "image": "motech_1.3.0-200313", + "depends": [ + "motech-activemq", + "motech-postgres" + ], + "mounts": { + "motech/motech_conf": "srv/tomcat/.motech" + } + }, + "motech-activemq": { + "image": "activemq_5.15.9-200313", + "mounts": { + "motech/activemq_conf/activemq.xml": "srv/activemq/conf/activemq.xml:file", + "motech/activemq_data": "srv/activemq/data" + } + }, + "motech-postgres": { + "image": "postgres_12.2.0-200313", + "mounts": { + "motech/postgres_data": "var/lib/postgresql" + } + } + } +} diff --git a/lxc-apps/motech/lxcfile b/lxc-apps/motech/image similarity index 62% rename from lxc-apps/motech/lxcfile rename to lxc-apps/motech/image index fba770c..4cfdd0b 100644 --- a/lxc-apps/motech/lxcfile +++ b/lxc-apps/motech/image @@ -1,5 +1,5 @@ -IMAGE motech_1.3.0-190620 -FROM alpine3.9-tomcat7_7.0.94-190620 +IMAGE motech_1.3.0-200313 +FROM alpine3.11-tomcat7_7.0.99-200313 RUN EOF # Download Motech @@ -9,8 +9,8 @@ RUN EOF # Update Postgres JDBC driver rm -f /srv/tomcat/webapps/ROOT/WEB-INF/lib/postgresql-9.1-901.jdbc4.jar /srv/tomcat/webapps/ROOT/WEB-INF/bundles/postgresql-9.1-901.jdbc4.jar - wget https://jdbc.postgresql.org/download/postgresql-42.2.5.jar -O /srv/tomcat/webapps/ROOT/WEB-INF/lib/postgresql-42.2.5.jar - cp /srv/tomcat/webapps/ROOT/WEB-INF/lib/postgresql-42.2.5.jar /srv/tomcat/webapps/ROOT/WEB-INF/bundles/postgresql-42.2.5.jar + wget https://jdbc.postgresql.org/download/postgresql-42.2.11.jar -O /srv/tomcat/webapps/ROOT/WEB-INF/lib/postgresql-42.2.11.jar + cp /srv/tomcat/webapps/ROOT/WEB-INF/lib/postgresql-42.2.11.jar /srv/tomcat/webapps/ROOT/WEB-INF/bundles/postgresql-42.2.11.jar # Change webapps ownership chown -R tomcat:tomcat /srv/tomcat/webapps @@ -19,6 +19,6 @@ RUN EOF rm -f /tmp/motech.war EOF -USER 8080 8080 +USER tomcat WORKDIR /srv/tomcat -CMD catalina.sh run +CMD /usr/bin/catalina.sh run diff --git a/lxc-apps/motech/install.sh b/lxc-apps/motech/install.sh index a55e2f5..74d5c6f 100755 --- a/lxc-apps/motech/install.sh +++ b/lxc-apps/motech/install.sh @@ -1,52 +1,55 @@ #!/bin/sh set -ev +# Volumes +POSTGRES_DATA="${VOLUMES_DIR}/motech/postgres_data" +ACTIVEMQ_CONF="${VOLUMES_DIR}/motech/activemq_conf" +ACTIVEMQ_DATA="${VOLUMES_DIR}/motech/activemq_data" +MOTECH_CONF="${VOLUMES_DIR}/motech/motech_conf" + # Create Postgres instance -mkdir -p /srv/motech/postgres_data -chown -R 105432:105432 /srv/motech/postgres_data -chmod 700 /srv/motech/postgres_data -lxc-execute -n motech-postgres -- initdb -D /var/lib/postgresql +install -o 105432 -g 105432 -m 700 -d ${POSTGRES_DATA} +spoc-container exec motech-postgres -- initdb -D /var/lib/postgresql # Configure Postgres -cp postgres_data/postgresql.conf /srv/motech/postgres_data/postgresql.conf -cp postgres_data/pg_hba.conf /srv/motech/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 # Configure ActiveMQ -mkdir -p /srv/motech/activemq_conf /srv/motech/activemq_data -cp activemq_conf/activemq.xml /srv/motech/activemq_conf/activemq.xml -chown -R 161616:161616 /srv/motech/activemq_conf /srv/motech/activemq_data +install -o 161616 -g 161616 -m 750 -d ${ACTIVEMQ_CONF} +install -o 161616 -g 161616 -m 750 -d ${ACTIVEMQ_DATA} +install -o 161616 -g 161616 -m 640 activemq_conf/activemq.xml ${ACTIVEMQ_CONF}/activemq.xml # Create database export MOTECH_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=') -service lxc-motech-postgres start -envsubst /srv/motech/motech_conf/config/bootstrap.properties -cp motech_conf/config-locations.properties /srv/motech/motech_conf/config-locations.properties -cp motech_conf/config/motech-settings.properties /srv/motech/motech_conf/config/motech-settings.properties -cp motech_conf/config/org.motechproject.motech-platform-email/motech-email.properties /srv/motech/motech_conf/config/org.motechproject.motech-platform-email/motech-email.properties -chown -R 108080:108080 /srv/motech/motech_conf +install -o 108080 -g 108080 -m 750 -d ${MOTECH_CONF} +install -o 108080 -g 108080 -m 750 -d ${MOTECH_CONF}/config +install -o 108080 -g 108080 -m 750 -d ${MOTECH_CONF}/config/org.motechproject.motech-platform-email +envsubst