Skip to content

Install Supervisor on Centos 7 for Laravel

Supervisor is a client/server system that allows its users to monitor and control several processes on UNIX-like operating systems. It is used to control processes related to a project or a customer and is meant to start like any other program at boot time. Features of Supervisor includes simple, centralized, efficient, extensible, compatible and proven.

The main components of the Supervisor are:

  • supervisord: This is the server piece of the supervisor is named supervisord. It is responsible for starting child programs at its invocation, responding to commands from clients, restarting crashed or exited subprocesses, logging its subprocess stdout and stderr output, and generating and handling “events” corresponding to points in subprocess lifetimes.
  • supervisorctl: The command-line client piece of the supervisor is named supervisorctl. It provides a shell-like interface to the features offered by supervisord.

In this guide, we will install the latest version of supervisor on CentOS 7

Deploying your cloud server
If you have not already registered with Cloudwafer, you should begin by getting signed up. Take a moment to create an account after which you can quickly deploy your cloud servers.

Once you have signed up, log into your Cloudwafer Client Area with the password provided in your mail and deploy your Cloudwafer cloud server.

Updating System Packages
It is recommended that you update the system to the latest packages before beginning any significant installations. Issue the command below:

sudo yum update -y

Step 1: Install EPEL Repository
We are going to install the EPEL Repository as Supervisor is not available in the default CentOS 7 Repository. Issue the command below to install:

sudo yum install epel-release

Step 2: Update and Install Supervisor
After adding the EPEL Repository, we need to update our system packages before proceeding to install the Supervisor package using the command below :

sudo yum update
sudo yum -y install supervisor

Then start and enable the supervisord daemon to start on boot using the commands below:

sudo systemctl start supervisord
sudo systemctl enable supervisord

Issue the command below to check the status of the service with the command below:

sudo systemctl status supervisord

/etc/supervisor/conf.d

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

Leave a Reply

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