Chatwoot/docker/entrypoints/rails.sh
Pascal Jufer c37966744f
fix: Fix and rename pg_database_url.sh helper script (#2747)
- Fix and rename pg_database_url helper script
- Use single-quote and remove trailing whitespace
2021-08-03 22:56:55 +05:30

33 lines
658 B
Bash
Executable file

#!/bin/sh
set -x
# Remove a potentially pre-existing server.pid for Rails.
rm -rf /app/tmp/pids/server.pid
rm -rf /app/tmp/cache/*
echo "Waiting for postgres to become ready...."
# Let DATABASE_URL env take presedence over individual connection params.
# This is done to avoid printing the DATABASE_URL in the logs
$(docker/entrypoints/helpers/pg_database_url.rb)
PG_READY="pg_isready -h $POSTGRES_HOST -p $POSTGRES_PORT -U $POSTGRES_USERNAME"
until $PG_READY
do
sleep 2;
done
echo "Database ready to accept connections."
bundle install
BUNDLE="bundle check"
until $BUNDLE
do
sleep 2;
done
# Execute the main process of the container
exec "$@"