Supervisor is a client/server system that allows its users to monitor and control a number of processes on UNIX-like operating systems. It is used to control processes related to a project.
In this article, we would explain you how to configure supervisor daemon to run laravel queue. So let start with the installation process:-
Step 1:- Install the easy_install dependencies on your system.
easy_install supervisor
Step 2:- Enter the following command to install the supervisor on your system.
yum install supervisor
Now you have successfully installed supervisor on your centos 7 System.
Step 3:- Edit the supervisor configuration file which is located in the following directory.
vi /etc/supervisord.conf
[program:laravel-worker]
command=php /path/to/app.com/artisan queue:work
process_name=%(program_name)s_%(process_num)02d
numprocs=8
priority=999
autostart=true
autorestart=true
startsecs=1
startretries=3
user=apache
redirect_stderr=true
stdout_logfile=/path/to/log/worker.log
Where, command = path of the project queue work. stdout_logfile = path of the log directory where supervisor log files is created.
Step 4: To autorun on system bootup, enter the command as follows:-
systemctl enable supervisord
To restart the supervisord service run the following command:-
systemctl restart supervisord
Congrats, now you have successfully configured the supervisor daemon with laravel queue.
2 thoughts on “How to install and configure supervisor on Centos 7 to run Laravel Queue”