Skip to main content
How to Configure Laravel Supervisord on Cloudways

This guide will assist you in learning about Supervisord and how you could install it for your Laravel applications.

Emmad avatar
Written by Emmad
Updated over a week ago

Table of Contents

This guide will assist you in learning about Supervisord and how you could install it for your Laravel applications.

What is Supervisord?

Supervisord is a simple, fast worker manager, designed to monitor and control the processes which allow you to defer the processing of a time-consuming task to speed up the web requests to your application.

Important

Supervisord is the only available Laravel apps deployed with Laravel or Custom PHP Stacks.

How to Install and Configure Laravel Supervisord on Cloudways

Step 1: Installing Supervisord

Go to Server Management, then Settings & Packages, and then access the Packages section. Click on the Install button next to Supervisord to start the installation process.

Classic Interface

New Interface

Before the process starts, you will be asked to install Redis on the server (if it is not already installed), as it is required for Laravel queues. Wait for the installation process to finish.

Classic Interface

New Interface

Important

You can check the Supervisord service status from the Manage Services section, and also Restart the service if required.

Step 2: Supervisord Application Prerequisites

Important

This process describes the configuration when Redis is used as the default driver. You need to configure your application to use Redis.

After installation, you need to carry out application configuration changes so that Redis could be used as the queue driver. To do that, first, it is required to install “predis/predis” package for Laravel with Composer.

Connect to server via SSH, then go to your application directory webroot (/home/master/applications/<app folder>/public_html/) and run this command:

composer require predis/predis

Once it is installed, next you need to configure it in the application. For that, edit the /home/master/applications/public_html/.env file in your application as follows:

Change From: QUEUE_DRIVER=sync
Change to: QUEUE_DRIVER=redis

Next, edit the /home/master/applications/public_html/config/queue.php file as follows:

Change From: ‘default’ => env(‘QUEUE_DRIVER’, ‘sync’),
Change To: ‘default’ => env(‘QUEUE_DRIVER’, redis’),

After these changes are saved in the Laravel application, proceed to the next step.

Step 3: Add New Job

Under Application Management, go to Application Settings and select the tab for Supervisor Jobs. Click on Add New Job button to add a job for Supervisord.

Classic Interface

New Interface

The various Laravel queue-related options are briefly explained below:

Connection Driver: Redis is used as the queue driver where the jobs will be held as configured in Step 2.

Number of process: Number of processes control how many processes supervisord will run at the same time. The default value is 1.

Timeout: The timeout option specifies how long the Laravel queue master process will wait before killing off a child queue worker that is processing a job.

Sleep Time: The sleep time option determines how long the worker will “sleep” if there are no new jobs available. While sleeping, the worker will not process any new jobs – the jobs will be processed after the worker wakes up again.

Queue: The names of the queues to work.

Maximum Tries: Maximum number of tries after which the job is logged as a fail.

Environment (Optional): The environment the command should run under.

Artisan Path: Add a custom Artisan path or leave it unchanged for default.

Fill in the required details and click the Save button.

Classic Interface

New Interface

Step 4: Job Status and Other Options

The job status can be checked by clicking the Jobs Status button.

Classic Interface

New Interface

This will show the status of the job and other related information including uptime.

If you want to restart any job, click the icon in front of it. There is also the option of removing any job by clicking the remove icon.

Classic Interface

New Interface

You now know how to install and use Supervisord on Cloudways with your Laravel app.

Important

You can check the job logs in the following path: /home/master/applications/<app folder>/logs/<appname_jobID>.log

That’s it! We hope this article was helpful. If you need any help, then feel free to search your query on Cloudways Support Center or contact us via chat (Need a Hand > Send us a Message). Alternatively, you can also create a support ticket.


Experience the best in Laravel Hosting on Cloudways. Deploy your Laravel project now and enjoy superior speed and reliability! Deploy Now.

Did this answer your question?