Repository navigation
feat(ray-cluster): add an inference variant that serves a model with vLLM - #245
Merged
Merged
Conversation
murat-runpod
previously approved these changes
Nov 18, 2026
…vLLM runpod/ray-cluster:<version>-inference-cu1300-torch2130-ubuntu2404 is the Ray cluster image plus vLLM 0.32.0, configured only with environment variables. The head waits for NUM_NODES nodes to join Ray, then runs `vllm serve $MODEL_REPO` on 8000 across the cluster (tensor parallelism = GPUs per node, pipeline parallelism = node count); workers only run Ray. Every route except /health, /ping and /metrics needs VLLM_API_KEY, else the head's JUPYTER_PASSWORD, enforced by the runpod_vllm_auth middleware. Built FROM the cu1300/torch2130 Ray target of the same bake run, since vLLM pins torch exactly; the build fails if vLLM would replace torch or Ray, or stops loading --middleware. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r on 8001 vLLM now listens on 127.0.0.1:8000 only, and the base image's nginx serves the API on 8001, checking the key before proxying. Every route except /health and /ping needs it, including /metrics and any route a future vLLM adds, and auth no longer depends on vLLM's --middleware hook, so the runpod_vllm_auth copy is gone. While vLLM isn't listening, 8001 answers 503. The start script writes the accepted header to a root-only nginx map and reloads nginx; the shipped map accepts nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he head The inference variant's /post_start.sh runs the Ray image's hook, then adds a Prometheus `vllm` job for 127.0.0.1:8000/metrics (no key needed: only nginx's 8001 is reachable from outside). vLLM's example Grafana dashboards, vendored from vllm-project/vllm v0.32.0, load into a vLLM folder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A pod without MODEL_REPO is an interactive pod, not a failure, and the GPU smoke test's log scan fails any boot that logs "error". Worded like start.sh's "JUPYTER_PASSWORD is not set; skipping JupyterLab" instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LiteLLM's proxy (1.108.11, the LTS line) now serves the API on 8001 in front of vLLM, which stays on 127.0.0.1:8000. It runs in its own venv from a hash-locked requirements file. The master key is LITELLM_MASTER_KEY, else the head's JUPYTER_PASSWORD; LITELLM_MASTER_KEY=none turns auth off. No database and no admin UI. The nginx front door is gone. The image also removes the base nginx's 8001 server, which proxied to localhost:8000 with no auth and would have exposed vLLM (and held the port LiteLLM needs); the build fails if anything in nginx still listens on 8001. The head's Prometheus scrapes LiteLLM's /metrics with the master key from a root-only file, besides vLLM's, with the raw-key `hashed_api_key` label excluded. LiteLLM's "Prod v2" dashboard joins vLLM's in an Inference folder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… 4000 8001 was kept from the earlier nginx front door. 4000 is where LiteLLM's docs and users expect it, and it doesn't share a port with the base nginx's 8001 slot. That block (proxying to localhost:8000 without auth) is still removed, since 8000 is vLLM here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#248 removes the base's unused 8001 -> localhost:8000 block. The inference image builds on published Ray images, which keep it until that's released, so its removal step now accepts either state; the guard that nothing in nginx listens on 8001 is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#248 removes the base's unused 8001 -> localhost:8000 relay for every image, so the inference image no longer strips it itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LiteLLM used to start alongside vLLM, so every request during the model load (a minute or more on a multi-node cluster) got a 500 and a logged traceback. It now waits for vLLM's /health: until then nothing listens on 4000 and the Runpod proxy answers 502. If vLLM exits first, LiteLLM is not started. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ometheus The vendored vLLM and LiteLLM dashboards kept the variable values their authors exported: a datasource uid from their Grafana (three of the four) and a model name from their deployment (vLLM, Performance Statistics), so their panels queried a datasource or a model that isn't here and showed nothing. DS_PROMETHEUS now selects uid prometheus, and the query variables start empty or All and refresh on load. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It was only in hadolint-push.yml, which runs on pushes to main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ode wait - Check VLLM_EXTRA_ARGS and MAX_MODEL_LENGTH before waiting for the cluster, which has no deadline, so a bad setting is reported at once. - Refuse --api_key as well as --api-key: vLLM reads both the same way. - Split VLLM_EXTRA_ARGS like a shell command line (shlex), so a quoted JSON value with spaces stays one argument; nothing is expanded. - Refuse a MODEL_REPO starting with '-', which vllm serve would take as an option. - Time out each vLLM /health probe after 5s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
As requirements.txt does for Ray: vLLM's unpinned or ranged direct requirements, resolved with the base's torch and Ray, minus those a lower layer already pins at a version vLLM accepts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…inputs - Add the vllm and litellm Prometheus jobs only with a MODEL_REPO; without one they are only ever down. - Put ray-cluster-inference in the CUDA group of INFERENCE_BASE rather than a hard-coded cu1300. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Runs start.sh whole with fakes for nvidia-smi, vllm, curl and LiteLLM: every refusal starts nothing and hands off to /start.sh, and every acceptance checks the exact vllm command line, the key LiteLLM gets, the key file's permissions and the LiteLLM config. wait_for_nodes.py's shape check moves into shape_error() and is tested with a fake ray. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ev repo
The inference tag lacked ${REPO_SUFFIX}, so develop/PR builds targeted the
public runpod/ray-cluster repo and the push failed with 401.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
taylorburmeister-runpod
force-pushed
the
ray-cluster-inference
branch
from
November 19, 2026 13:24
96bdf11 to
a4f6be4
Compare
|
Verdict: ready to merge. Merge #248 first, as the description says. The image already strips the 8001 → 8000 relay itself and fails the build if one is left, so this ordering is now belt-and-braces rather than required. Findings: none open. This push adds no new findings. Fixed since last review
Risk to current users: low.
Release: this rebuilds the Test on a live pod: CI starts the image without
|
…e image The base nginx relays 8001 to localhost:8000, which in the inference variant is vLLM without LiteLLM's key. #248 removes it from the base, but this image builds FROM a published pytorch-cluster that may still carry it. Strip the block here and fail the build if nginx still proxies to 8000, so the merge order of the two PRs doesn't matter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The base puts HF_HOME on /workspace, so the weights land on the volume, not the container disk as the README said, and with one network volume shared by every node all vLLM workers downloaded the same repo into the same cache at once (huggingface_hub's file locks don't hold across hosts). The head now downloads the model first, in the background vLLM job so SSH and Jupyter come up meanwhile; workers then find a complete cache. Only what vLLM loads is fetched: the first weight format present, the index's safetensors when there is one, never original/. --revision and --download-dir in VLLM_EXTRA_ARGS apply to it, and a local directory is served as is. The README now sizes the volume, not the container disk. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…LLM reads The head ran wait_for_nodes.py in the foreground, so SSH, Jupyter and monitoring stayed down until every worker joined, forever if one never did. The wait now runs in the background job, after the download, so workers join while the model downloads. The pre-download now picks exactly the weight files vLLM 0.32.0 downloads. Under --load-format auto, vLLM serves a repo with a consolidated*.safetensors (Mistral's) in Mistral's format, so the shards it fetched were never read and every node still downloaded the consolidated copy at once. --load-format is passed on, and formats served by other loaders (gguf, ...) leave the weights to vLLM. When the Hub can't be reached, a snapshot already in the cache is served instead of refusing to start vLLM. The harness unit tests now also run when download_model.py changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…able download_model.py fell back to the cached snapshot on any failure, and snapshot_download(local_files_only=True) accepts one only partly downloaded: the index fetched first creates it. On a full volume (ENOSPC or EDQUOT) the head then logged "serving the snapshot already in the cache" and started vLLM, whose workers downloaded the missing shards at once; a refused HF_TOKEN or a download cut short on an earlier boot did the same. The fallback now covers only an unreachable Hub (offline mode, an httpx2 transport error, or a file not cached because of either), and only a snapshot whose download completed here for the same load format, marked by .runpod-complete. Any other failure stops vLLM with the start script's message about HF_TOKEN and free space. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LiteLLM's one model was always MODEL_REPO, so a --served-model-name in VLLM_EXTRA_ARGS broke every request: vLLM answered 404 for MODEL_REPO, and LiteLLM refused the served name, having no deployment by it. The start script now reads --served-model-name with the other flags it reads from VLLM_EXTRA_ARGS (the last one given wins, as in vLLM) and names LiteLLM's model, and the hosted_vllm/ model it forwards to, after its first name, the one vLLM answers with. Without one, it is MODEL_REPO as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vLLM's argparse keeps allow_abbrev, so it takes any unambiguous prefix of an option, but the start script matched VLLM_EXTRA_ARGS by exact name. --api-k got past the --api-key refusal (vLLM then demanded a key LiteLLM never sends, and logged it), --served-model left LiteLLM's model under the wrong name, and --revis, --download-d or --load-f sent the pre-download somewhere other than what vLLM reads. The script now maps a prefix of --api-key, --revision, --download-dir, --load-format or --served-model-name to that option, after turning underscores into dashes, as vLLM does. An ambiguous prefix fails vLLM anyway, so reading it as one of these is harmless. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the settings post_start.sh added the vllm and litellm scrape jobs whenever MODEL_REPO was set, so a head that refused its settings (no key, --api-key, a bad NUM_NODES, no GPU) left Prometheus two targets that never came up, the litellm one with a credentials_file that didn't exist. The start script now writes the master key only once those checks pass, and first removes one left from an earlier boot; post_start.sh adds the jobs only when the key is there. Also pins httpx2, which download_model.py imports, at the version that resolves with vLLM, torch and Ray, and passes check=False and re.MULTILINE in the tests, for Ruff. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vLLM's --config reads options from a YAML file, so it could set --api-key, --served-model-name, --revision, --download-dir or --load-format where the start script never sees them: the refusal of --api-key and the names and paths the script reads from VLLM_EXTRA_ARGS would no longer hold. The script now refuses --config (and its abbreviations, such as --conf), asking for its options in VLLM_EXTRA_ARGS instead. --config-format, a different option, still passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
murat-runpod
approved these changes
Nov 20, 2026
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.
Summary
Adds the inference variant described in runpod/docs#977. It's the Ray cluster image plus vLLM 0.32.0 behind LiteLLM's proxy, and it serves one Hugging Face model across the whole cluster, configured with environment variables only.
Published as
runpod/ray-cluster:<version>-inference-cu1300-torch2130-ubuntu2404.Behaviour
NUM_NODESnodes have joined Ray, then runsvllm serve $MODEL_REPOon127.0.0.1:8000, with tensor parallelism set to the GPUs per node and pipeline parallelism set to the node count. LiteLLM's proxy serves the API on 4000 (LiteLLM's default) in front of it.NODE_RANK): the same on its own GPUs, without Ray./health. Until then nothing listens on 4000, and the Runpod proxy returns 502. If vLLM exits first, LiteLLM isn't started.MODEL_REPOHF_TOKENLITELLM_MASTER_KEYJUPYTER_PASSWORDnoneturns auth off.MAX_MODEL_LENGTH--max-model-lenVLLM_EXTRA_ARGSvllm serve; can override the parallelism.--api-keyis refused.Changes
inference/litellm/,inference/start.sh):/opt/litellm, installed--require-hashesfrom a committed lock file. LiteLLM 1.82.7 and 1.82.8 were removed from PyPI earlier this year (consistent with a compromised release), so the pin is exact and every dependency's hash is checked.prismais installed even though there's no database, because LiteLLM's error handler imports it. Without it, a request with no key gets a 500 instead of a 401.sk-1234, which LiteLLM refuses to start with.localhost:8000with no auth, and here that's vLLM. fix: remove the unused nginx 8001 proxy to localhost:8000 #248 removes that relay from the base. Merge fix: remove the unused nginx 8001 proxy to localhost:8000 #248 first, so no published inference image carries it.cu1300-torch2130Ray target in the same bake run. vLLM pins torch exactly, and 0.32.0 is its last release on torch 2.13.inference/post_start.sh,inference/config/):127.0.0.1:8000, with no key./metrics, which requires the key, by sending the key from a root-only file.hashed_api_keylabel is excluded, because it records a rejected key in plain text.inference/wait_for_nodes.py): waits forNUM_NODESnodes and checks they all have the same nonzero GPU count.Testing
On a GPU cluster (2 nodes × 2 GPUs,
MODEL_REPO=Qwen/Qwen3-0.6B):--pipeline-parallel-size 2 --tensor-parallel-size 2on the Ray executor.VLLM_EXTRA_ARGS=--enable-auto-tool-choice --tool-call-parser hermes.Local, with a stand-in OpenAI server on
127.0.0.1:8000in place of vLLM (LiteLLM on 4000):JUPYTER_PASSWORDfallback, a non-sk-value with$and")No connected db.(refused)/metricswithout the key/health/liveliness/healthanswers, then 200LITELLM_MASTER_KEY(whitespace trimmed) set alongsideJUPYTER_PASSWORDnonevllmandlitellmtargets up; LiteLLM request counts queryable; no raw key in the labelsNot yet tested: the readiness gate with a real vLLM. CI's smoke test starts the image without
MODEL_REPO, so it doesn't start either service.Notes
LITELLM_MASTER_KEYinstead ofVLLM_API_KEY;screen -r;🤖 Generated with Claude Code