Changed init-php to wait on DB before starting server

This commit is contained in:
Deon George 2021-06-24 21:10:15 +10:00
parent ff32ed1025
commit 0aa55fd6b8

View File

@ -1,6 +1,16 @@
#!/bin/sh
#!/bin/bash
# Run our web init startup
/sbin/init php-fpm &
# Wait for DB to start
# If DB_HOST not set, source the env file
[ -z "${DB_HOST}" -a -r .env ] && . .env
while ! wait-for-it -h ${DB_HOST} -p ${DB_PORT} -t 5 -q; do
echo "? Waiting for database at ${DB_HOST}:${DB_PORT}"
sleep 1;
done
echo "- DB is active on ${DB_HOST}:${DB_PORT}"
exec ./artisan server:start