feat: allow DEPLOYMENT_QUEUE_CONCURRENCY env to tune deploy parallelism#4273
Open
freddysae0 wants to merge 1 commit intoDokploy:canaryfrom
Open
feat: allow DEPLOYMENT_QUEUE_CONCURRENCY env to tune deploy parallelism#4273freddysae0 wants to merge 1 commit intoDokploy:canaryfrom
freddysae0 wants to merge 1 commit intoDokploy:canaryfrom
Conversation
The BullMQ worker for the `deployments` queue was created without a `concurrency` option, which defaults to 1 in BullMQ. That forced every deploy across the entire instance to run strictly one at a time, even for unrelated apps on different remote servers. Introduce a `DEPLOYMENT_QUEUE_CONCURRENCY` env var. When unset or invalid it falls back to 1 so existing installs keep the original behavior. Closes Dokploy#4272
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DEPLOYMENT_QUEUE_CONCURRENCYenvironment variable that controls how many jobs the BullMQdeploymentsworker processes in parallel.1, which preserves current behavior (before this change the worker was created with noconcurrencyoption, silently inheriting BullMQ's default of 1).1.Closes #4272
Why
On any instance with more than a handful of apps the single-slot queue is a real bottleneck: two webhook-triggered builds arriving at the same time serialize, even when they target unrelated applications on different remote servers. There's no way to raise this today without patching compiled JS inside the running container, which gets wiped on every image update.
This change is additive and opt-in — the default is unchanged.
Diff
One file, 8 net lines:
Test plan
biome check apps/dokploy/server/queues/deployments-queue.ts— no fixes neededdeploymentConcurrency === 1(preserves current BullMQ default behavior)DEPLOYMENT_QUEUE_CONCURRENCY=5→5DEPLOYMENT_QUEUE_CONCURRENCY=-3/0/abc/ empty → falls back to1DEPLOYMENT_QUEUE_CONCURRENCY=3.7→3(viaMath.floor)Happy to adjust the env var name, add it to
.env.production.example, or wire it through a Settings UI field in a follow-up if preferred — kept scope intentionally minimal per CONTRIBUTING guidance.Greptile Summary
This PR adds a
DEPLOYMENT_QUEUE_CONCURRENCYenvironment variable that lets operators increase BullMQ worker concurrency beyond the current hard-coded default of 1. The parsing logic correctly handles all invalid inputs (empty, non-numeric, zero, negative, non-finite) by falling back to 1, preserving existing behavior when the variable is unset.Confidence Score: 5/5
Safe to merge — additive, opt-in, and default behavior is unchanged.
Single-file change with correct input validation, no breaking changes, and well-tested edge cases in the PR description. No P0 or P1 issues found.
No files require special attention.
Reviews (1): Last reviewed commit: "feat: allow DEPLOYMENT_QUEUE_CONCURRENCY..." | Re-trigger Greptile