From e047287407b69aa6233c786fc991435371dd6a9a Mon Sep 17 00:00:00 2001 From: Deon George Date: Tue, 4 May 2021 09:41:22 +1000 Subject: [PATCH] Enabled specifying additional queues to run locally --- init | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/init b/init index 6b89f38..283223a 100755 --- a/init +++ b/init @@ -5,9 +5,13 @@ role=${CONTAINER_ROLE:-app} env=${APP_ENV:-live} php=${PHP_DIR:-/var/www/html} composer=${COMPOSER_DIR:-/var/www/.composer} + NO_NGINX=${NO_NGINX:-TRUE} SSH_START=${SSH_START:-FALSE} + +# To run a local queue, running jobs from the queue "hostname" LOCAL_QUEUE=${LOCAL_QUEUE:-FALSE} +#LOCAL_QUEUES= Optional additional queues to run for function mp() { set +e @@ -107,9 +111,9 @@ if [ "${role}" = "app" -a -e artisan ]; then nginx_start if [ "${LOCAL_QUEUE}" = "TRUE" ]; then - echo "* Starting local queue ..." + echo "* Starting local queue for [${LOCAL_QUEUES}]..." 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) & + (while true; do php ${PHP_OPTIONS} artisan queue:work --verbose --tries=${WORK_TRIES:-1} --timeout=${WORK_TIMEOUT:-90} --queue=$(hostname)${LOCAL_QUEUES:+,${LOCAL_QUEUES}} ${WORK_MEMORY:+--memory=${WORK_MEMORY}} ${WORK_ONCE:+--once}; done) & " fi