From e5dc77b5587c28ec795e2dca47c3f9bb95fa0541 Mon Sep 17 00:00:00 2001 From: Abhilash Raj Date: Wed, 24 May 2017 10:45:27 -0700 Subject: [PATCH] Use the postgres client to check if database is up. --- core/assets/run.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/core/assets/run.sh b/core/assets/run.sh index 9c63e60..ba5fe87 100755 --- a/core/assets/run.sh +++ b/core/assets/run.sh @@ -15,13 +15,11 @@ function wait_for_postgres () { # moving forward. # TODO: Use python's psycopg2 module to do this in python instead of # installing postgres-client in the image. - # until psql $DATABASE_URL -c '\l'; do - # >&2 echo "Postgres is unavailable - sleeping" - # sleep 1 - # done - # >&2 echo "Postgres is up - continuing" - sleep 5 - # TODO: Just sleep and do not require postgres client for the image maybe. + until psql $DATABASE_URL -c '\l'; do + >&2 echo "Postgres is unavailable - sleeping" + sleep 1 + done + >&2 echo "Postgres is up - continuing" }