From 4d764a8dd0417ba5f90329a715b8208b51c18476 Mon Sep 17 00:00:00 2001 From: kexkey Date: Wed, 1 Dec 2021 10:59:01 -0500 Subject: [PATCH] Postgres readyness check at one place in proxy instead of multiple --- proxy_docker/app/data/sqlmigrate20211105_0.7.0-0.8.0.sh | 4 ---- proxy_docker/app/script/startproxy.sh | 8 ++++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/proxy_docker/app/data/sqlmigrate20211105_0.7.0-0.8.0.sh b/proxy_docker/app/data/sqlmigrate20211105_0.7.0-0.8.0.sh index d615c0e..8c8e9ad 100644 --- a/proxy_docker/app/data/sqlmigrate20211105_0.7.0-0.8.0.sh +++ b/proxy_docker/app/data/sqlmigrate20211105_0.7.0-0.8.0.sh @@ -2,10 +2,6 @@ . ./trace.sh -trace "[sqlmigrate20211105_0.7.0-0.8.0.sh] Waiting for PostgreSQL to be ready..." -while [ ! -f "/container_monitor/postgres_ready" ]; do echo "PostgreSQL not ready" ; sleep 10 ; done -trace "[sqlmigrate20211105_0.7.0-0.8.0.sh] PostgreSQL ready!" - trace "[sqlmigrate20211105_0.7.0-0.8.0.sh] Checking if postgres is set up..." psql -h postgres -U cyphernode -c "\d" | grep "cyphernode_props" > /dev/null if [ "$?" -eq "1" ]; then diff --git a/proxy_docker/app/script/startproxy.sh b/proxy_docker/app/script/startproxy.sh index 6f855fe..3d2f995 100644 --- a/proxy_docker/app/script/startproxy.sh +++ b/proxy_docker/app/script/startproxy.sh @@ -34,13 +34,13 @@ else rm -f /container_monitor/proxy_dbfailed fi +trace "[startproxy] Waiting for PostgreSQL to be ready..." +while [ ! -f "/container_monitor/postgres_ready" ]; do echo "PostgreSQL not ready" ; sleep 10 ; done +trace "[startproxy] PostgreSQL ready!" + if [ ! -e ${DB_FILE} ]; then trace "[startproxy] DB not found, creating..." cat cyphernode.sql | sqlite3 $DB_FILE - - trace "[startproxy] Waiting for PostgreSQL to be ready..." - while [ ! -f "/container_monitor/postgres_ready" ]; do echo "PostgreSQL not ready" ; sleep 10 ; done - trace "[startproxy] PostgreSQL ready!" psql -h postgres -f cyphernode.postgresql -U cyphernode returncode=$? trace_rc ${returncode}