Compare commits

..

2 Commits

Author SHA1 Message Date
Deon George
e4aabe71f3 PHP 8.3 install postgres module
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 40s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m26s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s
Create Docker Image / Build Docker Test Image (x86_64) (push) Successful in 57s
Create Docker Image / Final Docker Test Image Manifest (push) Successful in 11s
2024-09-24 23:23:56 +10:00
d62cc85c97 schedule:work now doesnt exit immediately, add wait_for_db for queue
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 3m24s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 12m8s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s
Create Docker Image / Build Docker Test Image (x86_64) (push) Successful in 54s
Create Docker Image / Final Docker Test Image Manifest (push) Successful in 10s
2024-09-24 23:21:05 +10:00

View File

@ -31,6 +31,17 @@ function nginx_start() {
fi 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 # Run any container setup
[ -x /sbin/init-container ] && /sbin/init-container [ -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 # If DB_HOST not set, source the env file
[ -z "${DB_HOST}" -a -r .env ] && . .env [ -z "${DB_HOST}" -a -r .env ] && . .env
if [ -n "${DB_HOST}" -a -n "${DB_PORT}" ]; then wait_for_db
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
su www-data -s /bin/sh -c "php artisan migrate" && rm -f .migrate su www-data -s /bin/sh -c "php artisan migrate" && rm -f .migrate
fi fi
@ -149,6 +154,8 @@ if [ -r artisan -a -e ${php}/.env ]; then
# We'll delay starting in case the app is caching # We'll delay starting in case the app is caching
sleep 15 sleep 15
wait_for_db
su www-data -s /bin/sh -c " su www-data -s /bin/sh -c "
while true; do 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} 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 " su www-data -s /bin/sh -c "
while true; do while true; do
(php ${PHP_OPTIONS} artisan schedule:work --verbose --no-interaction &) php ${PHP_OPTIONS} artisan schedule:work --verbose --no-interaction
done done
" "
fi fi