Skip to content

Commit

Permalink
Wait for the database to be ready
Browse files Browse the repository at this point in the history
  • Loading branch information
slumber authored and Deniallugo committed Jul 7, 2021
1 parent 7aea7d4 commit 1efa0a7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions docker/data-restore/data-restore-entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ set -e

cd $ZKSYNC_HOME

zk db wait
# Load the environment
export $(cat $ZKSYNC_HOME/etc/env/docker.env | sed 's/#.*//g' | xargs)

# Wait for the database to be ready.
until pg_isready -d $DATABASE_URL; do
sleep 1
done

if [[ -z $COMMAND || -z $NETWORK || -z $WEB3_URL ]]
then
Expand Down Expand Up @@ -43,7 +49,6 @@ then
[ -f /pg_restore/$PG_DUMP ] || { echo "$PG_DUMP not found" ; exit 1 ; }

zk db drop || true
export $(cat $ZKSYNC_HOME/etc/env/docker.env | sed 's/#.*//g' | xargs)
echo "Applying $PG_DUMP"
pg_restore -j 8 -d $DATABASE_URL /pg_restore/$PG_DUMP
fi
Expand Down

0 comments on commit 1efa0a7

Please sign in to comment.