Make entrypoint setup more granular, optimize s6

This commit is contained in:
Disassembler 2024-09-01 11:09:40 +02:00
parent 95ed6c16df
commit 990b564d06
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499
5 changed files with 19 additions and 8 deletions

View File

@ -14,16 +14,26 @@ chown -R seeddms:seeddms /srv/seeddms/conf /srv/seeddms/data
export PGPASSWORD=${POSTGRES_PASSWORD}
DB_EXISTS=$(psql -h "${POSTGRES_HOST}" -Atc "SELECT 1 FROM \"tblVersion\"" "${POSTGRES_DB}" "${POSTGRES_USER}" 2>/dev/null || true)
if [ -z "${DB_EXISTS}" ]; then
cat /srv/seeddms/seeddms/install/create_tables-postgres.sql | psql -h "${POSTGRES_HOST}" "${POSTGRES_DB}" "${POSTGRES_USER}"
cat /srv/seeddms/seeddms/install/custom.sql | psql -h "${POSTGRES_HOST}" "${POSTGRES_DB}" "${POSTGRES_USER}"
echo "Populating database..."
cat /srv/seeddms/seeddms/install/create_tables-postgres.sql | psql -h "${POSTGRES_HOST}" "${POSTGRES_DB}" "${POSTGRES_USER}" >/dev/null
cat /srv/seeddms/seeddms/install/custom.sql | psql -h "${POSTGRES_HOST}" "${POSTGRES_DB}" "${POSTGRES_USER}" >/dev/null
fi
# Update admin
if [ -n "${SEEDDMS_ADMIN_USER}" ]; then
psql -h "${POSTGRES_HOST}" -Atc "UPDATE \"tblUsers\" SET login = '${SEEDDMS_ADMIN_USER}' WHERE id = 1" "${POSTGRES_DB}" "${POSTGRES_USER}" >/dev/null
fi
if [ -n "${SEEDDMS_ADMIN_PASSWORD}" ]; then
psql -h "${POSTGRES_HOST}" -Atc "UPDATE \"tblUsers\" SET pwd = MD5('${SEEDDMS_ADMIN_PASSWORD}') WHERE id = 1" "${POSTGRES_DB}" "${POSTGRES_USER}" >/dev/null
fi
if [ -n "${SEEDDMS_ADMIN_EMAIL}" ] ; then
psql -h "${POSTGRES_HOST}" -Atc "UPDATE \"tblUsers\" SET email = '${SEEDDMS_ADMIN_EMAIL}' WHERE id = 1" "${POSTGRES_DB}" "${POSTGRES_USER}" >/dev/null
fi
psql -h "${POSTGRES_HOST}" -Atc "UPDATE \"tblUsers\" SET login = '${SEEDDMS_ADMIN_USER}', pwd = MD5('${SEEDDMS_ADMIN_PASSWORD}'), email = '${SEEDDMS_ADMIN_EMAIL}' WHERE id = 1" "${POSTGRES_DB}" "${POSTGRES_USER}"
# TODO: Update database
# Looks like database schema updates are done only in new minor version (e.g. 6.0.x -> 6.1.x)
unset PGPASSWORD
# Configure SeedDMS
/usr/bin/php -f /srv/seeddms/settings-from-env-vars.php
php -f /srv/seeddms/settings-from-env-vars.php
chown seeddms:seeddms /srv/seeddms/conf/settings.xml
# Exec into s6 supervisor

View File

@ -1,5 +1,3 @@
#!/bin/execlineb -P
#!/bin/execlineb
/bin/foreground { /bin/s6-svwait -d -t 3000 cron }
/bin/foreground { /bin/s6-svwait -d -t 3000 nginx }
/bin/foreground { /bin/s6-svwait -d -t 3000 php-fpm }
exit 0

View File

@ -0,0 +1 @@
3000

View File

@ -0,0 +1 @@
3000

View File

@ -0,0 +1 @@
3000