feat(dev): mirrorstack dev — run a module locally with docker pg#19
Merged
Conversation
4 tasks
New top-level subcommand. Lifecycle: 1. Bootstrap docker-compose.yml in cwd if missing (vendored template) 2. docker compose up -d --wait — server-side healthcheck blocking 3. Spawn `go run .` with MS_LOCAL_DB_URL injected 4. Stream stdout/stderr through a labeled prefix 5. On Ctrl-C: child.kill(), then docker compose down Bundled Postgres binds host port 5433 (not 5432) so it can coexist with api-platform's own postgres on 5432 — devs can run platform + module side by side without port juggling. Flags: - --dir <path>: module dir (default cwd) - --no-compose: skip docker, use the user's own pg (requires MS_LOCAL_DB_URL) - --db-url <url>: override the default (highest precedence) No WSS tunnel yet — module runs as a plain HTTP server on its own port. A follow-up PR layers the tunnel registration on top so deployed-mode calls back to localhost can be exercised. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The module docs claimed "graceful SIGTERM" but the code calls child.kill() — SIGKILL on unix, TerminateProcess on windows. Tightened the wording so docs and code agree, and queued the SIGTERM-first escalation as a follow-up note inside the file. No behavior change.
e8e77f4 to
1b9777d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
New top-level subcommand. Brings up a vendored Postgres via docker-compose, spawns the user's `go run .`, line-prefixes its output, and tears down on Ctrl-C.
Flow
```
$ cd my-module
$ mirrorstack dev
✓ bootstrapped docker-compose.yml
[+] Running 2/2
✔ Network mymod_default Created
✔ Container mirrorstack-dev-pg Healthy
✓ module running — Ctrl-C to stop
module │ mirrorstack: my-module module (My Mod) listening on :8080
…
^C
[+] Running 2/2
✔ Container mirrorstack-dev-pg Removed
✔ Network mymod_default Removed
```
Flags
Port choice
Bundled Postgres binds host port 5433 (not 5432). Lets `mirrorstack dev` co-exist with api-platform's own `docker-compose.yml` (which uses 5432) when developing platform + module side by side. Comment in the template explains.
Not in scope
Test plan
/simplify pass
Three reviewers ran in parallel. Five fixes applied:
🤖 Generated with Claude Code