Add LOCAL_QUEUE process for jobs on the 'hostname' queue

This commit is contained in:
Deon George 2021-03-25 14:13:54 +11:00
parent f2602bd98a
commit c4de84d51a

7
init
View File

@ -7,6 +7,7 @@ php=${PHP_DIR:-/var/www/html}
composer=${COMPOSER_DIR:-/var/www/.composer}
NO_NGINX=${NO_NGINX:-TRUE}
SSH_START=${SSH_START:-FALSE}
LOCAL_QUEUE=${LOCAL_QUEUE:-FALSE}
function mp() {
set +e
@ -105,6 +106,12 @@ if [ "${role}" = "app" -a -e artisan ]; then
fi
nginx_start
if [ "${LOCAL_QUEUE}" = "TRUE" ]; then
echo "* Starting local queue ..."
su www-data -s /bin/sh -c "
(while true; do php ${PHP_OPTIONS} artisan queue:work --verbose --tries=${WORK_TRIES:-1} --timeout=${WORK_TIMEOUT:-90} --queue=$(hostname) ${WORK_MEMORY:+--memory=${WORK_MEMORY}} ${WORK_ONCE:+--once}; done) &
"
fi
exec /usr/local/bin/docker-php-entrypoint "$@"