Setup Supervisord for Laravel Project
Photo by Mohammad Rahmani
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.conf23[program:laravel-worker]4process_name=%(program_name)s_%(process_num)02d5command=php8.1 /home/forge/your-project/artisan queue:listen database --sleep=3 --tries=36autostart=true7autorestart=true8stopasgroup=true9killasgroup=true10user=forge11numprocs=112stdout_logfile=/home/forge/.forge/laravel-worker.log
Let supervisord know about new config.
1$ sudo supervisorctl reread2laravel-worker: available
Let supervisord start worker
1$ sudo supervisorctl update2laravel-worker: added process group
Verify if supervisor started worker .
1sudo supervisorctl2laravel-worker:laravel-worker_003supervisor>