This site runs best with JavaScript enabled.

Setup Supervisord for Laravel Project


Setup Supervisord for Laravel Project

Laravel worker should always run on the production environment to serve the jobs that application send to. To keep the process running, we use the Supervisord to help

Add Laravel Worker configuration on Supervisord

1$ sudo vim /etc/supervisor/conf.d/laravel-worker.conf
2
3[program:laravel-worker]
4process_name=%(program_name)s_%(process_num)02d
5command=php8.1 /home/forge/your-project/artisan queue:listen database --sleep=3 --tries=3
6autostart=true
7autorestart=true
8stopasgroup=true
9killasgroup=true
10user=forge
11numprocs=1
12stdout_logfile=/home/forge/.forge/laravel-worker.log

Let supervisord know about new config.

1$ sudo supervisorctl reread
2laravel-worker: available

Let supervisord start worker

1$ sudo supervisorctl update
2laravel-worker: added process group

Verify if supervisor started worker .

1sudo supervisorctl
2laravel-worker:laravel-worker_00
3supervisor>

Discuss on TwitterEdit post on GitHub

Share article
Kent C. Dodds

Kent C. Dodds is a JavaScript software engineer and teacher. He's taught hundreds of thousands of people how to make the world a better place with quality software development tools and practices. He lives with his wife and four kids in Utah.