We are trying to process a Redis queue with the Laravel Artisan Daemon Queue Listener.
Running the command php /var/app/current/artisan queue:work --tries=3 directly when logged in to one of the EC2-servers over SSH works perfectly every time. However, when running this command via Supervisor nothing happens.
In our .ebextensions-folder we have a scripts file containing the following configuration necessary to copy our supervisor configuration to a folder on to the machine:
01-migration:
command: "php /var/app/ondeck/artisan migrate --force && php /var/app/ondeck/artisan db:seed --force"
leader_only: true
02-supervisor:
command: "mkdir -p /etc/supervisor/conf.d/ && cat eb/laravel-worker.conf > /etc/supervisor/conf.d/laravel-worker.conf && cat eb/supervisord.conf > /etc/supervisor/conf.d/supervisord.conf && mkdir -p /var/log/supervisor/ && touch /var/log/supervisor/supervisord.log"
laravel-worker.conf
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/app/current/artisan queue:listen --tries=3
autostart=true
autorestart=true
user=webapp
numprocs=5
redirect_stderr=true
stdout_logfile=/var/app/current/storage/worker.log
We can see the processes being created:
Screenshot of the processes running
We also can't see anything happening in the logfiles (worker.log).
After finding lifeofguenter's configuration on GitHub, we noticed that supervisor couldn't read our environment variables.
This line enlightened us:
# make sure elasticbeanstalk PARAMS are being passed through to supervisord
. /opt/elasticbeanstalk/support/envvars
Source: https://gist.github.com/lifeofguenter/f8ea93f10a403807a719