Repository navigation
Conversation
Allow users to override default service ports (NEMOCLAW_GATEWAY_PORT, NEMOCLAW_DASHBOARD_PORT, NEMOCLAW_VLLM_PORT, NEMOCLAW_OLLAMA_PORT) through environment variables. This prevents conflicts when default ports are already in use on the host. New file: - bin/lib/ports.js — central port config with env var overrides and validation (range 1024-65535) Modified files: - bin/nemoclaw.js — use DASHBOARD_PORT for port forwarding - bin/lib/onboard.js — use port constants for gateway, dashboard, inference detection, and Ollama startup - bin/lib/local-inference.js — use VLLM_PORT and OLLAMA_PORT for health checks, base URLs, and error messages - bin/lib/nim.js — use VLLM_PORT for NIM container port mapping - bin/lib/preflight.js — use DASHBOARD_PORT as default check Follows the existing process.env.NEMOCLAW_* pattern used by NEMOCLAW_MODEL, NEMOCLAW_PROVIDER, and NEMOCLAW_GPU. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughCentralizes port configuration by adding Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@bin/lib/ports.js`:
- Around line 9-13: The port validation currently uses parseInt on raw which
allows strings like "8081abc" to pass; update the validation in the function
that parses environment ports (the block creating `parsed` from `raw`) to first
ensure `raw` matches /^\d+$/ (digits-only) and only then convert using
`Number(raw)` (not parseInt), keeping the existing range check (>=1024 &&
<=65535) and throwing the same Error message when validation fails.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 31500cfe-58e2-4ff5-81fc-f8bfee7826e0
📒 Files selected for processing (6)
bin/lib/local-inference.jsbin/lib/nim.jsbin/lib/onboard.jsbin/lib/ports.jsbin/lib/preflight.jsbin/nemoclaw.js
…iables - Tighten parsePort validation: reject non-digit strings (e.g. "8081abc") that parseInt silently accepted; use regex + Number() instead - Add JSDoc to parsePort and all exported constants (docstring coverage) Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Thanks for the suggested feature, adding configurable port overrides via environment variables could be really useful for users, I'll make sure to review it carefully. |
|
Hey @jnun — thanks for the original design here! We needed this for a BAC Korea deployment and couldn't wait, so we rebased your approach onto latest main in #1645 with you as co-author. The core Feel free to review #1645 if you'd like. Thanks again for the solid foundation! |
…1645) ## Summary - Add `bin/lib/ports.js` as central port configuration module - All hardcoded service ports can now be overridden via environment variables - Defaults are unchanged — zero regression for existing setups | Env var | Default | Service | |---------|---------|---------| | `NEMOCLAW_GATEWAY_PORT` | 8080 | OpenShell gateway | | `NEMOCLAW_DASHBOARD_PORT` | 18789 | Dashboard UI | | `NEMOCLAW_VLLM_PORT` | 8000 | vLLM/NIM inference | | `NEMOCLAW_OLLAMA_PORT` | 11434 | Ollama inference | Ports are validated to be non-privileged (1024–65535). ### Usage ```bash export NEMOCLAW_DASHBOARD_PORT=19000 nemoclaw onboard ``` ## Related Issue Closes #684 Based on the approach from PR #683 by @jnun — thank you for the original design. Supersedes #683 (rebased on latest main with correct defaults). Consider closing #703, #357 (subsumed by this). ## Test plan - [ ] `npm test` passes (135 tests in cli + onboard) - [ ] `nemoclaw onboard` works with default ports (no regression) - [ ] Set `NEMOCLAW_DASHBOARD_PORT=19000`, verify dashboard uses port 19000 - [ ] Set invalid port (e.g., `NEMOCLAW_GATEWAY_PORT=abc`), verify startup fails with clear error Signed-off-by: Prekshi Vyas <[email protected]> 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Centralized, configurable ports for dashboard, gateway, vLLM and Ollama via environment variables with validated defaults. * **Improvements** * Startup, health checks, diagnostics, uninstall and helper flows now honor configured ports and enforce numeric/range validation with fail-fast errors. * **Tests** * Added unit and end-to-end tests covering port parsing, boundaries and override scenarios; CI job added to run E2E port-override tests. * **Chore** * Added compatibility shim to surface built artifacts and documented the default dashboard port in the container build. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Prekshi Vyas <[email protected]> Signed-off-by: Aaron Erickson <[email protected]> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: jnun <[email protected]> Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]> Co-authored-by: Carlos Villela <[email protected]> Co-authored-by: Aaron Erickson <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…VIDIA#1645) ## Summary - Add `bin/lib/ports.js` as central port configuration module - All hardcoded service ports can now be overridden via environment variables - Defaults are unchanged — zero regression for existing setups | Env var | Default | Service | |---------|---------|---------| | `NEMOCLAW_GATEWAY_PORT` | 8080 | OpenShell gateway | | `NEMOCLAW_DASHBOARD_PORT` | 18789 | Dashboard UI | | `NEMOCLAW_VLLM_PORT` | 8000 | vLLM/NIM inference | | `NEMOCLAW_OLLAMA_PORT` | 11434 | Ollama inference | Ports are validated to be non-privileged (1024–65535). ### Usage ```bash export NEMOCLAW_DASHBOARD_PORT=19000 nemoclaw onboard ``` ## Related Issue Closes NVIDIA#684 Based on the approach from PR NVIDIA#683 by @jnun — thank you for the original design. Supersedes NVIDIA#683 (rebased on latest main with correct defaults). Consider closing NVIDIA#703, NVIDIA#357 (subsumed by this). ## Test plan - [ ] `npm test` passes (135 tests in cli + onboard) - [ ] `nemoclaw onboard` works with default ports (no regression) - [ ] Set `NEMOCLAW_DASHBOARD_PORT=19000`, verify dashboard uses port 19000 - [ ] Set invalid port (e.g., `NEMOCLAW_GATEWAY_PORT=abc`), verify startup fails with clear error Signed-off-by: Prekshi Vyas <[email protected]> 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Centralized, configurable ports for dashboard, gateway, vLLM and Ollama via environment variables with validated defaults. * **Improvements** * Startup, health checks, diagnostics, uninstall and helper flows now honor configured ports and enforce numeric/range validation with fail-fast errors. * **Tests** * Added unit and end-to-end tests covering port parsing, boundaries and override scenarios; CI job added to run E2E port-override tests. * **Chore** * Added compatibility shim to surface built artifacts and documented the default dashboard port in the container build. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Prekshi Vyas <[email protected]> Signed-off-by: Aaron Erickson <[email protected]> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: jnun <[email protected]> Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]> Co-authored-by: Carlos Villela <[email protected]> Co-authored-by: Aaron Erickson <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…VIDIA#1645) ## Summary - Add `bin/lib/ports.js` as central port configuration module - All hardcoded service ports can now be overridden via environment variables - Defaults are unchanged — zero regression for existing setups | Env var | Default | Service | |---------|---------|---------| | `NEMOCLAW_GATEWAY_PORT` | 8080 | OpenShell gateway | | `NEMOCLAW_DASHBOARD_PORT` | 18789 | Dashboard UI | | `NEMOCLAW_VLLM_PORT` | 8000 | vLLM/NIM inference | | `NEMOCLAW_OLLAMA_PORT` | 11434 | Ollama inference | Ports are validated to be non-privileged (1024–65535). ### Usage ```bash export NEMOCLAW_DASHBOARD_PORT=19000 nemoclaw onboard ``` ## Related Issue Closes NVIDIA#684 Based on the approach from PR NVIDIA#683 by @jnun — thank you for the original design. Supersedes NVIDIA#683 (rebased on latest main with correct defaults). Consider closing NVIDIA#703, NVIDIA#357 (subsumed by this). ## Test plan - [ ] `npm test` passes (135 tests in cli + onboard) - [ ] `nemoclaw onboard` works with default ports (no regression) - [ ] Set `NEMOCLAW_DASHBOARD_PORT=19000`, verify dashboard uses port 19000 - [ ] Set invalid port (e.g., `NEMOCLAW_GATEWAY_PORT=abc`), verify startup fails with clear error Signed-off-by: Prekshi Vyas <[email protected]> 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Centralized, configurable ports for dashboard, gateway, vLLM and Ollama via environment variables with validated defaults. * **Improvements** * Startup, health checks, diagnostics, uninstall and helper flows now honor configured ports and enforce numeric/range validation with fail-fast errors. * **Tests** * Added unit and end-to-end tests covering port parsing, boundaries and override scenarios; CI job added to run E2E port-override tests. * **Chore** * Added compatibility shim to surface built artifacts and documented the default dashboard port in the container build. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Prekshi Vyas <[email protected]> Signed-off-by: Aaron Erickson <[email protected]> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: jnun <[email protected]> Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]> Co-authored-by: Carlos Villela <[email protected]> Co-authored-by: Aaron Erickson <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: ColinM-sys <[email protected]>
Summary
bin/lib/ports.js— central port configuration that readsNEMOCLAW_GATEWAY_PORT,NEMOCLAW_DASHBOARD_PORT,NEMOCLAW_VLLM_PORT, andNEMOCLAW_OLLAMA_PORTfrom environment variables with validation and sensible defaultsprocess.env.NEMOCLAW_*pattern used byNEMOCLAW_MODEL,NEMOCLAW_PROVIDER, andNEMOCLAW_GPUProblem
The default ports (8080, 8000, 18789) conflict with common services (Jenkins, Django, Tomcat, K8s dashboards). Users have no way to change them without editing source code.
Fix
One new file (
bin/lib/ports.js, 23 lines), five surgical edits. No new infrastructure, no.envfile loading, no shell script changes. Environment variables override defaults:Validation rejects invalid values (non-integer, out of range 1024-65535).
Files changed
bin/lib/ports.jsbin/nemoclaw.jsDASHBOARD_PORTbin/lib/onboard.jsbin/lib/local-inference.jsbin/lib/nim.jsbin/lib/preflight.jsTest plan
npx vitest run— 214/219 pass (5 pre-existing failures in install-preflight.test.js)node bin/nemoclaw.js onboardwithNEMOCLAW_GATEWAY_PORT=8081— gateway starts on configured portnode bin/nemoclaw.js --help/--version— CLI smoke testSupersedes #652.
🤖 Generated with Claude Code
Summary by CodeRabbit