feat(dx): add dokploy:teardown and env-driven dev origins#4292
Open
colocated wants to merge 2 commits intoDokploy:canaryfrom
Open
feat(dx): add dokploy:teardown and env-driven dev origins#4292colocated wants to merge 2 commits intoDokploy:canaryfrom
colocated wants to merge 2 commits intoDokploy:canaryfrom
Conversation
- Add `dokploy:teardown` that removes the Swarm services (`dokploy-postgres`, `dokploy-redis`), the `dokploy-traefik` container, and the `dokploy-network` overlay. Volumes are kept. - Replace hard-coded tunnel URLs in `auth.ts` and `next.config.mjs` with `DEV_ALLOWED_ORIGINS` — comma-separated, consumed by both better-auth trusted origins and Next's `allowedDevOrigins`. - Document both in CONTRIBUTING.md and `.env.example`.
Swarm service removal returns before underlying tasks have stopped and detached from the overlay network, so removing the network immediately often hit the 403 "in use" branch and left the network behind until the user ran teardown a second time. Retry briefly on 403 so a single pass cleans everything up. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Contributor
Author
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.
What is this PR about?
Two small developer-experience improvements for local contributors.
Key changes
pnpm dokploy:teardownscript — Counterpart todokploy:setup. Removes thedokploy-postgresanddokploy-redisSwarm services, thedokploy-traefikstandalone container, and thedokploy-networkoverlay. Volumes are intentionally left intact so your local database/Redis data survives between dev sessions; drop them manually if you want a fully clean slate. Idempotent — missing resources are skipped silently.DEV_ALLOWED_ORIGINSenv var — Replaces the hard-coded tunnel URLs that previously lived inpackages/server/src/lib/auth.ts(better-auth trusted origins) andapps/dokploy/next.config.mjs(Next'sallowedDevOrigins). Accepts a comma-separated list and is consumed by both call sites, so a single env entry now covers what used to require two file edits. When unset in production it's a no-op.CONTRIBUTING.mdgets a short "Teardown" section and a "Exposing your dev server via a tunnel" section covering the new env var.apps/dokploy/.env.exampledocuments the new variable.Checklist
Before submitting this PR, please make sure that:
canarybranch.pnpm dokploy:teardownend-to-end; verified all four resources removed; confirmedpnpm dokploy:setupre-bootstraps cleanly afterwards.)Issues related (if applicable)
N/A
Screenshots (if applicable)
Greptile Summary
This PR adds two developer-experience improvements: a
dokploy:teardownscript that removes dev infrastructure (Swarm services, the Traefik container, and the overlay network) with retry logic for async network detachment, and aDEV_ALLOWED_ORIGINSenv var that replaces hard-coded tunnel URLs in bothauth.ts(better-auth trusted origins) andnext.config.mjs(allowedDevOrigins). The prior concern about async network removal has been resolved via retry logic in the updatedremoveNetworkfunction.Confidence Score: 5/5
Safe to merge — changes are dev-tooling only and do not affect production behavior.
All changes are scoped to developer experience: the teardown script is a local-only utility, the DEV_ALLOWED_ORIGINS env var is only consumed under NODE_ENV=development in auth and is a dev-server-only option in Next.js, and the hardcoded personal ngrok URL is cleanly removed. The previously raised async network timing concern was addressed with retry logic. No P0 or P1 findings remain.
No files require special attention.
Reviews (2): Last reviewed commit: "fix(dx): retry teardown network removal ..." | Re-trigger Greptile