feat: Replace per-preview Caddy sidecars with shared gateway architecture

Refactor preview deployments to use a single shared Caddy gateway container
with subdomain routing (<previewId>.localhost:<port>) instead of one Caddy
sidecar and one port per preview. Adds dev/preview modes, git worktree
support for branch checkouts, and auto-start on phase:pending_review.

- Add GatewayManager for shared Caddy lifecycle + Caddyfile generation
- Add git worktree helpers for preview mode branch checkouts
- Add dev mode: volume-mount + dev server image instead of build
- Remove per-preview Caddy sidecar and port publishing
- Use shared cw-preview-net Docker network with container name DNS
- Auto-start previews when phase enters pending_review
- Delete unused PreviewPanel.tsx
- Update all tests (40 pass), docs, events, CLI, tRPC, frontend
This commit is contained in:
Lukas May
2026-03-05 12:22:29 +01:00
parent 0ff65b0b02
commit 143aad58e8
21 changed files with 1198 additions and 721 deletions

View File

@@ -14,6 +14,8 @@ export function previewProcedures(publicProcedure: ProcedureBuilder) {
phaseId: z.string().min(1).optional(),
projectId: z.string().min(1),
branch: z.string().min(1),
mode: z.enum(['preview', 'dev']).default('preview'),
worktreePath: z.string().optional(),
}))
.mutation(async ({ ctx, input }) => {
const previewManager = requirePreviewManager(ctx);