Created
November 24, 2020 15:53
-
-
Save luispabon/db0a2a4d72ce34289fab2dfa74fd8457 to your computer and use it in GitHub Desktop.
Waiting for DB docker edition - these scripts require the standard env vars the docker images use to initially provision themselves
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 | |
# Make sure you run this in the mysql container | |
RETRIES=5 | |
echo "Waiting for mysql" | |
until mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" "${MYSQL_DATABASE}" -e "select 1" &> /dev/null || [ $RETRIES -eq 0 ] | |
do | |
echo "Waiting for mysql server, $((RETRIES--)) remaining attempts..." | |
sleep 1 | |
done | |
echo -e "\nmysql ready" |
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 | |
RETRIES=5 | |
# Make sure you run this in the postgres container | |
echo "Waiting for postgres" | |
until psql -h localhost -U "${POSTGRES_USER}" -d "${POSTGRES_DB}" -c "select 1" > /dev/null 2>&1 || [ $RETRIES -eq 0 ] | |
do | |
echo "Waiting for postgres server, $((RETRIES--)) remaining attempts..." | |
sleep 1 | |
done | |
echo -3 "\npostgres ready" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment