Skip to content

fix(smoke): pin api to 1 replica in farm-smoke override - #28

Draft
sssaturX wants to merge 1 commit into
santorifrom
cursor/smoke-api-replica-a86d
Draft

fix(smoke): pin api to 1 replica in farm-smoke override#28
sssaturX wants to merge 1 commit into
santorifrom
cursor/smoke-api-replica-a86d

Conversation

@sssaturX

Copy link
Copy Markdown
Owner

Problem

scripts/docker-smoke-mms-offline.sh (and -live.sh, same override) aborts at the Starting api + ws-service step with:

Error response from daemon: failed to set up container networking:
driver failed programming external connectivity on endpoint farm-api-3 ...
Bind for 127.0.0.1:13000 failed: port is already allocated

Root cause

docker-compose.yml declares api.deploy.replicas: 3 (production shape). The smoke override docker-compose.farm-smoke-override.yml adds a fixed host-port mapping:

api:
  ports:
    - "127.0.0.1:13000:3000"

A host port can be bound by only one container. Compose tries to start farm-api-1, farm-api-2, farm-api-3 — the first succeeds, the rest fail with port is already allocated, and the whole docker compose up exits non-zero before the smoke script can run any checks.

Fix

Set deploy.replicas: 1 on the api service in the smoke-only override. Compose deep-merges deploy, so resources and other base-file fields are preserved. Production docker-compose.yml is untouched.

api:
  deploy:
    replicas: 1
  ports:
    - "127.0.0.1:13000:3000"
  ...

Verification

  • python3 -c 'import yaml; yaml.safe_load(open("docker-compose.farm-smoke-override.yml"))'
  • docker compose config (when docker is available) shows api with a single replica and the correct port mapping.
  • scripts/docker-smoke-mms-offline.sh should now proceed past Starting api + ws-service and reach the health/ready polling loop.

No production behaviour changes. The override header already states "smoke-test override ONLY. Do not merge for production deploys."

Open in Web Open in Cursor 

The base docker-compose.yml scales api to deploy.replicas: 3 (production
shape). The smoke override publishes a fixed host port mapping
127.0.0.1:13000 -> :3000, which only one container can bind at a time.
Docker Compose created 3 api containers and the 2nd/3rd failed with:

  Error response from daemon: failed to set up container networking:
  ... Bind for 127.0.0.1:13000 failed: port is already allocated

This aborted scripts/docker-smoke-mms-offline.sh (and -live.sh by the
same path) before any smoke checks could run.

Fix: set deploy.replicas: 1 on the api service in the smoke-only
override. Base production config is untouched.

Co-authored-by: SaturX <sssaturX@users.noreply.github.com>
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