Logo

dev-resources.site

for different kinds of informations.

Install and Manage Supervisor for Laravel Queue

Published at
9/29/2023
Categories
php
laravel
queue
tutorial
Author
Rupadana
Categories
4 categories in total
php
open
laravel
open
queue
open
tutorial
open
Install and Manage Supervisor for Laravel Queue

Introduction

In this post im using ubuntu 22.04, read the installation step below

Installation

Begin by updating your package sources and installing Supervisor:

sudo apt update && sudo apt install supervisor

The supervisor service runs automatically after installation. You can check its status:

sudo systemctl status supervisor

You should receive the following output:

Output
● supervisor.service - Supervisor process control system for UNIX
     Loaded: loaded (/lib/systemd/system/supervisor.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2021-11-17 22:56:48 UTC; 5min ago

Add configuration

create app.rupadana.com.conf configuration to /etc/supervisor/conf.d, and paste it

[program:rupadana-app]
process_name=%(program_name)s_%(process_num)02d
command=php /home/rupadana-app/htdocs/app.rupadana.com/artisan queue:work --sleep=3 --tries=3
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=rupadana-app
numprocs=2
redirect_stderr=true
stdout_logfile = /home/app/htdocs/app.rupadana.com/worker.log
stopwaitsecs=3600

and enter this command to run configuration

sudo supervisorctl reread
sudo supervisorctl update

Featured ones: