mirror of
https://github.com/friendica/docker
synced 2025-01-19 17:37:00 +01:00
Fix $MYSQL_PORT default fallback & Removes the packed binary in favour of the already working upstream executable
This commit is contained in:
parent
33c9b09260
commit
e0448d4ac2
3 changed files with 2 additions and 49 deletions
|
@ -1,47 +0,0 @@
|
|||
#!/usr/local/bin/php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This script tries to connect to a database for a given interval
|
||||
* Useful in case of installation e.g. to wait for the database to not generate unnecessary errors
|
||||
*
|
||||
* Usage: php bin/wait-for-connection {HOST} {PORT} [{TIMEOUT}]
|
||||
*/
|
||||
|
||||
$timeout = 60;
|
||||
switch ($argc) {
|
||||
case 4:
|
||||
$timeout = (float)$argv[3];
|
||||
case 3:
|
||||
$host = $argv[1];
|
||||
$port = (int)$argv[2];
|
||||
break;
|
||||
default:
|
||||
fwrite(STDERR, 'Usage: '.$argv[0].' host port [timeout]'."\n");
|
||||
exit(2);
|
||||
}
|
||||
if ($timeout < 0) {
|
||||
fwrite(STDERR, 'Timeout must be greater than zero'."\n");
|
||||
exit(2);
|
||||
}
|
||||
if ($port < 1) {
|
||||
fwrite(STDERR, 'Port must be an integer greater than zero'."\n");
|
||||
exit(2);
|
||||
}
|
||||
$socketTimeout = (float)ini_get('default_socket_timeout');
|
||||
if ($socketTimeout > $timeout) {
|
||||
$socketTimeout = $timeout;
|
||||
}
|
||||
$stopTime = time() + $timeout;
|
||||
do {
|
||||
$sock = @fsockopen($host, $port, $errno, $errstr, $socketTimeout);
|
||||
if ($sock !== false) {
|
||||
fclose($sock);
|
||||
fwrite(STDOUT, "\n");
|
||||
exit(0);
|
||||
}
|
||||
sleep(1);
|
||||
fwrite(STDOUT, '.');
|
||||
} while (time() < $stopTime);
|
||||
fwrite(STDOUT, "\n");
|
||||
exit(1);
|
|
@ -6,7 +6,7 @@ while [ ! -f /var/www/html/bin/daemon.php ]; do
|
|||
done
|
||||
|
||||
echo "Waiting for MySQL $MYSQL_HOST initialization..."
|
||||
if /usr/local/bin/wait-for-connection "$MYSQL_HOST" "$MYSQL_PORT" 300; then
|
||||
if /var/www/html/bin//wait-for-connection "$MYSQL_HOST" "${MYSQL_PORT:-3306}" 300; then
|
||||
exec php /var/www/html/bin/daemon.php -f start
|
||||
else
|
||||
echo "[ERROR] Waited 300 seconds, no response" >&2
|
||||
|
|
|
@ -117,7 +117,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
|||
|
||||
if [ "$install" = true ]; then
|
||||
echo "Waiting for MySQL $MYSQL_HOST initialization..."
|
||||
if /usr/local/bin/wait-for-connection "$MYSQL_HOST" "$MYSQL_PORT" 300; then
|
||||
if /var/www/html/bin/wait-for-connection "$MYSQL_HOST" "${MYSQL_PORT:-3306}" 300; then
|
||||
|
||||
echo "Starting Friendica installation ..."
|
||||
run_as "php /var/www/html/bin/console.php autoinstall $install_options"
|
||||
|
|
Loading…
Reference in a new issue