Horizon Configuration
Mixpost uses Laravel Horizon to manage queue workers. Starting with v5, Mixpost provides a built-in helper that generates Horizon supervisor configurations based on your server's resources.
This guide explains how Horizon tiers work and how to configure them for your environment.
How it works
Mixpost dispatches jobs onto four dedicated queues:
| Queue | Purpose |
|---|---|
publish-post | Post publishing, isolated for reliability |
mixpost-analytics | Provider data imports and backfills (highest volume) |
mixpost-media | Remote media downloads and thumbnail generation |
default | Webhooks, notifications, deletions, token refresh |
The Inovector\Mixpost\Horizon helper class generates Horizon supervisors that listen on these queues, sized appropriately for your server. You select a tier that matches your VPS resources, and Mixpost handles the rest.
Available tiers
| Tier | RAM | Supervisors | Best for |
|---|---|---|---|
starter | < 3 GB | 1 (all queues combined) | Small or testing setups |
basic | < 6 GB | 2 (publishing + shared) | Low-traffic instances |
growth | < 10 GB | 3 (publishing, analytics, default+media) | Medium-traffic instances |
scale | 10+ GB | 4 (one per queue) | High-traffic instances |
Starter
A single supervisor handles all queues. Suitable for development or small instances with minimal activity.
- Supervisor:
mixpost-all - Queues:
publish-post,mixpost-analytics,mixpost-media,default - Processes: 1-2
- Memory: 192 MB per process
Basic
Separates publishing from everything else. This ensures post publishing is not blocked by analytics or media jobs.
- Supervisor
mixpost-publishing:publish-post(1-3 processes, 256 MB) - Supervisor
mixpost-shared:mixpost-analytics,mixpost-media,default(2-5 processes, 320 MB)
Growth
Adds a dedicated analytics supervisor. Recommended for most production deployments.
- Supervisor
mixpost-publishing:publish-post(2-6 processes, 256 MB) - Supervisor
mixpost-analytics:mixpost-analytics(2-8 processes, 256 MB) - Supervisor
mixpost-default:default,mixpost-media(2-4 processes, 384 MB)
Scale
Each queue gets its own supervisor with higher process limits. The media supervisor has extra memory for ffmpeg processing.
- Supervisor
mixpost-publishing:publish-post(2-10 processes, 256 MB) - Supervisor
mixpost-analytics:mixpost-analytics(2-12 processes, 256 MB) - Supervisor
mixpost-media:mixpost-media(1-3 processes, 512 MB) - Supervisor
mixpost-default:default(2-6 processes, 256 MB)
Setting the tier
Auto-detection (default)
By default, Mixpost detects your server's available RAM and selects the appropriate tier automatically. It reads memory from:
- Docker cgroup (containers)
/proc/meminfo(Linux)sysctl(macOS)
If detection fails, it falls back to basic.
Environment variable (recommended)
Pin the tier explicitly in your .env file to avoid unexpected changes, especially when your CI/deploy machine has different RAM than production:
MIXPOST_HORIZON_TIER=growth
If you run php artisan config:cache during deployment, the auto-detected tier is frozen at cache time. If the build machine has different RAM than the production server, you will get the wrong tier. Always set MIXPOST_HORIZON_TIER explicitly in production.
In code
You can also pass the tier directly when calling the helper:
'defaults' => Horizon::supervisors('growth'),
Applying the configuration
In your config/horizon.php, use the Horizon::supervisors() helper:
use Inovector\Mixpost\Horizon;
return [
// ... standard Horizon settings (domain, path, waits, trim, metrics, memory_limit, etc.) ...
'defaults' => Horizon::supervisors(),
'environments' => [
'production' => Horizon::supervisors(),
'local' => Horizon::supervisors(),
],
];
Custom overrides
You can override specific supervisor settings while keeping the tier defaults:
'defaults' => Horizon::supervisors('growth', [
'mixpost-publishing' => ['maxProcesses' => 15],
]),
Verifying the configuration
Run the following command to see which tier is active and how supervisors are configured:
php artisan mixpost:horizon-tier
You can also preview a different tier without changing your configuration:
php artisan mixpost:horizon-tier starter
Queue environment variables
You can rename the queues if needed. After any change, run php artisan config:cache && php artisan horizon:terminate.
| Variable | Default | Description |
|---|---|---|
MIXPOST_HORIZON_TIER | auto-detected | Force a specific tier |
MIXPOST_HORIZON_CONNECTION | mixpost-redis | Queue connection for Horizon supervisors (must match config/queue.php) |
MIXPOST_QUEUE_DEFAULT | mixpost-default | Generic jobs queue |
MIXPOST_QUEUE_PUBLISH_POST | publish-post | Post publishing queue |
MIXPOST_QUEUE_ANALYTICS | mixpost-analytics | Analytics import queue |
MIXPOST_QUEUE_MEDIA | mixpost-media | Media processing queue |
See the environment variables reference for the full list of Mixpost environment variables.