Laravel Queue work with supervisor on AWS EC2

1. Install a supervisor

sudo yum --enablerepo=epel install supervisor

2. Start supervisor

sudo service supervisord start

3. Modify the supervisor config file

sudo vi /etc/supervisord.conf
[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
touch /project-home/storage/logs/worker.log

4. Read supervisor config file

sudo supervisorctl reread
worker: available

5. Restart supervisor

sudo service supervisord restart
sudo supervisorctl status
worker:worker_00 RUNNING pid 1043936, uptime 0:00:10
worker:worker_01 RUNNING pid 1043937, uptime 0:00:10

6. Add supervisor auto restart config

sudo chkconfig supervisord on

Korean, live in Japan. The programmer. I love to learn something new things. I’m publishing my toy projects using GitHub. Visit https://www.jangwook.net.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store