diff --git a/lxc-apps/seeddms/install.sh b/lxc-apps/seeddms/install.sh index 48916ac..b1423ed 100755 --- a/lxc-apps/seeddms/install.sh +++ b/lxc-apps/seeddms/install.sh @@ -3,41 +3,45 @@ set -ev cd $(realpath $(dirname "${0}"))/install -# Check prerequisites -[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 +# Create Postgres instance +mkdir -p /srv/seeddms/postgres_data +chown -R 105432:105432 /srv/seeddms/postgres_data +chmod 700 /srv/seeddms/postgres_data +lxc-execute -n seeddms-postgres -- initdb -D /var/lib/postgresql + +# Configure Postgres +cp postgres_data/postgresql.conf /srv/seeddms/postgres_data/postgresql.conf +cp postgres_data/pg_hba.conf /srv/seeddms/postgres_data/pg_hba.conf # Populate database export SEEDDMS_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=') -envsubst /srv/seeddms/conf/settings.xml +envsubst /srv/seeddms/seeddms_conf/settings.xml export SEEDDMS_ADMIN_USER=admin export SEEDDMS_ADMIN_PWD=$(head -c 12 /dev/urandom | base64 | tr -d '+/=') export SEEDDMS_ADMIN_EMAIL=admin@example.com -envsubst /dev/null -fi diff --git a/lxc-apps/seeddms/install/srv/seeddms/conf/settings.xml b/lxc-apps/seeddms/install/seeddms_conf/settings.xml similarity index 100% rename from lxc-apps/seeddms/install/srv/seeddms/conf/settings.xml rename to lxc-apps/seeddms/install/seeddms_conf/settings.xml diff --git a/lxc-apps/seeddms/install/srv/seeddms/update-conf.sh b/lxc-apps/seeddms/install/update-conf.sh old mode 100755 new mode 100644 similarity index 100% rename from lxc-apps/seeddms/install/srv/seeddms/update-conf.sh rename to lxc-apps/seeddms/install/update-conf.sh diff --git a/lxc-apps/seeddms/lxcfile b/lxc-apps/seeddms/lxcfile index 1494427..eed7e12 100644 --- a/lxc-apps/seeddms/lxcfile +++ b/lxc-apps/seeddms/lxcfile @@ -44,7 +44,4 @@ RUN EOF rm -rf /srv/seeddms/data/conf /srv/seeddms/www/ext/example EOF -MOUNT DIR /srv/seeddms/conf srv/seeddms/conf -MOUNT DIR /srv/seeddms/data srv/seeddms/data - CMD s6-svscan /etc/services.d diff --git a/lxc-apps/seeddms/meta b/lxc-apps/seeddms/meta new file mode 100644 index 0000000..186af42 --- /dev/null +++ b/lxc-apps/seeddms/meta @@ -0,0 +1,27 @@ +{ + "version": "5.1.9-190620", + "meta": { + "title": "SeedDMS", + "desc-cs": "Archiv dokumentace", + "desc-en": "Document management system", + "license": "GPL", + }, + "containers": { + "seeddms": { + "image": "seeddms_5.1.9-190620", + "depends": [ + "seeddms-postgres" + ], + "mounts": [ + ["DIR", "/srv/seeddms/seeddms_conf", "/srv/seeddms/conf"], + ["DIR", "/srv/seeddms/seeddms_data", "/srv/seeddms/data"] + ] + }, + "seeddms-postgres": { + "image": "postgis_11.3.0-190620", + "mounts": [ + ["DIR", "/srv/seeddms/postgres_data", "/var/lib/postgresql"] + ] + } + } +} diff --git a/lxc-apps/seeddms/uninstall.sh b/lxc-apps/seeddms/uninstall.sh index b11fa33..45f57a8 100755 --- a/lxc-apps/seeddms/uninstall.sh +++ b/lxc-apps/seeddms/uninstall.sh @@ -1,17 +1,8 @@ #!/bin/sh set -ev -# Remove cronjob -rm -f /etc/periodic/15min/seeddms - -# Remove service -rm -f /etc/init.d/seeddms -rc-update -u - -# Drop database and user -[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 -echo 'DROP DATABASE IF EXISTS seeddms; DROP ROLE IF EXISTS seeddms;' | lxc-attach -u 5432 -g 5432 postgres -- psql -[ ! -z ${STOP_POSTGRES} ] && service postgres stop +# Remove persistent data +rm -rf /srv/seeddms # Unregister application vmmgr unregister-app seeddms