Skip to content

Instantly share code, notes, and snippets.

@shankar-bavan
Last active February 4, 2024 15:20
Show Gist options
  • Save shankar-bavan/e46349cc743adae3f619019aa30640f1 to your computer and use it in GitHub Desktop.
Save shankar-bavan/e46349cc743adae3f619019aa30640f1 to your computer and use it in GitHub Desktop.
Laravel Queue worker with Supervisor

1. Installing Supervisor on Linux

To install supervisor, use the following command.

sudo apt-get install supervisor

2. Supervisor configuration for Laravel

After installation, create supervisor configuration file with instructions to run the processes. To create a configuration file, execute the following command. sudo nano /etc/supervisor/conf.d/project-name-queue-worker.conf

[program:project-name-queue-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /path/to/project/artisan queue:work
autostart=true
autorestart=true
user=root
numprocs=3
redirect_stderr=true
stdout_logfile=/path/to/project/storage/logs/queue-worker.log

3. Starting Supervisor

Now to start the queue worker.

systemctl enable supervisord
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start laravel-queue-worker:*

for any issues run

sudo supervisord
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment