entrypoint.sh: Wait for DB to start up

- Added wait-for-it.sh

- use wait-for-it.sh to wait for pgsql / mysql DB before running
`artisan` commands
This commit is contained in:
hulloanson
2019-03-24 18:00:25 +08:00
parent ff23898c83
commit 638f361479
2 changed files with 191 additions and 1 deletions

View File

@@ -51,6 +51,18 @@ echo "Discover packages..."
php artisan package:discover
echo "Run various artisan commands..."
. $FIREFLY_PATH/.env
if [[ -z "$DB_PORT" ]]; then
if [[ $DB_CONNECTION == "pgsql" ]]; then
DB_PORT=5432
elif [[ $DB_CONNECTION == "mysql" ]]; then
DB_PORT=3306
fi
fi
if [[ ! -z "$DB_PORT" ]]; then
$FIREFLY_PATH/.deploy/docker/wait-for-it.sh "${DB_HOST}:${DB_PORT}" -- echo "db is up. Time to execute artisan commands"
fi
#env $(grep -v "^\#" .env | xargs)
php artisan migrate --seed
php artisan firefly:decrypt-all
php artisan firefly:upgrade-database
@@ -61,4 +73,4 @@ php artisan cache:clear
php artisan firefly:instructions install
echo "Go!"
exec apache2-foreground
exec apache2-foreground