mobilizon.chapril.org-mobil.../docker/production/docker-entrypoint.sh
Thomas Citharel 030f548f16
Integrate extensions creation in entry point
Requires postgresql-client to be added to the image

Closes #503

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2020-11-14 20:47:08 +01:00

17 lines
675 B
Bash
Executable File

#!/bin/sh
set -e
echo "-- Waiting for database..."
while ! pg_isready -U ${MOBILIZON_DATABASE_USERNAME} -d postgres://${MOBILIZON_DATABASE_HOST}: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 -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 -c 'CREATE EXTENSION IF NOT EXISTS unaccent;'
echo "-- Running migrations..."
/bin/mobilizon_ctl migrate
echo "-- Starting!"
exec /bin/mobilizon start