feat(api): connect to an external Ray cluster via RAY_ADDRESS - #526
Conversation
When RAY_ADDRESS is set, attach to an existing Ray cluster instead of starting an embedded one (so no local dashboard is started — the head node owns it). The embedded branch keeps binding the unauthenticated dashboard to 127.0.0.1 by default (CVE-2023-48022), overridable via RAY_DASHBOARD_HOST. Also document RAY_ADDRESS and RAY_DASHBOARD_HOST in the env examples and the env-vars / Ray-cluster deployment docs.
|
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 (6)
✅ Files skipped from review due to trivial changes (5)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds conditional Ray initialization to ChangesExternal Ray Cluster Support
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
hedhoud
left a comment
There was a problem hiding this comment.
One small docs concern: this note makes the app-side behavior clear, but the security warning should also cover the Ray head dashboard. In cluster mode, that head dashboard is the one users will actually have running, and the example starts it on all interfaces. If the port is not kept private, firewalled, or placed behind auth, users can still end up exposing Ray's unauthenticated dashboard/job API.
| Once running, **OpenRAG will auto-connect** to the Ray cluster using `RAY_ADDRESS` from `.env`. | ||
|
|
||
| :::note | ||
| When `RAY_ADDRESS` is set, the app **attaches** to the external cluster and does **not** start its own embedded Ray dashboard — the head node owns it (started above via `--dashboard-host 0.0.0.0 --dashboard-port ${RAY_DASHBOARD_PORT:-8265}`). The app-side `RAY_DASHBOARD_HOST` setting is only used in embedded (single-node) mode, where it defaults to `127.0.0.1` because the dashboard API is unauthenticated ([CVE-2023-48022](https://nvd.nist.gov/vuln/detail/CVE-2023-48022)). |
There was a problem hiding this comment.
This should probably call out the Ray head dashboard too. In cluster mode the app does not start its own dashboard, but the example above starts the head dashboard on all interfaces. If that port is not private, firewalled, or behind auth, users can still expose Ray's unauthenticated dashboard/job API.
48928d1 to
aa015bd
Compare
What
Make
ray.init()inopenrag/api.pybranch onRAY_ADDRESS:RAY_ADDRESSset →ray.init(address=...)to attach to an external Ray cluster (e.g. a dedicated ray-head container / KubeRay). No embedded dashboard is started — the head node owns it.127.0.0.1by default (CVE-2023-48022), overridable viaRAY_DASHBOARD_HOST.Why
RAY_ADDRESSwas already referenced in the cluster-deployment docs and relied on Ray implicitly reading the env var, while the code unconditionally passeddashboard_host(meaningless when attaching to an existing cluster). This makes the two modes explicit and keeps the secure-by-default dashboard binding for embedded runs.Docs / env
.env.example,docs/assets/env_example.env,docs/assets/env_linux_gpu.env— documentRAY_ADDRESSandRAY_DASHBOARD_HOST(both commented out).docs/content/docs/documentation/env_vars.md— new rows forRAY_ADDRESSandRAY_DASHBOARD_HOST.docs/content/docs/documentation/deploy_ray_cluster.md— note clarifying that in attach mode the head node owns the dashboard.Notes
docker-composechanges: the dashboard-host default onmainis already127.0.0.1; this PR is scoped to theRAY_ADDRESSattach path + docs.ruff check openrag/api.pypasses.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
RAY_ADDRESS, with embedded mode used only when it’s unset.RAY_DASHBOARD_HOST(defaulting to loopback).Documentation