store DB password in secret. make entrypoint more robust.

This commit is contained in:
stevensting
2025-02-09 17:59:02 +01:00
parent 4df10ce60d
commit 6004522de6
5 changed files with 43 additions and 25 deletions
+12 -5
View File
@@ -23,16 +23,23 @@ file_env() {
file_env "DEVISE_SECRET"
file_env "SECRET_COOKIE_TOKEN"
file_env "POSTGRES_PASSWORD"
export DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db/${POSTGRES_DB}"
if test ! -f /loomio/storage/migrations_ran; then
echo "first deploy, running migrations..."
rake db:setup
touch /loomio/storage/migrations_ran
fi
if [ -n "$1" ]; then
echo "Running '$1'"
$1
else
if [ ! -f /loomio/storage/migrations_ran ] && [ "${TASK:-}" = "worker" ]; then
echo "first deploy, running DB setup..."
rake db:setup
touch /loomio/storage/migrations_ran
fi
echo "running DB migrations..."
rake db:migrate
echo "DB migrations finished"
echo "starting loomio!"
/loomio/docker_start.sh
fi