Supervisor config generator for Laravel

Keep queue workers, Horizon, Octane or Reverb running. The output follows the Supervisor examples in the Laravel 13 documentation, with the stop and kill settings that protect running jobs.

Process
Letters, numbers, dashes and underscores.
The user that owns the app. Not root.
Supervisor waits this long before killing a process it is stopping.
Queue workers
Empty uses QUEUE_CONNECTION.
Empty processes the connection's default queue.
Octane
Reverb
laravel-worker.conf

Load it

What each line is for

DirectiveWhy it is there
process_nameWith more than one process, the name must include %(process_num). Supervisor refuses the file otherwise.
stopwaitsecsHow long Supervisor waits after asking a process to stop. The default is 10 seconds, after which the process is killed mid-job. Set it above your longest job.
stopasgroup, killasgroupSend the stop and kill signals to the worker's child processes too, so none are left behind.
redirect_stderrSends errors to the same log file as normal output. With it on, a separate stderr_logfile is ignored.
autorestartStarts the process again when it exits, which is what makes queue:restart and --max-time work.

Three timeouts that have to agree

  • --timeout is how long one job may run before the worker kills it.
  • retry_after, in config/queue.php, is when the queue hands an unfinished job to another worker. Keep it several seconds longer than --timeout, or a slow job is processed twice.
  • stopwaitsecs is Supervisor's patience during a stop. Keep it longer than --timeout.

Deploying new code

Workers are long-lived and keep the old code in memory. After each deploy, tell them to finish their current job and exit. Supervisor starts fresh ones.

php artisan queue:restart        # queue workers
php artisan horizon:terminate    # Horizon
php artisan octane:reload        # Octane
php artisan reverb:restart       # Reverb

Horizon, Reverb and the scheduler

  • Horizon runs as one process. It starts and balances its own workers from config/horizon.php, so there is no numprocs.
  • Reverb holds one open file per connection. Raise the limit in the [supervisord] section of the main Supervisor config with minfds=10000.
  • The scheduler does not belong in Supervisor. Laravel's documented production setup is one cron entry. schedule:work is for local development.
* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

Where the file goes

On Ubuntu and Debian, program files live in /etc/supervisor/conf.d/ and end in .conf. Other distributions use a different directory or extension, such as /etc/supervisord.d/*.ini. Check the [include] section of your main Supervisor config.

Sources: Laravel 13 documentation for queues, Horizon, Octane, Reverb and scheduling, and the Supervisor configuration reference.

Building a SaaS on Laravel? Start with the foundation already built.

Stack Toast is a Laravel 13 starter kit with authentication, billing through four payment processors, teams and a complete admin panel. Choose Livewire, React, Vue or API.

  • From $199, one payment
  • Full GitHub source
  • Unlimited projects
  • 30-day money-back guarantee
The Stack Toast admin dashboard with revenue and subscription metrics