Compare commits
3 Commits
58a035987f
...
f844307418
Author | SHA1 | Date | |
---|---|---|---|
f844307418 | |||
|
e4aabe71f3 | ||
d62cc85c97 |
23
docker/init
23
docker/init
@ -31,6 +31,17 @@ function nginx_start() {
|
||||
fi
|
||||
}
|
||||
|
||||
function wait_for_db() {
|
||||
# Wait for DB to be active
|
||||
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
|
||||
}
|
||||
|
||||
# Run any container setup
|
||||
[ -x /sbin/init-container ] && /sbin/init-container
|
||||
|
||||
@ -101,13 +112,7 @@ if [ -r artisan -a -e ${php}/.env ]; then
|
||||
# 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
|
||||
wait_for_db
|
||||
|
||||
su www-data -s /bin/sh -c "php artisan migrate" && rm -f .migrate
|
||||
fi
|
||||
@ -149,6 +154,8 @@ if [ -r artisan -a -e ${php}/.env ]; then
|
||||
# We'll delay starting in case the app is caching
|
||||
sleep 15
|
||||
|
||||
wait_for_db
|
||||
|
||||
su www-data -s /bin/sh -c "
|
||||
while true; do
|
||||
php ${PHP_OPTIONS} artisan queue:${QUEUE_CMD} --verbose --tries=${WORK_TRIES:-1} --timeout=${WORK_TIMEOUT:-90} ${WORK_QUEUES:+--queue=${WORK_QUEUES}} ${WORK_MEMORY:+--memory=${WORK_MEMORY}} ${WORK_ONCE:+--once}
|
||||
@ -162,7 +169,7 @@ if [ -r artisan -a -e ${php}/.env ]; then
|
||||
|
||||
su www-data -s /bin/sh -c "
|
||||
while true; do
|
||||
(php ${PHP_OPTIONS} artisan schedule:work --verbose --no-interaction &)
|
||||
php ${PHP_OPTIONS} artisan schedule:work --verbose --no-interaction
|
||||
done
|
||||
"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user