Make SeedDMS SPOC-compatible

This commit is contained in:
Disassembler 2020-03-23 10:11:16 +01:00
parent 746713eb9f
commit e0e49ec31a
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499
15 changed files with 53 additions and 55 deletions

27
lxc-apps/seeddms/app Normal file
View File

@ -0,0 +1,27 @@
{
"version": "5.1.15-200313",
"meta": {
"title": "SeedDMS",
"desc-cs": "Archiv dokumentace",
"desc-en": "Document management system",
"license": "GPL"
},
"containers": {
"seeddms": {
"image": "seeddms_5.1.15-200313",
"depends": [
"seeddms-postgres"
],
"mounts": {
"seeddms/seeddms_conf": "srv/seeddms/conf",
"seeddms/seeddms_data": "srv/seeddms/data"
}
},
"seeddms-postgres": {
"image": "postgres_12.2.0-200313",
"mounts": {
"seeddms/postgres_data": "var/lib/postgresql"
}
}
}
}

View File

@ -1,5 +1,5 @@
IMAGE seeddms_5.1.9-190620
FROM alpine3.9-php7.2_7.2.19-190620
IMAGE seeddms_5.1.15-200313
FROM alpine3.11-php7.3_7.3.15-200313
RUN EOF
# Install runtime dependencies
@ -14,18 +14,16 @@ RUN EOF
apk --no-cache add wget
# Install SeedDMS
wget https://sourceforge.net/projects/seeddms/files/seeddms-5.1.9/seeddms-quickstart-5.1.9.tar.gz/download -O /srv/seeddms.tgz
tar xzf /srv/seeddms.tgz -C /srv
mv /srv/seeddms51x /srv/seeddms
rm -f /srv/seeddms.tgz
wget https://sourceforge.net/projects/seeddms/files/seeddms-5.1.15/seeddms-quickstart-5.1.15.tar.gz/download -O - | tar xzf - -C /srv
mv /srv/seeddms* /srv/seeddms
EOF
COPY lxc
COPY image.d
RUN EOF
# Patch Previewers
cd /srv/seeddms
patch -p0 <previewers.patch
#TODO: patch -p0 <previewers.patch
rm previewers.patch
# Create OS user

View File

@ -1,40 +1,40 @@
#!/bin/sh
set -ev
# Volumes
POSTGRES_DATA="${VOLUMES_DIR}/seeddms/postgres_data"
SEEDDMS_DATA="${VOLUMES_DIR}/seeddms/seeddms_data"
SEEDDMS_CONF="${VOLUMES_DIR}/seeddms/seeddms_conf"
SEEDDMS_LAYER="${LAYERS_DIR}/seeddms_5.1.15-200313"
# 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
install -o 105432 -g 105432 -m 700 -d ${POSTGRES_DATA}
spoc-container exec 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
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
# Copy existing files into persistent storage
lxchelper extract seeddms /srv/seeddms/conf /srv/seeddms/seeddms_conf
lxchelper extract seeddms /srv/seeddms/data /srv/seeddms/seeddms_data
cp -rp ${SEEDDMS_LAYER}/srv/seeddms/conf ${SEEDDMS_CONF}
cp -rp ${SEEDDMS_LAYER}/srv/seeddms/data ${SEEDDMS_DATA}
# Populate database
export SEEDDMS_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=')
service lxc-seeddms-postgres start
envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 seeddms-postgres -- psql
lxc-execute seeddms -- cat /srv/seeddms/create_tables-postgres.sql | lxc-attach seeddms-postgres -- sh -c "PGPASSWORD=${SEEDDMS_PWD} psql seeddms seeddms"
cat custom.sql | lxc-attach -u 5432 -g 5432 seeddms-postgres -- psql seeddms
spoc-container start seeddms-postgres
envsubst <createdb.sql | spoc-container exec seeddms-postgres -- psql
cat ${SEEDDMS_LAYER}/srv/seeddms/create_tables-postgres.sql | spoc-container exec seeddms-postgres -- sh -c "PGPASSWORD=${SEEDDMS_PWD} psql seeddms seeddms"
cat custom.sql | spoc-container exec seeddms-postgres -- psql seeddms
# Configure SeedDMS
envsubst <seeddms_conf/settings.xml >/srv/seeddms/seeddms_conf/settings.xml
envsubst <seeddms_conf/settings.xml | install -o 108080 -g 108080 -m 640 /dev/stdin ${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 <adminpwd.sql | lxc-attach -u 5432 -g 5432 seeddms-postgres -- psql seeddms
chown -R 108080:108080 /srv/seeddms/seeddms_conf
# Install config update script
cp update-conf.sh /srv/seeddms/update-conf.sh
envsubst <adminpwd.sql | spoc-container exec seeddms-postgres -- psql seeddms
# Stop services required for setup
service lxc-seeddms-postgres stop
spoc-container stop seeddms-postgres
# Register application
vmmgr register-app seeddms dms "${SEEDDMS_ADMIN_USER}" "${SEEDDMS_ADMIN_PWD}"

View File

@ -1,27 +0,0 @@
{
"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": "postgres_11.3.0-190620",
"mounts": [
["DIR", "/srv/seeddms/postgres_data", "/var/lib/postgresql"]
]
}
}
}

View File

@ -2,7 +2,7 @@
set -ev
# Remove persistent data
rm -rf /srv/seeddms
rm -rf "${VOLUMES_DIR}/seeddms"
# Unregister application
vmmgr unregister-app seeddms