diff --git a/lxc-apps/opendatakit/app b/lxc-apps/opendatakit/app new file mode 100644 index 0000000..0d9e6c1 --- /dev/null +++ b/lxc-apps/opendatakit/app @@ -0,0 +1,37 @@ +{ + "version": "2.0.5-200313", + "meta": { + "title": "OpenDataKit", + "desc-cs": "Sběr formulářových dat", + "desc-en": "Form data collection", + "license": "GPL" + }, + "containers": { + "opendatakit": { + "image": "opendatakit_2.0.5-200313", + "depends": [ + "opendatakit-postgres" + ], + "mounts": { + "opendatakit/odk_conf/server.xml": "srv/tomcat/conf/server.xml:file", + "opendatakit/odk_conf/jdbc.properties": "srv/tomcat/webapps/ROOT/WEB-INF/classes/jdbc.properties:file", + "opendatakit/odk_conf/security.properties": "srv/tomcat/webapps/ROOT/WEB-INF/classes/security.properties:file" + } + }, + "opendatakit-build": { + "image": "opendatakit-build_0.3.5-200313", + "depends": [ + "opendatakit-postgres" + ], + "mounts": { + "opendatakit/odkbuild_conf/config.yml": "srv/opendatakit-build/config.yml:file" + } + }, + "opendatakit-postgres": { + "image": "postgres_12.2.0-200313", + "mounts": { + "opendatakit/postgres_data": "var/lib/postgresql" + } + } + } +} diff --git a/lxc-apps/opendatakit/install.sh b/lxc-apps/opendatakit/install.sh index 1f2e46b..96fa595 100755 --- a/lxc-apps/opendatakit/install.sh +++ b/lxc-apps/opendatakit/install.sh @@ -1,57 +1,55 @@ #!/bin/sh set -ev +# Volumes +POSTGRES_DATA="${VOLUMES_DIR}/opendatakit/postgres_data" +ODK_CONF="${VOLUMES_DIR}/opendatakit/odk_conf" +ODKBUILD_CONF="${VOLUMES_DIR}/opendatakit/odkbuild_conf" + # Create Postgres instance -mkdir -p /srv/opendatakit/postgres_data -chown -R 105432:105432 /srv/opendatakit/postgres_data -chmod 700 /srv/opendatakit/postgres_data -lxc-execute -n opendatakit-postgres -- initdb -D /var/lib/postgresql +install -o 105432 -g 105432 -m 700 -d ${POSTGRES_DATA} +spoc-container exec opendatakit-postgres -- initdb -D /var/lib/postgresql # Configure Postgres -cp postgres_data/postgresql.conf /srv/opendatakit/postgres_data/postgresql.conf -cp postgres_data/pg_hba.conf /srv/opendatakit/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 databases export OPENDATAKIT_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=') export OPENDATAKITBUILD_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=') -service lxc-opendatakit-postgres start -envsubst /srv/opendatakit/odk_conf/jdbc.properties -envsubst /srv/opendatakit/odk_conf/security.properties -cp odk_conf/server.xml /srv/opendatakit/odk_conf/server.xml -chown -R 108080:108080 /srv/opendatakit/odk_conf +install -o 108080 -g 108080 -m 750 -d ${ODK_CONF} +envsubst /srv/opendatakit/odkbuild_conf/config.yml -lxc-execute opendatakit-build -- sh -c 'cd /srv/opendatakit-build; rake db:migrate' -chown -R 100000:100000 /srv/opendatakit/odkbuild_conf +install -o 108080 -g 108080 -m 750 -d ${ODKBUILD_CONF} +envsubst