Repository navigation
fix(traefik): allow disabling backend connection reuse for Swarm services - #5702
Open
WilliamAGH wants to merge 7 commits into
Open
WilliamAGH wants to merge 7 commits into
WilliamAGH wants to merge 7 commits into
Conversation
…ices Traefik pools idle backend connections by dial address, so a connection opened to http://<appName>:<port> stays bound to the task it first reached after Swarm removes that task from the service VIP during a rolling update. Add an application setting, on by default, that when turned off renders an application-owned serversTransport with maxIdleConnsPerHost: -1 and points every generated service for the application at it. Changing the setting rewrites the existing primary and preview route files. Fixes Dokploy#5281 Agent-Session: 9844533d-f186-4fe0-9641-6a1c2b9baf44
The application page refetches every 5 seconds, so resetting the form on every new data object discarded edits made during a deployment. Reset only when a field the form shows changes. Agent-Session: 9844533d-f186-4fe0-9641-6a1c2b9baf44
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f5665e56d1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Turning off backend connection reuse no longer replaces a serversTransport the user set on a generated service; only services without one get the application-owned transport. Reconciling existing route files now reads and writes strictly, so an SSH failure rejects instead of returning an empty config. updateApplication rewrites the route files before saving the setting, so a failed rewrite leaves the stored value unchanged and saving again retries it. Agent-Session: fa314523-0de1-4a36-b77d-ebc454f606fb
A save that failed after rewriting some route files left them on the new policy while the stored value kept the old one. Saving the old value again skipped the rewrite because it matched the stored value. The rewrite is idempotent, so run it whenever the setting is sent. Agent-Session: fa314523-0de1-4a36-b77d-ebc454f606fb
Address Codex and OpenCode review findings before finalizing PR Dokploy#5702. Reject loaded FastProxy before publishing a negative idle-pool limit, including destination transfers. Stage local and remote route replacements before atomic publication, preserving live routes and failure causes. Keep rejected Cluster Settings values for retry. Apply domain and auth route checks before persisting their new state, without holding a database transaction connection during Docker/SSH work. Remove duplicate callers. Verified with 99 focused tests, both package typechecks, scoped Biome, real Traefik 3.6.25 standard/FastProxy probes, PostgreSQL 17 rejection and retry probes, and actual-component browser checks. Local deep adversarial review findings were repaired before this single final commit. Agent-Session: ses_ea8c77953ffe2kMVc88YLK31nt
… config helpers Replace custom route file writing and runtime proxy inspection with Dokploy's standard Traefik configuration utilities. Consolidate test suites to verify core serversTransport generation and preview deployment cascades. Agent-Session: 4e0ead16-f511-445f-9075-4b7c62c7b37a
Propagate route read and write failures before persisting application settings. Keep missing remote route files empty without hiding failed reads, and await redirect middleware publication inside its transaction. Cover the shared helpers with real filesystem and shell I/O regressions. Agent-Session: ses_ea5a5b8fdffebkE34w8Vem0N6A
WilliamAGH
added a commit
to WilliamAGH/website
that referenced
this pull request
Oct 20, 2026
Document the default, custom transport behavior, and save-time route updates introduced in Dokploy/dokploy#5702. Explain that a failed update can be retried by saving either value after resolving the error. Agent-Session: ses_eaa141796ffebTef9qdyk8BK92
Collaborator
|
@greptileai review |
This branch has not been deployed
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.
Dokploy routes application domains to their Swarm service VIP (
http://<appName>:<port>). A pooled backend connection can remain attached to a task during a rolling update, while a new connection goes through the VIP's current service membership. This adds Reuse backend connections under Advanced → Cluster Settings so application owners can disable idle backend connection reuse for generated routes. The setting defaults to enabled, preserving existing behavior.When reuse is disabled, Dokploy writes an application-owned
serversTransportnamed<appName>-swarm-vipwithmaxIdleConnsPerHost: -1. Generated load balancers without an existing transport reference it. Re-enabling reuse removes that owned transport and its references. Settings reconciliation preserves hand-set custom transport references and unrelated routers and services; those custom transports retain their own connection policy.Saving Cluster Settings reconciles the application's existing primary and preview route files before persisting the application setting, including when the requested value matches the stored value. An application without route entries does not get an empty route file. New or regenerated domain routes also apply the selected policy. Application and preview domain updates now publish their route changes through
updateDomainByIdbefore persisting domain fields, including enablement and forward-auth flags. Redirect creation awaits middleware publication inside its existing database transaction.Read, parse and write errors from the configuration helpers propagate to callers. If reconciliation fails before the application database update, its stored setting stays unchanged. Earlier route files may already have been changed, however: these writes use Dokploy's existing local file and remote SFTP helpers directly, with no staged replacement, per-file atomicity guarantee, or transaction spanning route files and the database. After the underlying error is resolved, saving either value again reconciles the readable route files to that policy. A failed Cluster Settings save retains the entered values and displays the server error; unchanged polling preserves edits, while changing resources resets the form.
The transport setting targets Traefik's standard proxy. The implementation does not inspect the running proxy configuration, call the support-dump API, reject FastProxy, or run a destination compatibility preflight for application transfers. Those are not guarantees of this PR.
The migration adds
application.swarmVipConnectionReuseasNOT NULL DEFAULT true. Its generated output also includes thewebServerSettings.whitelabelingConfigdefault already declared by the schema; that generated default change is retained.Regression coverage includes transport rendering/removal, custom transport and unrelated-route preservation, absent route files, actual filesystem write errors, remote read failures, primary/preview reconciliation before persistence, and retrying after preview or database failure. The remote read test runs the generated command against the local shell and filesystem in place of the SSH boundary; it does not establish live SSH or proxy-mode compatibility.
Closes #5281


Confidence Score: 5/5
The PR appears safe to merge; no new actionable issues were found.Summary
Adds an application setting to disable backend connection reuse for generated Swarm routes.
Reviews (2) · Last reviewed commit: "fix(traefik): report route configuration..." · Reviewed by Greptile