Skip to content
This repository has been archived by the owner on May 17, 2018. It is now read-only.

Commit

Permalink
Add scripto to check db health
Browse files Browse the repository at this point in the history
Signed-off-by: Matheus Fernandes <[email protected]>
  • Loading branch information
msfernandes committed Nov 13, 2017
1 parent 1d880c8 commit 749754b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion start-colab.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,16 @@ fi

crond

PGPASSWORD=$DATABASE_PASSWORD psql -U $DATABASE_USER -w -h $DATABASE_HOST -c "CREATE DATABASE ${DATABASE_NAME} OWNER root"
while true; do
PG_STATUS=`PGPASSWORD=$DATABASE_PASSWORD psql -U $DATABASE_USER -w -h $DATABASE_HOST -c '\l \q' | grep postgres | wc -l`
if ! [ "$PG_STATUS" -eq "0" ]; then
break
fi
echo "Waiting Database Setup"
sleep 10
done

PGPASSWORD=$DATABASE_PASSWORD psql -U $DATABASE_USER -w -h $DATABASE_HOST -c "CREATE DATABASE ${DATABASE_NAME} OWNER ${DATABASE_USER}"
colab-admin migrate
colab-admin initdb

Expand Down

0 comments on commit 749754b

Please sign in to comment.