Skip to content

feat: run multiple deployments per machine via name and port_offset - #24

Merged
rafa-stacks merged 3 commits into
nextfrom
multiple
Aug 15, 2026
Merged

rafa-stacks merged 3 commits into
nextfrom
multiple

Conversation

@rafa-stacks

@rafa-stacks rafa-stacks commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

Related to #9

One machine can now host several deployments side by side. Two new top-level stacks.toml fields:

name = "testnet-b"   # default: "stacks"
port_offset = 100    # default: 0

name — deployment identity

  • Becomes the compose project and the container-name prefix (testnet-b-stacks-node, testnet-b-postgres); networks come along free (testnet-b_core, ...). Validated to 1–32 lowercase letters/digits/dashes.
  • The project is embedded in the rendered compose file via the compose-spec top-level name: key instead of threading -p through every call site — so every stacksup command (including chainstate wipe, which doesn't load config) and even a bare docker compose -f run is scoped to the deployment whose directory you're in.
  • The default "stacks" keeps the historical project and container names byte-identical: existing deployments survive the upgrade with their running containers intact.

port_offset — host port separation

  • Shifts every published host port; container-internal ports and service wiring never change (tested: with offset 100 the host publishes postgres on 5532 while the API still reaches it at postgres:5432 in-network).
  • config check probes follow the offset for enabled services and use configured ports as-is for external ones.
  • Offsets above 40000 are rejected to keep shifted ports inside the u16 range.

Also included

@rafa-stacks
rafa-stacks requested a balanced review from Copilot August 15, 2026 17:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds first-class support for running multiple deployments on the same machine by introducing a per-deployment compose project name and host-port offsetting, and updates compose invocation accordingly.

Changes:

  • Embed the compose project name (name:) into the rendered compose file and drop docker compose -p ... usage.
  • Add Deployment.name and Deployment.port_offset, validate them, and apply port shifting to published host ports.
  • Extend tests and docs to cover rpcauth redaction and multi-deployment behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/utils/docker.rs Removes -p project flag and relies on compose file name: scoping; updates related tests.
src/logs/export.rs Adds a regression test to redact both $ and $$ rpcauth spellings.
src/config/render.rs Embeds compose project name; prefixes container names for named deployments; shifts published host ports; adds tests.
src/config/mod.rs Introduces name and port_offset fields, validation, and helper methods (project(), published()).
src/config/check.rs Updates connectivity checks to probe shifted ports for enabled (managed) services.
README.md Documents docker network isolation and explains how to run multiple deployments using name + port_offset.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/config/render.rs Outdated
Comment thread src/config/mod.rs Outdated
Comment thread src/config/check.rs
@rafa-stacks
rafa-stacks marked this pull request as ready for review August 15, 2026 17:58
@rafa-stacks
rafa-stacks merged commit 17f5938 into next Aug 15, 2026
2 checks passed
@rafa-stacks
rafa-stacks deleted the multiple branch August 15, 2026 17:58
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.

2 participants