Created
April 1, 2017 07:15
-
-
Save dakatsuka/dd31a91f410e2087a63bc97cef52aeb1 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env bash | |
migrate() { | |
echo -n "waiting for TCP connection to $DATABASE_HOST:$DATABASE_PORT..." | |
while ! nc -z $DATABASE_HOST $DATABASE_PORT | |
do | |
echo -n . | |
sleep 3 | |
done | |
/opt/docker/flyway/flyway -locations=filesystem:/opt/docker/migration -user=$DATABASE_USER -password=$DATABASE_PASSWORD -url=jdbc:postgresql://$DATABASE_HOST:$DATABASE_PORT/$DATABASE_NAME -outOfOrder info | |
/opt/docker/flyway/flyway -locations=filesystem:/opt/docker/migration -user=$DATABASE_USER -password=$DATABASE_PASSWORD -url=jdbc:postgresql://$DATABASE_HOST:$DATABASE_PORT/$DATABASE_NAME -outOfOrder migrate | |
} | |
if [[ -v AUTO_MIGRATION ]] | |
then | |
migrate | |
fi | |
exec /opt/docker/bin/api $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment