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.

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Este sitio usa Akismet para reducir el spam. Aprende cómo se procesan los datos de tus comentarios.