More work on init-php

This commit is contained in:
Deon George 2021-06-24 21:31:02 +10:00
parent 0aa55fd6b8
commit ebabe6e698

View File

@ -1,16 +1,23 @@
#!/bin/bash
# Run our web init startup
rm -f bootstrap/cache/*.php
/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
while ! wait-for-it -h ${DB_HOST} -p ${DB_PORT} -t 15 -q; do
echo "? Waiting for database at ${DB_HOST}:${DB_PORT}"
sleep 1;
done
done
echo "- DB is active on ${DB_HOST}:${DB_PORT}"
# Wait for our config to have been rebuild
while [ ! -e bootstrap/cache/config.php -o -e .migrate ]; do
echo "? Waiting for configuration to be built by init"
sleep 15;
done
echo "* Ready to start server"
exec ./artisan server:start