From c4de84d51a536fba25c3f64ddfe24a5d231a77e4 Mon Sep 17 00:00:00 2001 From: Deon George Date: Thu, 25 Mar 2021 14:13:54 +1100 Subject: [PATCH] Add LOCAL_QUEUE process for jobs on the 'hostname' queue --- init | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/init b/init index 1506a45..6b89f38 100755 --- a/init +++ b/init @@ -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 "$@"