-
Notifications
You must be signed in to change notification settings - Fork 45
fix(dashmate)!: port conflicts with mainnet and testnet on the same host #2829
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdds network-specific default ports for ZMQ and rs-dapi metrics, an explicit metrics.enabled flag, a migration to backfill/normalize configs, Docker compose removal of rs_dapi metrics exposure, a schema refactor for metrics, and env logic to zero the metrics port when disabled. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant ConfigFile as Config files
participant Migration as Migration(2.2.0-dev.1)
participant Defaults as Base defaults
participant EnvGen as generateEnvsFactory
participant Docker as docker-compose
ConfigFile->>Migration: iterate and normalize each config
Migration->>Defaults: ensure rsDapi, rsDapi.metrics, core.zmq (clone defaults if missing)
Migration->>ConfigFile: backfill ports / set metrics.enabled when undefined (preserve custom ports)
ConfigFile->>EnvGen: build environment variables
alt metrics.enabled == false
EnvGen->>EnvGen: set PLATFORM_DAPI_RS_DAPI_METRICS_PORT = "0"
end
EnvGen->>Docker: output runtime envs
note right of Docker #DDEBF7: docker-compose updated — rs_dapi metrics exposure removed
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
5ace9e2 to
7baf9ef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/dashmate/configs/getConfigFileMigrationsFactory.js (1)
1279-1285: Document the hardcoded port value.The hardcoded
29998on line 1282 represents the previous default ZMQ port before network-specific defaults were introduced. Adding a comment would clarify this for future maintainers.Apply this diff to add documentation:
+ // Check if ZMQ port matches base default or previous default (29998) + // to identify non-customized configs that should be migrated if ( !Number.isNaN(targetZmqPort) && targetZmqPort !== configuredZmqPort && (configuredZmqPort === baseZmqPortNumber || configuredZmqPort === 29998) ) { options.core.zmq.port = targetZmqPort; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/dashmate/configs/getConfigFileMigrationsFactory.js(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
packages/**/**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
packages/**/**/*.{js,ts,jsx,tsx}: Adhere to ESLint with Airbnb/TypeScript configs for JS/TS code
Use camelCase for JS/TS variables and functions
Use PascalCase for JS/TS classes
Prefer kebab-case filenames within JS packages
Files:
packages/dashmate/configs/getConfigFileMigrationsFactory.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Build Docker images (Dashmate helper, dashmate-helper, dashmate-helper) / Build Dashmate helper image
- GitHub Check: Build JS packages / Build JS
- GitHub Check: Rust crates security audit
🔇 Additional comments (1)
packages/dashmate/configs/getConfigFileMigrationsFactory.js (1)
1229-1289: Migration logic correctly preserves user customizations.The conditional port updates (lines 1271-1285) appropriately check whether ports match known defaults before updating them, ensuring that user customizations are preserved while migrating non-customized configs to network-specific defaults.
Issue being fixed or feature implemented
When an user has both testnet and mainnet (or testnet and local) on the same host, there is a port conflict.
Dashmate reports message like this:
What was done?
platform.dapi.rsDapi.metrics.enabledflag that defaults tofalse, to disable metrics for people who don't need them.How Has This Been Tested?
NOT TESTED YET
Breaking Changes
ZMQ port
ZMQ port was changed:
RS-Dapi metrics
Previously metrics were enabled by default. Now they are disabled by default.
To enable,
dashmate config set platform.dapi.rsDapi.metrics.enabled trueRS-DAPI metrics port was changed:
Checklist:
For repository code-owners and collaborators only
Summary by CodeRabbit
New Features
Documentation
Chores
Bug Fixes