Every Laravel Queue has it’s own cached version of Laravel Models, Jobs & Notification. You will be in serious panic if you are working on Jobs & Notification as Queue will not update the version of those file dynamically. You will need to restart Queue every time, by finding it in processes and killing it.
Supervisor is a client/server system that allows its users to control a number of processes on UNIX-like operating systems.
Install Supervisor using PIP
On an Ubuntu, install Supervisor with apt:
sudo apt update
sudo apt install supervisor -y
Enable and start the service:
sudo systemctl enable supervisor
sudo systemctl start supervisor
Check that it’s running:
sudo systemctl status supervisor
You should see:
Active: active (running)
Verify Supervisor
sudo supervisorctl status
If there are no configured processes yet, that’s fine.
Where to configure workers
Supervisor configurations are normally placed in:
/etc/supervisor/conf.d/
Create new Queue
Create a Queue Configuration file:
cd /etc/supervisor/conf.d
nano queue-worker-prod.conf
[program:queue-prod]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/html/project/artisan queue:work
autostart=true
autorestart=true
user=root
numprocs=1
redirect_stderr=true
stdout_logfile=/var/www/html/project/storage/logs/supervisord.log
Load the Queue Configuration
supervisorctl update
Check status of queues
supervisorctl status
Restart the Queue after Model / Job / Notification Updates
supervisorctl restart queue-prod:queue-prod_00
Find more help on http://supervisord.org
