Skip to main content

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:

QueuePurpose
publish-postPost publishing, isolated for reliability
mixpost-analyticsProvider data imports and backfills (highest volume)
mixpost-mediaRemote media downloads and thumbnail generation
defaultWebhooks, 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

TierRAMSupervisorsBest for
starter< 3 GB1 (all queues combined)Small or testing setups
basic< 6 GB2 (publishing + shared)Low-traffic instances
growth< 10 GB3 (publishing, analytics, default+media)Medium-traffic instances
scale10+ GB4 (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:

  1. Docker cgroup (containers)
  2. /proc/meminfo (Linux)
  3. sysctl (macOS)

If detection fails, it falls back to basic.

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
warning

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.

VariableDefaultDescription
MIXPOST_HORIZON_TIERauto-detectedForce a specific tier
MIXPOST_HORIZON_CONNECTIONmixpost-redisQueue connection for Horizon supervisors (must match config/queue.php)
MIXPOST_QUEUE_DEFAULTmixpost-defaultGeneric jobs queue
MIXPOST_QUEUE_PUBLISH_POSTpublish-postPost publishing queue
MIXPOST_QUEUE_ANALYTICSmixpost-analyticsAnalytics import queue
MIXPOST_QUEUE_MEDIAmixpost-mediaMedia processing queue

See the environment variables reference for the full list of Mixpost environment variables.