feat(horizon): add fixed-size per-queue worker pools on Coolify Cloud

Cloud production now runs one supervisor per queue (deployments, crons,
high, default, maintenance), so a busy queue cannot starve the others.
Add maintenance_queue() for slow Docker cleanups and a shared
horizon.worker_timeout config value. Self-hosted keeps the s6 supervisor.
This commit is contained in:
Andras Bacsai
2026-10-03 21:24:54 +02:00
parent c6b8dfe367
commit e144b990c3
8 changed files with 425 additions and 43 deletions
+21 -4
View File
@@ -1028,8 +1028,8 @@ function isCloud(): bool
* is decided by `isCloud()` (config-based) rather than `HORIZON_QUEUES`, so the dispatching
* process needs no special env — only the worker must be configured to drain `deployments`.
*
* IMPORTANT: on cloud a worker MUST include `deployments` in its `HORIZON_QUEUES`, otherwise
* these jobs are never processed.
* On cloud, config/horizon.php provisions a dedicated `deployments` pool in production
* (see docs/cloud-horizon-workers.md).
*/
function deployment_queue(): string
{
@@ -1045,14 +1045,31 @@ function deployment_queue(): string
* by `isCloud()` (config-based), so the dispatching process needs no special env — only the
* worker must be configured to drain `crons`.
*
* IMPORTANT: on cloud a worker MUST include `crons` in its `HORIZON_QUEUES`, otherwise these
* jobs are never processed.
* On cloud, config/horizon.php provisions a dedicated `crons` pool in production
* (see docs/cloud-horizon-workers.md).
*/
function crons_queue(): string
{
return isCloud() ? 'crons' : 'high';
}
/**
* Resolve the queue used for slow server maintenance — scheduled, manual and stop-triggered
* Docker cleanups.
*
* On cloud these jobs run on a dedicated `maintenance` queue so a small, bounded Horizon pool
* drains them and slow remote prunes cannot occupy the `high` workers; self-hosted keeps them
* on the shared `high` queue, so a custom `HORIZON_QUEUES` does not need a new queue name. Routing is decided by `isCloud()` (config-based), so the dispatching
* process needs no special env — only the worker must be configured to drain `maintenance`.
*
* On cloud, config/horizon.php provisions a dedicated `maintenance` pool in production
* (see docs/cloud-horizon-workers.md).
*/
function maintenance_queue(): string
{
return isCloud() ? 'maintenance' : 'high';
}
function translate_cron_expression($expression_to_validate): string
{
if (isset(VALID_CRON_STRINGS[$expression_to_validate])) {