Skip to content

Make Aspire base port configurable to support parallel stacks across git worktrees#874

Draft
tjementum wants to merge 18 commits intomainfrom
pp-1144-make-app_port-configurable-via-global
Draft

Make Aspire base port configurable to support parallel stacks across git worktrees#874
tjementum wants to merge 18 commits intomainfrom
pp-1144-make-app_port-configurable-via-global

Conversation

@tjementum
Copy link
Copy Markdown
Member

Summary & Motivation

Centralize the local-development port allocation behind a single source of truth (.workspace/port.txt) and propagate the base port through every layer that previously hardcoded 9000 and friends. Two motivations: enable running multiple Aspire stacks simultaneously from separate git worktrees (each stack on its own non-overlapping port range, with isolated Docker volumes), and remove the scattered hardcoded ports that drifted out of sync across rsbuild configs, test fixtures, the gateway, and the AppHost.

  • Add PortAllocation in the shared kernel as the canonical source for the base port. Self-bootstraps .workspace/port.txt to 9000 on first read and computes derived offsets for Aspire dashboard, Postgres, Azurite, gateway, per-SCS API/static/workers, OTel, and MCP
  • Accept an optional positional basePort argument on pp run / pp restart and the corresponding MCP tools; written atomically to .workspace/port.txt before any code path lazily loads PortAllocation
  • Suffix Docker volume names with the base port for non-default stacks (e.g., platform-platform-11000-postgres-data) so parallel Azurite and Postgres containers do not corrupt each other's state
  • Allow pp run and pp restart to operate in a fresh worktree (no port.txt) without false-positive collision warnings against another worktree's running stack
  • Switch the Aspire MCP server from HTTP transport (hardcoded localhost:9007) to stdio transport via the Aspire CLI so the integration works on any base port. The README prerequisites now include Aspire CLI install steps for Windows, macOS, and Linux
  • Warn when the locally installed Aspire CLI version does not match the Aspire.AppHost.Sdk pinned in AppHost.csproj
  • Inject the blob storage connection string from Aspire (renaming the endpoint to blob-storage) so SCS clients honor the dynamic Azurite port instead of falling back to the SDK default 127.0.0.1:10000
  • Soften MCP run/restart success messages to "Aspire is starting on ..." since the underlying CLI is fire-and-forget; callers should verify with get_ports or list_apphosts
  • Add a get_ports MCP tool returning the full port allocation as JSON, and ignore .claude/worktrees for local worktree management

Checklist

  • I have added tests, or done manual regression tests
  • I have updated the documentation, if necessary

@tjementum tjementum self-assigned this Apr 27, 2026
@tjementum tjementum added the Enhancement New feature or request label Apr 27, 2026
@linear
Copy link
Copy Markdown

linear Bot commented Apr 27, 2026

@tjementum tjementum moved this to 🏗 In Progress in Kanban board Apr 27, 2026
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request

Projects

Status: 🏗 In Progress

Development

Successfully merging this pull request may close these issues.

1 participant