feat: Add Dockerfile, preview config, and seed script for self-preview deployments

Containerize Codewalkers with a multi-stage Docker build (Node + Caddy) and
add a seed script that populates the database with a demo initiative, 3 phases,
9 tasks, 3 agents with JSONL log output, a root page, review comments, and a
git repo with real branch diffs for the review tab.
This commit is contained in:
Lukas May
2026-03-05 14:26:22 +01:00
parent 714262fb83
commit 66605da30d
8 changed files with 1220 additions and 0 deletions

View File

@@ -358,6 +358,47 @@ Polls `getPreviewStatus` with `refetchInterval: 3000` while active.
- `GracefulShutdown` calls `previewManager.stopAll()` during shutdown
- `requirePreviewManager(ctx)` helper in `apps/server/trpc/routers/_helpers.ts`
## Codewalkers Self-Preview
Codewalkers itself has a Dockerfile, `.cw-preview.yml`, and seed script for preview deployments. This lets you demo the full app — initiatives, phases, tasks, agents with output, pages, and review tab with real git diffs.
### Files
| File | Purpose |
|------|---------|
| `Dockerfile` | Multi-stage: deps → build (server+web) → production (Node + Caddy) |
| `.cw-preview.yml` | Preview config: build, healthcheck, seed |
| `scripts/Caddyfile` | Caddy config: SPA file server + tRPC reverse proxy |
| `scripts/entrypoint.sh` | Init workspace, start backend, run Caddy |
| `scripts/seed-preview.sh` | Create demo git repo + run Node.js seed |
| `apps/server/preview-seed.ts` | Populate DB with demo initiative, phases, tasks, agents, log chunks, pages, review comments |
### Container Architecture
Single container running two processes:
- **Node.js backend** on port 3847 (tRPC API + health endpoint)
- **Caddy** on port 3000 (SPA file server, reverse proxy `/trpc` and `/health` to backend)
### Seed Data
The seed creates a "Task Manager Redesign" initiative with:
- 3 phases (completed, pending_review, in_progress)
- 9 tasks across phases
- 3 agents with JSONL log output
- Root page with Tiptap content
- 3 review comments on the pending_review phase
- Git repo with 3 branches and real commit diffs for the review tab
### Manual Testing
```sh
docker build -t cw-preview .
docker run -p 3000:3000 cw-preview
# Wait for startup, then seed:
docker exec <container> sh /app/scripts/seed-preview.sh
# Browse http://localhost:3000
```
## Dependencies
- `js-yaml` + `@types/js-yaml` — for parsing `.cw-preview.yml`