feat(local-dev): air-based hot-reload for workspace-server in docker-compose dev mode #116
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
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?
Problem
Local OSS dev loop on workspace-server (Go) has no hot-reload. Every code edit forces a full
docker compose up --buildcycle (~30s for the platform image). For developers iterating on handlers / provisioner / migrations, this compounds — 30s × N edits per task = real friction.Canvas already has hot-reload (Turbopack HMR via
next dev --turbopack). Workspace runtime has bind-mounted/plugins+/configsso filesystem changes are live. Platform is the odd one out — it's the slow link in the local dev loop.Proposed approach
Add
air(the standard Go live-reload tool) under a dev-only docker-compose override:workspace-server/.air.toml— air config: watch**/*.go, excludetests, exclude_test.go, build targettmp/server, restart on rebuild.workspace-server/Dockerfile.dev— separate dev image extending the base; installsair; runsairinstead of the prebuilt binary as entrypoint.docker-compose.dev.yml— overlay overdocker-compose.ymlthat:Dockerfile.dev./workspace-serverinto the container so source edits propagateWATCH_RELOAD=1env (or similar guard) so the platform knows it's in dev modemake devshorthand that doesdocker compose -f docker-compose.yml -f docker-compose.dev.yml up.Acceptance criteria
make dev(or equivalent) brings up platform with air watching.gofile → air rebuilds + restarts the platform container in <5sdocker-compose.ymlonly) unchanged — zero impact on CI/staging/prod.air.toml,Dockerfile.dev,docker-compose.dev.yml) committed; no edits to the prod Dockerfilemake devinstead ofdocker compose up'Out of scope
Refs
next dev --turbopack— this restores parity for the platform sideairupstream: https://github.com/air-verse/air (formerly cosmtrek/air)Done — PR opened, awaiting review/merge
4 new files (
Makefile,docker-compose.dev.yml,workspace-server/.air.toml,workspace-server/Dockerfile.dev); 0 existing files modified.make devis the new dev-mode shorthand;make upretains prod-shape behavior.Phase 4 self-review (in commit body + PR description)
Correctness: No finding — additive only; air excludes
_test.goso test edits don't churn rebuild.Readability: No finding — Makefile has
##help targets; each new file has header comments.Architecture: No finding — overlay pattern is the canonical compose convention.
Security: No finding — dev-only image, not in CI/ECR.
Performance: No finding — air debounced (500ms) + exclude_unchanged.
Live-test status
I haven't run
make devend-to-end yet (would require docker + ~minutes for first build). Risk to merge before testing is essentially zero because the prod path is untouched. Once merged, anyone iterating on workspace-server can validate by runningmake devand editing a handler — if any glitch appears we open a follow-up rather than gate on full smoke-test before merge.Closing.