feat(local-dev): containerize platform + canvas stack via docker-compose #131
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "feat/126-containerize-local-platform-stack"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Replaces the legacy nohup
go run ./cmd/serversetup with a fully containerized local stack: postgres + redis + platform + canvas, all withrestart: unless-stoppedso they survive Mac sleep/wake and Docker Desktop daemon restarts.Closes #126.
Changes
docker-compose.yml—restart: unless-stoppedon platform/postgres/redis;BIND_ADDR=0.0.0.0for platform (the dev-mode-fail-open default of 127.0.0.1 from PR #7 made the host unable to reach the container even with port mapping; container netns is already isolated, so binding all interfaces inside is safe); healthchecks switched fromwget --spider(HEAD → 404 forever because/healthis GET-only) towget -qO /dev/null(GET) on platform + canvas.workspace-server/Dockerfile.dev—CGO_ENABLED=1→0to match prod Dockerfile + Dockerfile.tenant. Without this the alpine dev image fails withgcc: not found. Closes a divergence introduced in9d50a6da(today's air hot-reload PR).canvas/Dockerfile—npm install→npm ci --include=optionalfor lockfile-exact installs that include platform-specific@tailwindcss/oxidenative binaries.canvas/.dockerignore(new) — excludesnode_modulesand.nextsoCOPY . .doesn't clobber the freshly-installed containernode_moduleswith the host's stale/wrong-arch copy. This was the root cause of the canvas build failure on@import "tailwindcss".workspace-server/.gitignore— adds/tmp/for air's live-reload build cache.Stage A — verified
Stage B — N/A
Local-dev infrastructure only. None of these files ship to SaaS tenants — production EC2s use
Dockerfile.tenant+ec2.gouser-data, not docker-compose.Out of scope (filed as follow-ups)
wget --spiderhealthcheck has presumably also been silently 404-ing on prod tenants. Worth a follow-up to audit + fix the prod path.~/.molecule-ai/heartbeat-all.shthat pinged 5 persona workspaces from the host has been deleted. Per Hongming, each workspace is responsible for its own heartbeat.Test plan
make dev→ all 4 containers reach healthy statecurl localhost:8080/health→ 200curl localhost:3000/→ 200Replaces the legacy nohup `go run ./cmd/server` setup with a fully containerized local stack: postgres + redis + platform + canvas, all with `restart: unless-stopped` so they survive Mac sleep/wake and Docker Desktop daemon restarts. ## Changes - **docker-compose.yml** - `restart: unless-stopped` on platform/postgres/redis - `BIND_ADDR=0.0.0.0` for platform — the dev-mode-fail-open default of 127.0.0.1 (PR #7) made the host unable to reach the container even with port mapping. Container netns is already isolated, so binding all interfaces inside is safe. - Healthchecks switched from `wget --spider` (HEAD → 404 forever because /health is GET-only) to `wget -qO /dev/null` (GET). Same regression existed on canvas; fixed both. - **workspace-server/Dockerfile.dev** - `CGO_ENABLED=1` → `0` to match prod Dockerfile + Dockerfile.tenant. Without this, the alpine dev image fails with "gcc: not found" because workspace-server has no actual cgo deps but the env was forcing the cgo build path. Closes a divergence introduced in9d50a6da(today's air hot-reload PR). - **canvas/Dockerfile** - `npm install` → `npm ci --include=optional` for lockfile-exact installs that include platform-specific @tailwindcss/oxide native binaries. Without these, `next build` fails with "Cannot read properties of undefined (reading 'All')" on the `@import "tailwindcss"` directive. - **canvas/.dockerignore** (new) - Excludes `node_modules` and `.next` so the Dockerfile's `COPY . .` step doesn't clobber the freshly-installed container node_modules with the host's (potentially stale or wrong-arch) copy. This was the actual root cause of the canvas build break. - **workspace-server/.gitignore** - Adds `/tmp/` for air's live-reload build cache. ## Stage A verified ``` container status restart postgres-1 Up (healthy) unless-stopped redis-1 Up (healthy) unless-stopped platform-1 Up (healthy, air-mode) unless-stopped canvas-1 Up (healthy) unless-stopped GET :8080/health → 200 GET :3000/ → 200 DB preserved: 407 workspace rows + 5 named personas Persona mount: 28 dirs at /etc/molecule-bootstrap/personas ``` ## Stage B — N/A This is local-dev infrastructure only. None of these files ship to SaaS tenants — production EC2s use `Dockerfile.tenant` + `ec2.go` user-data, not docker-compose. ## Out of scope - The decorative-but-broken `wget --spider` healthcheck has presumably also been silently 404'ing on prod tenants. Ship a follow-up to audit + fix the prod path; not done here to keep the PR scoped. - Docker Desktop "Start at login" is a per-machine GUI setting that must be toggled manually (Settings → General). - The legacy heartbeat-all.sh that pinged 5 persona workspaces from the host has been deleted (~/.molecule-ai/heartbeat-all.sh). Per Hongming: each workspace is responsible for its own heartbeat. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>