Skip to content

feat(scaling): add single-server replicas for apps and services - #1811

Open
Hydralerne wants to merge 4 commits into
mainfrom
feat/single-server-replicas
Open

Hydralerne wants to merge 4 commits into
mainfrom
feat/single-server-replicas

Conversation

@Hydralerne

@Hydralerne Hydralerne commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Summary

Allow single-server Docker applications and individual Compose services to run multiple instances through the existing Scale → review → deploy flow. Choosing three instances now creates one managed workload with private load balancing, while one instance keeps the ordinary container path.

Motivation

Single-server projects previously had no equivalent to the cluster instance control. Reuse the existing deployment and runtime workflows so changing instance counts does not introduce another environment editor or lifecycle path.

Related issue

None; this feature and its approach were requested directly by the maintainer.

Changes

  • Dashboard: share the instance input and review dialog with cluster scaling; show observed readiness and per-instance resource limits for the selected app or service.
  • Runtime: use the existing Docker container configuration for each instance and a private, confined transport gateway. Reuse environment application, logs, networking, lifecycle, cleanup, readiness and deployment recovery. Keep existing Swarm support and inherited cluster defaults.
  • Configuration: persist bounded replica counts in migration 0233; freeze counts into releases; accept Compose scale / deploy.replicas and preserve private expose ports. Guard writes with organization ownership, active-release and configuration-version checks.
  • Safety: refuse unsupported runtimes, database copies, writable mounts (including image-declared volumes), shared namespaces and unsupported GPU allocations. Keep app member ports private and bind each published port once.
  • API/SDK/docs: expose the shared scaling operations and document the behavior and limits.

Verification

  • Real Docker: 10 integration tests passed, including balancing, member recovery, partial environment-update rollback, failed replacement cleanup, shared networking, read-only volumes, primary apps and scaling back to one instance. The Docker tests require an explicit OPENSHIP_DOCKER_TEST_SOCKET and clean up only their unique test project.
  • Replica runtime unit tests: 10 passed. Shared Scale UI suites: 28 passed. Core, database, SDK and operation-permission suites: 72 passed.
  • After rebasing onto current main: 258 API tests passed, covering scaling, deployment snapshots, Compose review, primary-app materialization and service configuration.
  • Broad package suites on the repository's pinned Bun 1.4.4: adapters 6,178 passed, dashboard 4,527 passed, core 2,136 passed, desktop 74 passed, CLI 816 passed, SDK 266 passed, platform 832 passed, contracts 58 passed. Existing opt-in/environment-dependent tests retain their skips.
  • The broad API run passed 826 files / 11,403 tests. After updating the prototype-only Compose fixture for runtime preparation, both remaining files passed (91 tests); a GitHub permission test that timed out under the full-suite load also passed on this rerun. The whole API suite has not been rerun after the fixture correction.
  • The broad database run passed 106 files / 981 tests. Legacy upgrade assertions needed the new replicas: 1 column default; after correcting them, the migration-chain suite passed all 13 tests.
  • Relevant TypeScript checks, documentation validation, error-boundary audit and diff whitespace checks passed. CI remains the merge gate.
OPENSHIP_DOCKER_TEST_SOCKET=/path/to/test/docker.sock bunx vitest run --config packages/adapters/vitest.config.ts packages/adapters/src/runtime/docker-replicas.integration.test.ts packages/adapters/src/runtime/docker-replicas.test.ts
bun run docs:check
bun run errors:check
git diff --check

Operational limits

Changing the count uses workload replacement and can briefly interrupt traffic. All instances share one server's capacity and availability. Docker restart policies handle exited containers; this does not add a scheduler that recreates manually deleted containers or provide host-level failover. Hosted Cloud runtimes retain their existing behavior.

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