From 93d5e360ca0fbf42dba804e1bf3c71ad936f2cc9 Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Sun, 9 Jul 2017 20:55:09 +0200 Subject: [PATCH] Merge dockerize commands --- docker/init.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docker/init.sh b/docker/init.sh index 16a55231..3a2031f3 100644 --- a/docker/init.sh +++ b/docker/init.sh @@ -31,13 +31,16 @@ user=$MYSQL_USER password=$MYSQL_PASSWORD ABC -if [ $(echo "show tables;" | dockerize -wait tcp://$DATABASE_HOST:$DATABASE_PORT -timeout 60s mysql --host $DATABASE_HOST --port $DATABASE_PORT $MYSQL_DATABASE | wc -l) -le 1 ]; then +echo ">>> Waiting for database to get ready to connect..." +dockerize -wait tcp://$DATABASE_HOST:$DATABASE_PORT -timeout 60s true + +if [ $(echo "show tables;" | mysql --host $DATABASE_HOST --port $DATABASE_PORT $MYSQL_DATABASE | wc -l) -le 1 ]; then echo ">>> Initializing database..." - dockerize -wait tcp://$DATABASE_HOST:$DATABASE_PORT -timeout 60s bundle exec rake db:schema:load + bundle exec rake db:schema:load fi echo ">>> Upgrading database..." -dockerize -wait tcp://$DATABASE_HOST:$DATABASE_PORT -timeout 60s bundle exec rake db:migrate +bundle exec rake db:migrate rm .my.cnf