Skip to content

Instantly share code, notes, and snippets.

@fredleger
Created November 26, 2018 16:11
Show Gist options
  • Save fredleger/b40b12ff28650d44a841097a7f4d0800 to your computer and use it in GitHub Desktop.
Save fredleger/b40b12ff28650d44a841097a7f4d0800 to your computer and use it in GitHub Desktop.
Detect if mysql container is ready
#!/bin/bash
php "./bin/mysql-is-ready"
php app/console doctrine:schema:create --no-debug
php app/console doctrine:schema:update --no-debug
<?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