Laravel Queue work with supervisor on AWS EC2
1 min readJun 10, 2021
1. Install a supervisor
In Amazon repository, there is no supervisor. So we should use epel
repository to install that.
sudo yum --enablerepo=epel install supervisor
2. Start supervisor
sudo service supervisord start
If you get this sentence Redirecting to /bin/systemctl start supervisord.service
, install was succeed.
3. Modify the supervisor config file
To add worker to supervisor, we should modify the supervisor config file.
sudo vi /etc/supervisord.conf
And add these contents.
[program:worker]
command=php /project-home/artisan queue:work
process_name=%(program_name)s_%(process_num)02d
numprocs=2
autostart=true
autorestart=true
user=root
redirect_stderr=true
stdout_logfile=/project-home/storage/logs/worker.log
Please do not forget to add worker.log
file into your log path.
touch /project-home/storage/logs/worker.log
4. Read supervisor config file
To read your new config file to supervisor, execute this command.
sudo supervisorctl reread