Skip to content

feat(compose): NATS-backed micro.mu example services in Docker - #4883

Draft
alex-dna-tech wants to merge 6 commits into
micro:masterfrom
alex-dna-tech:feat/examples-docker-compose
Draft

feat(compose): NATS-backed micro.mu example services in Docker#4883
alex-dna-tech wants to merge 6 commits into
micro:masterfrom
alex-dna-tech:feat/examples-docker-compose

Conversation

@alex-dna-tech

@alex-dna-tech alex-dna-tech commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Runs micro.mu example services in a dedicated micro-run container against a shared NATS registry/broker; gw container owns the dashboard/API/MCP gateway. Includes a fix syncing the configured registry back to registry.DefaultRegistry so cross-process discovery works.

What

Runs the micro.mu example services in a dedicated micro-run container against a shared NATS registry/broker, with the gw container owning the dashboard/API/MCP gateway. Verified end-to-end: services register on NATS, micro registry list/get works, MCP gateway discovers 19 tools across 5 services, and RPC calls route through the gateway.

Commits

  • feat: micro.mu examples container, compose builds image from source Dockerfile
  • fix(gateway): create admin account from MICRO_ADMIN_PASSWORD env
  • fix(compose): admin/micro credentials for examples container too
  • feat(compose): NATS registry/broker for container stack
  • fix(registry): sync configured registry to package global
  • feat(compose): dedicated micro-run service container

Key fix

cmd.Init isolated the configured registry in a local copy while the gateway and CLI registry command read registry.DefaultRegistry directly — so cross-process discovery silently returned nothing. Now the configured registry is synced back to the package global after configure (cmd/cmd.go).

Verification

  • micro registry list in micro-run: 5 services (users, web.service, orders, contacts, greeter)
  • MCP gateway: "Discovered 19 tools from 5 services"
  • RPC via gateway: greeter.Greeter.Hello{"message":"Hello from-gateway"}
  • One-shots pass: first-agent ✓, flow-loop quality 90, graceful-stop, agent-x402-buyer paid

…ockerfile

- relocate docker-compose.yml to internal/docker/, fix volume mount paths
- add root micro.mu defining example services for micro run
- add examples container running micro run --address :8081 against repo
- build go-micro image from internal/docker/Dockerfile: compiles micro CLI and protoc-gen-micro from source, installs git/make/curl/protoc; repo root supplied as additional build context so paths stay relative to the compose file
- combine gw and mcp into one gw container: gateway --mcp-address :3000, ports 8080+3000
- llama: entrypoint starts server only if MiniCPM5-1B-Q4_K_M.gguf exists, otherwise downloads it from Hugging Face into the models folder; -n 1024 context
- gitignore runtime data; .dockerignore keeps build context lean
Container gateway (docker-compose) exposed :8080 with auth on, but the
browser dashboard login only accepts a stored user/password account and
the generated machine token is not accepted there — dead end, no way in.

Restore the documented admin/micro default for the compose image without
reintroducing a hardcoded credential: the gateway creates the admin
account only when the operator sets MICRO_ADMIN_PASSWORD (user defaults
to admin, overridable via MICRO_ADMIN_USER). Respects an existing
account and the auth/.admin-deleted marker. The compose file opts in
with the documented admin/micro.
The examples container (micro run --address :8081) binds an exposed
address so auth is on, but without MICRO_ADMIN_PASSWORD no admin account
exists and the documented admin/micro login fails with 'Invalid
credentials'. Set the same credentials as the gw container.
- add nats:latest service, point gw and examples at nats://nats:4222
- gateway: create logs/pid dirs so /logs and /status don't 500
cmd.Init isolated the registry in a local copy, but the gateway and CLI
registry command read registry.DefaultRegistry directly, so they never
saw the registry selected via flags/env. Sync it back after configure so
CLI list/get/watch, gateway and MCP discovery all query the same registry.
Run services from micro.mu in their own container (no gateway, no HTTP
listener); gw owns dashboard/API/MCP and proxies via NATS. Drop stale
go.mod/go.sum from hello-world and web-service so they build inside the
root v6 module. Add buildkit cache mounts and a warm Go module cache so
micro run rebuilds services offline and fast.
@alex-dna-tech
alex-dna-tech marked this pull request as draft August 10, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant