Skip to content

feat(dx): add dokploy:teardown and env-driven dev origins#4292

Open
colocated wants to merge 2 commits intoDokploy:canaryfrom
colocated:feat/dx-improvements
Open

feat(dx): add dokploy:teardown and env-driven dev origins#4292
colocated wants to merge 2 commits intoDokploy:canaryfrom
colocated:feat/dx-improvements

Conversation

@colocated
Copy link
Copy Markdown
Contributor

@colocated colocated commented Apr 23, 2026

What is this PR about?

Two small developer-experience improvements for local contributors.

Key changes

  • New pnpm dokploy:teardown script — Counterpart to dokploy:setup. Removes the dokploy-postgres and dokploy-redis Swarm services, the dokploy-traefik standalone container, and the dokploy-network overlay. 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_ORIGINS env var — Replaces the hard-coded tunnel URLs that previously lived in packages/server/src/lib/auth.ts (better-auth trusted origins) and apps/dokploy/next.config.mjs (Next's allowedDevOrigins). 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.
  • DocsCONTRIBUTING.md gets a short "Teardown" section and a "Exposing your dev server via a tunnel" section covering the new env var. apps/dokploy/.env.example documents the new variable.

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. (Ran pnpm dokploy:teardown end-to-end; verified all four resources removed; confirmed pnpm dokploy:setup re-bootstraps cleanly afterwards.)

Issues related (if applicable)

N/A

Screenshots (if applicable)

Greptile Summary

This PR adds two developer-experience improvements: a dokploy:teardown script that removes dev infrastructure (Swarm services, the Traefik container, and the overlay network) with retry logic for async network detachment, and a DEV_ALLOWED_ORIGINS env var that replaces hard-coded tunnel URLs in both auth.ts (better-auth trusted origins) and next.config.mjs (allowedDevOrigins). The prior concern about async network removal has been resolved via retry logic in the updated removeNetwork function.

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

- 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`.
@colocated colocated requested a review from Siumauricio as a code owner April 23, 2026 10:30
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. documentation Improvements or additions to documentation enhancement New feature or request labels Apr 23, 2026
Comment thread apps/dokploy/teardown.ts
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>
@colocated
Copy link
Copy Markdown
Contributor Author

@greptileai

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

Labels

documentation Improvements or additions to documentation 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.

1 participant