Installing and configuring a supervisor in Debian to execute a Laravel queue worker

I need to install and configure a supervisor in Debian to continuous execute a queue worker.

The system is a Debian 8.

$ sudo lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.11 (jessie)
Release: 8
Codename: jessie

I will use Supervisor, a process control system that allows to monitor and control a number of processes on UNIX-like operating systems.

If my process shuts down, the supervisor will start it.

First I install the supervisor

$ sudo apt-get install supervisor -y

Then I create the configuration file for this worker in the /etc/supervisor/conf.d folder: my-project-queue.conf

command=php /home/my-project/www/artisan queue:work

You can get more information about these parameters on the official webpage of the Supervisor project. Two important parameters:

  • “command=php /home/my-project/www/artisan queue:work” is the process that I want to supervise.
  • “stdout_logfile=/home/my-project/www/storage/logs/my-project-queue-worker.log” is the log file for this supervision.

Once I have finished the configuration I have to reload the configuration. I execute the command

$ sudo supervisorctl update

that reload the config and add/remove as necessary, and will restart affected programs.

You can get more information in the Laravel official documentation.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.