Skip to content

Supervisor Setup Guide for Laravel Horizon ​

Laravel Horizon manages your background jobs (queues). To keep Horizon running continuously β€” even after a reboot β€” we'll use Supervisor, a lightweight Linux process manager.

Prerequisites ​

Before proceeding with this setup, ensure you meet the following requirements:

HOSTING REQUIREMENTS

** This feature is NOT available on shared hosting** You must have a Cloud Server or VPS with root access to configure Supervisor.

System Requirements ​

  • Server Type: Cloud Server, VPS, or Dedicated Server
  • Access Level: Root/Administrator access required
  • SSH Access: Command line access to your server

Software Requirements ​

  • Redis: Must be installed and working properly
    • Test with: redis-cli ping (should return "PONG")
    • If Redis is not installed: Follow the Redis installation guide for Linux
    • CloudPanel.io users: Redis is already pre-installed if you're using CloudPanel.io
  • WhatsMark SaaS: Version 1.4.2 or greater
  • Laravel Horizon: Already configured and installed in WhatsMark SaaS version 1.5.0+

Verification Steps ​

Before starting, verify your setup:

  1. Check WhatsMark SaaS version in your admin dashboard
  2. Test Redis connection: Run redis-cli ping in terminal
  3. Confirm root access: Run sudo whoami (should return "root")
  4. Verify Laravel Horizon: Check if php artisan horizon command exists

COMPATIBILITY NOTE

If you're using an older version of WhatsMark SaaS, please upgrade to version 1.4.2+ before proceeding with this configuration.


Important Disclaimer ​

TECHNICAL EXPERTISE REQUIRED

** This setup requires technical knowledge of server configuration and Linux commands.** If you are not confident with terminal commands, SSH access, or process management β€” please do not attempt this yourself.

You can hire a qualified server administrator or contact our support team for professional setup assistance. Our experts can handle the entire configuration for you safely and efficiently.

PERFORMANCE RECOMMENDATION

We highly recommend enabling this advanced configuration if you want your campaigns to run faster and improve the overall performance and reliability of your Laravel application.


Step 1: Install Supervisor ​

Run the following commands on your Ubuntu/Debian server:

bash
sudo apt update
sudo apt install supervisor -y

Check that Supervisor is active:

bash
sudo systemctl status supervisor

You should see:

text
Active: active (running)

Step 2: Create Horizon Configuration ​

Create a new Supervisor configuration file:

bash
sudo nano /etc/supervisor/conf.d/horizon.conf

Paste this optimized configuration:

ini
; WhatsApp SaaS - Laravel Horizon Supervisor Configuration
; Copy this file to /etc/supervisor/conf.d/whatsmarksaas-horizon.conf
; Replace {{PROJECT_PATH}} with your actual project path
; Replace {{WEB_USER}} with your web server user (www-data, nginx, apache, etc.)

[program:whatsmarksaas-horizon]
process_name=%(program_name)s_%(process_num)02d
command=php /home/corbitaltech-passthecode/htdocs/whatsmarksaas.dev/artisan horizon
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=corbitaltech-whatsmarksaas
numprocs=1
redirect_stderr=true
stdout_logfile=/dev/null
stderr_logfile=/dev/null
stopwaitsecs=3600
environment=LARAVEL_ENV="production"

; Example with actual paths:
; Replace {{PROJECT_PATH}} with: /var/www/html/whatsmarksaas-saas
; Replace {{WEB_USER}} with: www-data

; After creating this file:
; sudo supervisorctl reread
; sudo supervisorctl update
; sudo supervisorctl start whatsmarksaas-horizon:*

Save and exit:Ctrl + O β†’ Enter β†’ Ctrl + X


Step 3: Reload and Start Supervisor ​

Reload configuration and start Horizon:

bash
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start laravel-horizon

Check status:

bash
sudo supervisorctl status

You should see:

text
laravel-horizon        RUNNING   pid 1234, uptime 0:02:10

Step 4: (Optional) Specific Queue Configuration ​

If you want Horizon to handle a specific queue (for example: a high priority queue), you can modify your configuration:

ini
[program:laravel-horizon-high]
command=php /path-to-your-project/artisan horizon --queue=high
autostart=true
autorestart=true
user=www-data
redirect_stderr=true
stdout_logfile=/dev/null

QUEUE CONFIGURATION

This example shows how to configure Horizon to process jobs from a specific queue named "high". You can replace "high" with any queue name that matches your application's needs.


Step 5: Useful Commands ​

CommandDescription
sudo supervisorctl statusShow running programs
sudo supervisorctl start laravel-horizonStart Horizon
sudo supervisorctl stop laravel-horizonStop Horizon
sudo supervisorctl restart laravel-horizonRestart Horizon
sudo systemctl restart supervisorRestart Supervisor service

Step 6: Auto-Start on Reboot ​

Enable Supervisor to start automatically:

bash
sudo systemctl enable supervisor

After this, Horizon will automatically run whenever the server restarts.


Summary ​

  • Supervisor keeps Laravel Horizon running 24/7
  • Campaigns process faster and queues become more reliable
  • Logs are disabled for cleaner operation
  • Recommended for production servers to improve performance

Final Recommendation ​

This is an advanced configuration designed for better performance and scalability. Incorrect setup can break background jobs or cause server instability.

NEED HELP WITH SETUP?

If you're unsure about any step:

Contact our support team for paid setup assistance.

Or hire a technical expert to configure Supervisor for you.

PROFESSIONAL OPTIMIZATION

Our team can handle complete server optimization β€” ensuring faster campaign execution, stable queues, and maximum Laravel performance.

Β© 2024 - Corbital Technologies. All rights reserved.