Wait for the DB before running server in init-php
This commit is contained in:
parent
a37da4b099
commit
3756b0c565
11
init-php.sh
11
init-php.sh
@ -4,6 +4,17 @@ set -e
|
||||
|
||||
BASE_DIR=storage/app
|
||||
|
||||
# If DB_HOST not set, source the env file
|
||||
[ -z "${DB_HOST}" -a -r .env ] && . .env
|
||||
|
||||
if [ -n "${DB_HOST}" -a -n "${DB_PORT}" ]; then
|
||||
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}"
|
||||
fi
|
||||
|
||||
# If FIDO_DIR not set, source the env file
|
||||
[ -z "${FIDO_DIR}" -a -r .env ] && . .env
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user