mirror of
https://github.com/aljazceru/cyphernode.git
synced 2026-01-04 13:35:28 +01:00
We now wait for PostgreSQL to be ready to start the proxy
This commit is contained in:
@@ -2,10 +2,11 @@
|
||||
|
||||
. ./trace.sh
|
||||
|
||||
trace "[sqlmigrate20211105_0.7.0-0.8.0.sh] Waiting for postgres to be ready..."
|
||||
while true ; do psql -h postgres -U cyphernode -c "select 1;" ; [ "$?" -eq "0" ] && break ; sleep 10; done
|
||||
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 setup..."
|
||||
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
|
||||
# if cyphernode_props table doesn't exist, it's probably because database hasn't been setup yet
|
||||
|
||||
@@ -37,6 +37,10 @@ fi
|
||||
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}
|
||||
|
||||
Reference in New Issue
Block a user