Feedati/docker/wait-db
boyska d14a4d442f [TT] stop using OpenRC
it was becoming too complex; now we are running multiple containers
from the same image. Coordination between those processes is not needed
(db is where it happens), so it should work.

waiting psql to be alive is a duty moved to a wrapper script "wait-db"
2018-08-19 02:19:28 +02:00

12 lines
305 B
Bash
Executable file

#!/bin/bash
timeout=60
for _ in $(seq 1 "$timeout"); do
if env PGPASSWORD=password-dev psql -h db -U ttrss -w ttrss -c "" -q 2> /dev/null; then
echo "DB ready"
exec "$@"
fi
echo "Waiting..." >&2
sleep 1
done
echo "Timeout! postgresql wasn't ready in 60 seconds" >&2
exit 1