Skip to content

feat(domains): add toggle to enable/disable domains#4697

Open
gentslava wants to merge 5 commits into
Dokploy:canaryfrom
gentslava:feat/domain-enable-disable
Open

feat(domains): add toggle to enable/disable domains#4697
gentslava wants to merge 5 commits into
Dokploy:canaryfrom
gentslava:feat/domain-enable-disable

Conversation

@gentslava

@gentslava gentslava commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

What is this PR about?

Adds an enabled flag to domains so a domain can be switched off without deleting it, preserving its configuration. A switch is added to the Domains tab (grid card host row + a Status column in the table view).

  • Schema: new enabled column (default true) + migration; included in apiUpdateDomain.
  • Applications: guard in manageDomain so a disabled domain never exposes a traefik router from any caller (create/update/forward-auth/toggle); applies instantly via the file provider.
  • Compose: addDomainToCompose skips disabled domains when generating docker labels, so the change applies on the next deployment.
  • API: new domain.toggleEnable procedure (permission-checked + audited); returns requiresRedeploy for compose.
  • UI: switch on the domain card and a Status column in the table; disabled cards are dimmed. Reuses the existing compose "redeploy required" hint, now shown consistently across add/edit/delete/toggle.

Checklist

Before submitting this PR, please make sure that:

  • You created a dedicated branch based on the canary branch.
  • You have read the suggestions in the CONTRIBUTING.md file https://github.com/Dokploy/dokploy/blob/canary/CONTRIBUTING.md#pull-request
  • You have tested this PR in your local instance. Verified for an application (the traefik router file appears/disappears on toggle) and a compose service (DB flag + label filtering + redeploy hint). Added unit tests for the compose label filtering; the full traefik + compose suite passes (195 tests).

Issues related (if applicable)

closes #4696

Screenshots (if applicable)

Снимок экрана — 2026-06-25 в 00 44 10

@gentslava gentslava requested a review from Siumauricio as a code owner June 24, 2026 18:04
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Jun 24, 2026
@cheetahbyte

Copy link
Copy Markdown
Contributor

Hi, like the change!
Quick UI thought: since the toggle already shows the state, the "Enabled"/"Disabled" text feels a bit redundant

gentslava and others added 4 commits July 13, 2026 18:10
Compose domains are rendered as docker labels and only take effect on the
next deployment. Extract the "redeploy required" notice into a reusable
component/strings and surface it consistently: as a banner in the domains
list, in the add/edit dialog (replacing the inline copy), and in the toast
shown after create/update/delete. Unify grid deletion onto the shared
handler so the hint applies in both grid and table views.

Groundwork for the upcoming domain enable/disable toggle.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add an `enabled` flag (default true) so a domain can be switched off
without deleting it, preserving its configuration.

- schema: new `enabled` column + migration; added to apiUpdateDomain
- traefik (applications): guard manageDomain so a disabled domain never
  exposes a router from any caller (create/update/forward-auth/toggle);
  applies instantly through the file provider
- compose: skip disabled domains when generating docker labels, so the
  change applies on the next deployment
- tRPC: new domain.toggleEnable procedure (permission-checked + audited),
  returns requiresRedeploy for compose domains
- UI: switch on the domain card (host row, variant E) and a Status column
  in the table view; disabled cards are dimmed; reuses the compose
  redeploy hint for the toast

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add unit tests for addDomainToCompose verifying that a disabled domain
produces no traefik labels, an enabled domain does, and only the enabled
one emits labels when both are attached to the same service. Mocks node:fs
so loadDockerCompose runs against an in-memory compose spec.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The new non-null `enabled` column makes it a required field on the Domain
type, so the existing traefik/compose test fixtures need it too. Adds
`enabled: true` to each base fixture (spread-based fixtures inherit it).
Fixes the apps/dokploy typecheck failure on CI.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gentslava gentslava force-pushed the feat/domain-enable-disable branch from a52adc6 to 0e3c228 Compare July 13, 2026 11:13
@gentslava

Copy link
Copy Markdown
Contributor Author

Thanks for the suggestion! Implemented — the redundant Enabled/Disabled text has been removed from the domain toggles.

@gentslava

Copy link
Copy Markdown
Contributor Author

@Siumauricio, could you please take a look and merge when possible? I rebased this PR onto the latest canary to avoid any new conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: toggle to enable/disable domains without deleting them

2 participants