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
- Test with:
- 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:
- Check WhatsMark SaaS version in your admin dashboard
- Test Redis connection: Run
redis-cli pingin terminal - Confirm root access: Run
sudo whoami(should return "root") - Verify Laravel Horizon: Check if
php artisan horizoncommand 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:
sudo apt update
sudo apt install supervisor -yCheck that Supervisor is active:
sudo systemctl status supervisorYou should see:
Active: active (running)Step 2: Create Horizon Configuration β
Create a new Supervisor configuration file:
sudo nano /etc/supervisor/conf.d/horizon.confPaste this optimized configuration:
; 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:
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start laravel-horizonCheck status:
sudo supervisorctl statusYou should see:
laravel-horizon RUNNING pid 1234, uptime 0:02:10Step 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:
[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/nullQUEUE 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 β
| Command | Description |
|---|---|
sudo supervisorctl status | Show running programs |
sudo supervisorctl start laravel-horizon | Start Horizon |
sudo supervisorctl stop laravel-horizon | Stop Horizon |
sudo supervisorctl restart laravel-horizon | Restart Horizon |
sudo systemctl restart supervisor | Restart Supervisor service |
Step 6: Auto-Start on Reboot β
Enable Supervisor to start automatically:
sudo systemctl enable supervisorAfter 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.