Created
January 23, 2017 07:24
-
-
Save tag1216/34325d6ecb96861e465a8cdbeab8bcda to your computer and use it in GitHub Desktop.
DjangoをDocker Composeで動かすときにDBが起動するまで待つ
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
command: ["./wait-for-db.sh", "--", "python", "manage.py", "runserver", "0.0.0.0:8000"] |
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/bash | |
set -e | |
shift | |
cmd="$@" | |
until ./manage.py inspectdb; do | |
>&2 echo "Database is unavailable - sleeping" | |
sleep 1 | |
done | |
>&2 echo "Database is up - executing command" | |
exec $cmd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment