Skip to content

Instantly share code, notes, and snippets.

View shams-ali's full-sized avatar

Shams Ali shams-ali

  • San Francisco, CA
View GitHub Profile
@shams-ali
shams-ali / docker-compose-wait-for-db.sh
Last active November 1, 2022 19:03 — forked from mvargeson/docker-compose-wait-for-db.sh
wait for db container to be available before starting server
#!/bin/bash THIS WORKED
bash -c 'while ! </dev/tcp/db/5432; do sleep 1; done; nodal db:bootstrap && nodal s;'
#THIS WORKS ONLY IF NETSTST INSTALLED
while ! nc -w 1 -z db 5432; do sleep 0.1; done
#ANOTHER WAY
until nc -z postgres 5432; do
echo "$(date) - waiting for postgres..."