fix(smoke): install node-service host deps + pin api to 1 replica in farm-smoke override - #29
Merged
Merged
Conversation
scripts/docker-smoke-mms-offline.sh and scripts/docker-smoke-mms-live.sh run several .cjs helpers on the HOST out of node-service/ (seed-mms-redis, mms-offline-prove, ws-mms-smoke, validate-api-mms-json, and an inline jsonwebtoken sign) that require ioredis / nats / ws / jsonwebtoken from node-service/node_modules. The repo tracks node_modules in git per AGENTS.md, but fresh GitHub Actions checkouts and devs with a local .gitignore customization hit: Error: Cannot find module 'ioredis' Require stack: - node-service/scripts/seed-mms-redis.cjs Two-layer fix: 1. In both smoke shell scripts, guard an 'npm ci' that only runs when one of the required modules is missing from node-service/node_modules/. Fixes local reproduction for contributors. 2. In .github/workflows/ci.yml (smoke-mms-offline job) and smoke-mms-live-nightly.yml, add setup-node + explicit 'npm ci' inside node-service/ before the smoke step. Keeps CI self-documenting and allows actions/setup-node to cache the install between runs. Co-authored-by: SaturX <sssaturX@users.noreply.github.com>
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>
sssaturX
marked this pull request as ready for review
April 23, 2026 22:10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
CI's
Smoke (offline / PR)job fails with two successive issues:Cannot find module 'ioredis'innode-service/scripts/seed-mms-redis.cjs. The smoke shell script runs.cjshelpers on the host out ofnode-service/, needingioredis/nats/ws/jsonwebtokenfromnode_modules. The CI job never rannpm ciinnode-service/.Bind for 127.0.0.1:13000 failed: port is already allocated. The basedocker-compose.ymldeclaresapi.deploy.replicas: 3(production shape) but the smoke override publishes a fixed host port 13000. Only one container can bind it; replica main commit #2 aborts.Fix
Three independent changes, all scoped to smoke-only config:
1. Install
node-servicehost deps before running .cjs helpersShell scripts (
scripts/docker-smoke-mms-{offline,live}.sh) get anensure_node_service_depsguard that runsnpm ci --no-audit --no-fund --prefer-offlineinnode-service/only if any ofioredis/nats/ws/jsonwebtokenis missing. Fixes local reproduction too.CI workflows (
.github/workflows/ci.ymloffline job andsmoke-mms-live-nightly.yml) addactions/setup-node@v4+ explicitnpm ciinnode-service/before the smoke step. Cache is warm across runs.2. Pin
apito 1 replica in the smoke overridedocker-compose.farm-smoke-override.ymladdsdeploy.replicas: 1on theapiservice. Compose deep-mergesdeploy, so the basedeploy.resourcesblock is preserved; production compose is untouched.Verification
yaml.safe_loadon both workflow files and the compose override — clean.bash -non both smoke scripts — clean.Smoke (offline / PR)passes in 2m09s (gh run view 24861008276), together withnode-service,ws-service,farm-spa,market-microstructure-service..cjsdeps audited against every file innode-service/scripts/*.cjs:ioredis—seed-mms-redis.cjsnats—mms-offline-prove.cjsws—mms-offline-prove.cjs,ws-mms-smoke.cjsjsonwebtoken— inlinenode -eJWT sign in both smoke scriptsNo production-path changes. This PR supersedes #28 (which carried only the replica fix).