Skip to content

Commit ea49e85

Browse files
authored
Update 00-postgres-init.sh
1 parent 400e9f2 commit ea49e85

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

00-postgres-init.sh

+8
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ docker run --rm --name post_setup \
1919
-v $HOME/docker/volumes/postgres:/var/lib/postgresql/data \
2020
postgres:13.3
2121

22+
# wait for the postgres service to be ready
23+
if ! command -v timeout &> /dev/null
24+
then
25+
echo "`timeout` could not be found. On Mac, run `brew install coreutils`"
26+
exit
27+
fi
28+
timeout 20s bash -c "until docker exec post_setup pg_isready; do sleep 1; done"
29+
2230
# create a new role, and two databases
2331
echo "CREATE ROLE rahul WITH PASSWORD 'pass' CREATEDB LOGIN;
2432
CREATE DATABASE work; CREATE DATABASE anomaly;" | \

0 commit comments

Comments
 (0)