docker cluster bootstrap contract#21
Merged
snowdamiz merged 4 commits intohyperpush-org:mainfrom Apr 10, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Implements a Docker-friendly cluster bootstrap contract so operators can run clustered Mesh apps in generic container environments without manually constructing MESH_NODE_NAME.
Changes:
- Runtime: adds
MESH_NODE_HOSTand hostname-based node identity fallback when neitherMESH_NODE_NAMEnor Fly identity env is set. - Tooling/examples: adds a two-node
docker-compose.ymlfortodo-postgresand updates scaffolding to generate it. - Docs: documents the full bootstrap environment contract and identity resolution order for Docker Compose usage.
Reviewed changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| examples/todo-postgres/README.md | Adds Docker Compose clustered run instructions and documents the bootstrap env contract. |
| examples/todo-postgres/docker-compose.yml | Introduces a 2-node cluster + Postgres compose setup using mesh-cluster DNS aliasing. |
| examples/todo-postgres/.env.example | Adds guidance for using MESH_NODE_HOST in container environments. |
| compiler/mesh-rt/src/dist/bootstrap.rs | Adds MESH_NODE_HOST, hostname identity fallback, and unit tests for resolution order/IPv6. |
| compiler/mesh-rt/Cargo.toml | Adds the hostname dependency for runtime hostname resolution. |
| compiler/mesh-pkg/src/scaffold.rs | Updates scaffolding docs and generates docker-compose.yml for the postgres todo template. |
| Cargo.lock | Locks the new hostname dependency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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
Implements the Docker cluster bootstrap contract for generic deployments. Operators can now deploy clustered Mesh apps to Docker without manual identity construction or repo-local hacks.
What changed:
MESH_NODE_NAMEis not setMESH_NODE_HOSTenv var lets operators specify advertised addressesmeshc init --template todo-api --db postgresgenerates a production-readydocker-compose.ymlWhy:
MESH_NODE_NAMEconstruction (e.g.,todo-postgres@10.0.0.5:4370)Result:
Operators only need
MESH_CLUSTER_COOKIE+MESH_DISCOVERY_SEED+MESH_NODE_HOSTto cluster. The runtime handles identity resolution automatically.Related issues
Verification
Bootstrap environment contract:
MESH_CLUSTER_COOKIEMESH_DISCOVERY_SEEDMESH_CLUSTER_PORT4370MESH_NODE_NAMEname@host:portidentity (overrides auto)MESH_NODE_HOSTMESH_CONTINUITY_ROLEprimaryprimaryorstandbycontinuity roleMESH_CONTINUITY_PROMOTION_EPOCH0MESH_DISCOVERY_INTERVAL_MS5000Identity resolution order:
MESH_NODE_NAME>FLY_*env > hostname +MESH_NODE_HOSTChecklist
Notes for reviewers
Key design decisions:
Hostname-based identity is the third fallback (after explicit
MESH_NODE_NAMEand Fly env). This preserves backward compatibility while enabling Docker/K8s deployments.MESH_NODE_HOSTis optional with a sensible default (system hostname). Operators only set it when the container hostname isn't routable (e.g., overlay networks).Docker Compose uses network aliases (
mesh-cluster) soMESH_DISCOVERY_SEED=mesh-clusterresolves to all node IPs. This is simpler than hardcoding IPs.Cross-compilation documented because macOS/Windows users will hit "exec format error" without
--target x86_64-unknown-linux-gnu. The README now includes this upfront.Areas to focus on:
compiler/mesh-rt/src/dist/bootstrap.rslines 350-390: hostname identity resolution logicexamples/todo-postgres/docker-compose.yml: network alias pattern for discoveryexamples/todo-postgres/README.md: bootstrap contract table completenessNot breaking:
MESH_NODE_NAMEand Fly deployments work unchanged