Skip to content

feat(compose): scale services with replicas - #27

Merged
djpfs merged 2 commits into
mainfrom
feat/compose-scale
Oct 21, 2026
Merged

djpfs merged 2 commits into
mainfrom
feat/compose-scale

Conversation

@djpfs

@djpfs djpfs commented Oct 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • Each replica is its own container (<project>-<service>-<n>); replica 1 keeps container_name:.
  • Count from docker compose up --scale SERVICE=N (repeatable), else scale:, else 1. Surplus replicas are removed on up.
  • ps lists every replica; /etc/hosts maps each service name to all replica IPs.

Limitation

stop, start, restart, kill and logs still act on replica 1 only. They are the next step.

Test plan

  • swift test: replica naming, scale count, --scale parsing
  • Real stack with --scale web=3 (needs a running daemon)

Base: feat/compose-multifile-profiles (#26); merge #26 first.

- Each replica is its own container: <project>-<service>-<n>. Replica 1
  keeps the container_name: override.
- Replica count comes from docker compose up --scale SERVICE=N (repeatable),
  else scale:, else 1. Containers above the count are removed on the next up.
- Replicas carry the com.docker.compose.container-number label.
- ps lists every replica, grouped by service in dependency order.
- /etc/hosts entries map each service name to all of its replicas.

Not yet replica-aware: stop, start, restart, kill and logs still act on
replica 1 only.
Keep both the scale flag tests and the registry and build parsing tests.
@djpfs
djpfs merged commit b964ad7 into main Oct 21, 2026
1 of 4 checks passed
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