Skip to content

Let docker-compose.dev.yml scale rest-api past one container #236

Open

Description

@HMarzban

Problem

docker compose -f docker-compose.dev.yml up --scale rest-api=2 cannot run. The rest-api service sets a fixed container_name and binds a fixed host port 4000:4000. A container name must be unique, and a host port cannot bind twice.

This matters because production runs rest-api with replicas: 2 and no sticky session, so any state held per process is invisible in development and breaks in production.

What to do

Remove container_name from the rest-api service, and change the fixed port binding so more than one replica can start. Each choice has a limit. The browser calls REST at NEXT_PUBLIC_RESTAPI_URL=http://localhost:4000/api (.env.example), so dropping the host binding breaks the everyday path. A host port range must skip 4001 and 4002, because hocuspocus-server and hocuspocus-worker already bind them.

Leave the other services alone.

Acceptance

  • docker compose -f docker-compose.dev.yml up --scale rest-api=2 starts two containers.
  • The single-container path still works unchanged for everyday development.

Notes

There is a cheaper workaround for the specific case that found this: two processes on two ports, APP_PORT=4001 bun src/index.ts and APP_PORT=4002 bun src/index.ts. Two processes are two memories, which is the production condition. #226, now closed, used that workaround for its stateless test.

So this issue is only worth doing if someone needs real container scaling in development.

Activity

  1. added
    enhancement
    good first issue
    on Sep 4, 2026
  2. added this to the v2.2.0 milestone on Oct 18, 2026
  3. HMarzban commented on Oct 19, 2026

    @HMarzban
    CollaboratorAuthor

    Maintainer ruling, 2026-10-19

    Leave this open for later.

  4. modified the milestones: v2.2.0, v2.3.0 on Oct 21, 2026
  5. removed this from the v2.3.0 milestone on Nov 4, 2026
  6. HMarzban commented on Nov 4, 2026

    @HMarzban
    CollaboratorAuthor

    Maintainer ruling, 2026-11-04

    Moved from milestone v2.3.0 to no milestone, from the v2.3.0 open-issue review. It is parked by the 2026-10-19 ruling, "Leave this open for later". It has no release link.

    The issue stays open. Its remaining items are unchanged.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    DevOpsenhancementgood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions