Created
November 26, 2018 16:11
-
-
Save fredleger/b40b12ff28650d44a841097a7f4d0800 to your computer and use it in GitHub Desktop.
Detect if mysql container is 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
#!/bin/bash | |
php "./bin/mysql-is-ready" | |
php app/console doctrine:schema:create --no-debug | |
php app/console doctrine:schema:update --no-debug |
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
<?php | |
while ( !$link ) { | |
$link = mysqli_connect($_ENV["STREAX_BACKEND_DATABASE_HOST"], | |
$_ENV["STREAX_BACKEND_DATABASE_USER"], | |
$_ENV["STREAX_BACKEND_DATABASE_PASSWORD"], | |
$_ENV["STREAX_BACKEND_DATABASE_NAME"]); | |
if (!$link) { | |
echo "Error: Unable to connect to MySQL" . PHP_EOL; | |
echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL; | |
echo "Debugging error: " . mysqli_connect_error() . PHP_EOL; | |
sleep(1); | |
} | |
} | |
echo "Success: a proper connection to MySQL was made" . PHP_EOL; | |
echo "Host information: " . mysqli_get_host_info($link) . PHP_EOL; | |
mysqli_close($link); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment