Laravel Queue work with supervisor on AWS EC2

Jangwook Kim
1 min readJun 10, 2021

1. Install a supervisor

In Amazon repository, there is no supervisor. So we should use epelrepository 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

--

--

Jangwook Kim
Jangwook Kim

Written by Jangwook Kim

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.

No responses yet