From 6b7cce63effcfd247f21a1324a81c38118cdd58a Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 10 Jul 2016 10:30:31 +0200 Subject: docker: Wait for database to reachable before doing anything This is necessary for future use of docker-compose Signed-off-by: Florian Pritz --- docker/filebin_starter.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'docker/filebin_starter.sh') diff --git a/docker/filebin_starter.sh b/docker/filebin_starter.sh index 65cf4a44b..4fa50d583 100755 --- a/docker/filebin_starter.sh +++ b/docker/filebin_starter.sh @@ -12,6 +12,13 @@ function set_database_config() { sed -i "s/\$db\['default'\]\['database'\] = .*/\$db['default']['database'] = \"${FB_DB_DATABASE}\";/" ${FILEBIN_DIR}/application/config/database.php } +# wait for DB to be ready +while ! nc "$FB_DB_HOSTNAME" 3306 /dev/null; do + echo "Waiting for database" + sleep 0.5 +done + + if [[ ! -e $FILEBIN_DIR/application/config/config-local.php ]]; then echo "no config found, new config will be generated" cp $FILEBIN_DIR/application/config/example/config-local.php ${FILEBIN_DIR}/application/config/config-local.php -- cgit v1.2.3-24-g4f1b