mobilizon/docker/production/docker-entrypoint.sh
Thomas Citharel 9b4991844e
fix(docker): fix entrypoint PostgreSQL extensions creations not using MOBILIZON_DATABASE_PORT
Final step to complete #1321

Closes #1321

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2023-09-07 09:03:53 +02:00

17 lines
775 B
Bash
Executable file

#!/bin/sh
set -e
echo "-- Waiting for database..."
while ! pg_isready -U ${MOBILIZON_DATABASE_USERNAME} -d postgres://${MOBILIZON_DATABASE_HOST}:${MOBILIZON_DATABASE_PORT:-5432}/${MOBILIZON_DATABASE_DBNAME} -t 1; do
sleep 1s
done
PGPASSWORD=$MOBILIZON_DATABASE_PASSWORD psql -U $MOBILIZON_DATABASE_USERNAME -d $MOBILIZON_DATABASE_DBNAME -h $MOBILIZON_DATABASE_HOST -p ${MOBILIZON_DATABASE_PORT:-5432} -c 'CREATE EXTENSION IF NOT EXISTS pg_trgm;'
PGPASSWORD=$MOBILIZON_DATABASE_PASSWORD psql -U $MOBILIZON_DATABASE_USERNAME -d $MOBILIZON_DATABASE_DBNAME -h $MOBILIZON_DATABASE_HOST -p ${MOBILIZON_DATABASE_PORT:-5432} -c 'CREATE EXTENSION IF NOT EXISTS unaccent;'
echo "-- Running migrations..."
/bin/mobilizon_ctl migrate
echo "-- Starting!"
exec /bin/mobilizon start