-
-
Save sankar4n/132c4ccc9a1b266c093d7ddb374f14af to your computer and use it in GitHub Desktop.
Wait for Postgres initialization in Docker-Compose
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
until psql -d "postgres" -c '\q'; do | |
>&2 echo "Postgres is unavailable - sleeping" | |
sleep 1 | |
done | |
>&2 echo "Ensuring database..." | |
psql -d postgres -c "CREATE DATABASE \"$PGDATABASE\";" || true | |
>&2 echo "Postgres is up!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment