Skip to content

feat: add vLLM LXC container script - #1678

Closed
piotrlaczykowski wants to merge 4 commits into
community-scripts:mainfrom
piotrlaczykowski:feat/add-vllm
Closed

feat: add vLLM LXC container script#1678
piotrlaczykowski wants to merge 4 commits into
community-scripts:mainfrom
piotrlaczykowski:feat/add-vllm

Conversation

@piotrlaczykowski

@piotrlaczykowski piotrlaczykowski commented Apr 7, 2026

Copy link
Copy Markdown

✍️ Description

Adds `ct/vllm.sh` and `install/vllm-install.sh` for a privileged Ubuntu 24.04 LXC running vLLM, an OpenAI-compatible inference server for local LLM inference with NVIDIA GPU passthrough.

Key design decisions:

  • Privileged container (`var_unprivileged=0`) — required for NVIDIA GPU passthrough on Proxmox
  • Ubuntu 24.04 — required for CUDA 12.x library compatibility
  • Python venv at `/opt/vllm` — isolated from system Python
  • `nvidia-smi` used for GPU detection (more reliable than `nvcc` post-driver-install)
  • Systemd service uses a wrapper script `/usr/local/bin/vllm-server` that sources `/etc/vllm/vllm.env` — avoids fragile heredoc escaping in ExecStart
  • Service does not auto-start on first install — user configures `/etc/vllm/vllm.env` first, then runs `vllm-cli start`
  • Default model: `Qwen/Qwen2.5-1.5B-Instruct` (no Hugging Face gate, small RAM footprint)
  • `vllm-cli` helper: `start|stop|restart|status|logs|config|models|version`
  • Update script follows `ollama.sh` version-check pattern; version tracked in `/opt/vLLM_version.txt`

Default resources: 8 vCPU · 16 GB RAM · 40 GB disk · Ubuntu 24.04

🔗 Related PR / Issue

Link: N/A — new script submission

✅ Prerequisites (X in brackets)

  • Self-review completed – Code follows project standards.
  • Tested thoroughly – Changes work as expected.
  • No breaking changes – Existing functionality remains intact.
  • No security risks – No hardcoded secrets, unnecessary privilege escalations, or permission issues.

🛠️ Type of Change (X in brackets)

  • 🐞 Bug fix – Resolves an issue without breaking functionality.
  • New feature – Adds new, non-breaking functionality.
  • 💥 Breaking change – Alters existing functionality in a way that may require updates.
  • 🆕 New script – A fully functional and tested script or script set.
  • 🌍 Website update – Changes to website-related JSON files or metadata.
  • 🔧 Refactoring / Code Cleanup – Improves readability or maintainability without changing functionality.
  • 📝 Documentation update – Changes to `README`, `AppName.md`, `CONTRIBUTING.md`, or other docs.

🔍 Code & Security Review (X in brackets)

  • Follows `Code_Audit.md` & `CONTRIBUTING.md` guidelines
  • Uses correct script structure (`AppName.sh`, `AppName-install.sh`)
  • No hardcoded credentials

📋 Additional Information (optional)

The service intentionally does not auto-start on first install. GPU model loading can take several minutes depending on model size and hardware. Users should edit `/etc/vllm/vllm.env` to set their preferred model, then start with `vllm-cli start`.


📦 Application Requirements (for new scripts)

  • The application is at least 6 months old — first release Feb 2023
  • The application is actively maintained — last commit today (Apr 7 2026)
  • The application has 600+ GitHub stars — 75,591 stars
  • Official release tarballs are published — https://github.com/vllm-project/vllm/releases
  • I understand that not all scripts will be accepted due to various reasons and criteria by the community-scripts ORG

🌐 Source

Adds privileged Ubuntu 24.04 LXC container for vLLM, an OpenAI-compatible
inference server supporting NVIDIA GPU passthrough with CPU fallback.

- Privileged container (var_unprivileged=0) for GPU passthrough
- Ubuntu 24.04 for CUDA compatibility
- Python venv install with nvidia-smi GPU detection and CPU fallback
- Clean wrapper script pattern for systemd service (avoids heredoc escaping)
- vllm-cli helper for start/stop/logs/config/models/version
- Default model: Qwen/Qwen2.5-1.5B-Instruct (gated-free, small footprint)
- OpenAI-compatible API on port 8000

Co-Authored-By: claude-flow <ruv@ruv.net>
@piotrlaczykowski
piotrlaczykowski requested a review from a team as a code owner April 7, 2026 19:19
@CrazyWolf13

Copy link
Copy Markdown
Member

Why was the PR template removed?

@piotrlaczykowski

Copy link
Copy Markdown
Author

Apologies for the missing template — updated the PR description to fill in the full ProxmoxVED template including all prerequisites, code/security review checklist, and application requirements (vLLM: 75k+ stars, active since Feb 2023, releases published).

@CrazyWolf13

Copy link
Copy Markdown
Member

we normally prefer uv based venv to not interfere with system packages (this got suggested by some people)

Also you seem to be missing the json file for the frontend, can you add that?

check json folder and docs folder for help.

@piotrlaczykowski

Copy link
Copy Markdown
Author

we normally prefer uv based venv to not interfere with system packages (this got suggested by some people)

Also you seem to be missing the json file for the frontend, can you add that?

check json folder and docs folder for help.

Fixed :)

Comment thread ct/vllm.sh Outdated
Comment thread install/vllm-install.sh Outdated
Comment thread json/vllm.json Outdated
Comment thread ct/vllm.sh Outdated
Comment thread install/vllm-install.sh Outdated
Comment thread install/vllm-install.sh Outdated
@MickLesk MickLesk added the stale label Apr 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

@piotrlaczykowski This PR has been marked as stale. It will be closed if no new commits are added in 7 days.

- ct/vllm.sh: use check_for_gh_release + CHECK_UPDATE_RELEASE instead
  of manual get_latest_gh_tag + version file comparison
- ct/vllm.sh: lower default resources to 4 CPU / 8192 MB RAM
- install/vllm-install.sh: use get_latest_github_release (strips v prefix)
  instead of get_latest_gh_tag + manual ${RELEASE#v} stripping
- install/vllm-install.sh: default model changed to Qwen/Qwen2.5-0.5B-Instruct
  (smallest ungated model), add comments with examples for other sizes
- json/vllm.json: update install_methods resources to 4 CPU / 8192 MB RAM
- json/vllm.json: update warning note to reflect new resource defaults
@piotrlaczykowski

Copy link
Copy Markdown
Author

All resolved

@github-actions github-actions Bot removed the stale label Apr 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

@piotrlaczykowski Recent activity detected. Removing stale label.

@piotrlaczykowski

Copy link
Copy Markdown
Author

Anyone to review? @CrazyWolf13

@CrazyWolf13

Copy link
Copy Markdown
Member

@piotrlaczykowski then request a review ^^

Comment thread ct/vllm.sh

if check_for_gh_release "vLLM" "vllm-project/vllm"; then
RELEASE="${CHECK_UPDATE_RELEASE}"
RELEASE_VERSION="${RELEASE#v}"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need this extra var and can apply ${RELEASE#v} directly where needed

Comment thread ct/vllm.sh

msg_info "Updating ${APP} to ${RELEASE}"
$STD uv pip install --python /opt/vllm/.venv/bin/python --upgrade "vllm==${RELEASE_VERSION}"
msg_ok "Updated ${APP} to ${RELEASE}"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you directly resovle the $app var

Comment thread ct/vllm.sh
Comment on lines +63 to +64
echo -e "${INFO}${YW} Swagger docs:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8000/docs${CL}"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those probably don't need an extra info, as /docs is pretty much the standard and the api probably also not.

Comment thread install/vllm-install.sh

RELEASE=$(get_latest_github_release "vllm-project/vllm")

msg_info "Installing ${APP} v${RELEASE} (Patience — this takes 5-15 minutes)"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolve $app

Comment thread install/vllm-install.sh
msg_info "No GPU detected — installing vLLM with CPU/OpenVINO backend"
$STD uv pip install --python /opt/vllm/.venv/bin/python "vllm==${RELEASE}" --extra-index-url https://download.pytorch.org/whl/cpu
fi
echo "v${RELEASE}" >/opt/vLLM_version.txt

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you do this to ~/.vllm that is where we normally put it.

Comment thread install/vllm-install.sh
Comment on lines +46 to +65
msg_info "Configuring ${APP}"
mkdir -p /etc/vllm /opt/vllm-models
cat <<EOF >/etc/vllm/vllm.env
# Set MODEL to a Hugging Face model ID before starting the service.
# Example (small, ungated): Qwen/Qwen2.5-0.5B-Instruct
# Example (medium): Qwen/Qwen2.5-7B-Instruct
# Example (gated): meta-llama/Llama-3.1-8B-Instruct (requires HF_TOKEN)
MODEL="Qwen/Qwen2.5-0.5B-Instruct"
HOST="0.0.0.0"
PORT="8000"
GPU_MEM_UTIL="0.90"
MAX_MODEL_LEN="4096"
TENSOR_PARALLEL_SIZE="1"
QUANTIZATION=""
# HF_TOKEN=""
HF_HOME="/opt/vllm-models"
EOF
msg_ok "Configured ${APP}"

msg_info "Creating vLLM Server Wrapper"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
msg_info "Configuring ${APP}"
mkdir -p /etc/vllm /opt/vllm-models
cat <<EOF >/etc/vllm/vllm.env
# Set MODEL to a Hugging Face model ID before starting the service.
# Example (small, ungated): Qwen/Qwen2.5-0.5B-Instruct
# Example (medium): Qwen/Qwen2.5-7B-Instruct
# Example (gated): meta-llama/Llama-3.1-8B-Instruct (requires HF_TOKEN)
MODEL="Qwen/Qwen2.5-0.5B-Instruct"
HOST="0.0.0.0"
PORT="8000"
GPU_MEM_UTIL="0.90"
MAX_MODEL_LEN="4096"
TENSOR_PARALLEL_SIZE="1"
QUANTIZATION=""
# HF_TOKEN=""
HF_HOME="/opt/vllm-models"
EOF
msg_ok "Configured ${APP}"
msg_info "Creating vLLM Server Wrapper"
msg_info "Configuring ${APP}"
mkdir -p /etc/vllm /opt/vllm-models
cat <<EOF >/etc/vllm/vllm.env
# Set MODEL to a Hugging Face model ID before starting the service.
# Example (small, ungated): Qwen/Qwen2.5-0.5B-Instruct
# Example (medium): Qwen/Qwen2.5-7B-Instruct
# Example (gated): meta-llama/Llama-3.1-8B-Instruct (requires HF_TOKEN)
MODEL="Qwen/Qwen2.5-0.5B-Instruct"
HOST="0.0.0.0"
PORT="8000"
GPU_MEM_UTIL="0.90"
MAX_MODEL_LEN="4096"
TENSOR_PARALLEL_SIZE="1"
QUANTIZATION=""
# HF_TOKEN=""
HF_HOME="/opt/vllm-models"
EOF

No extra msg block needed for such short actions

Comment thread json/vllm.json
"interface_port": 8000,
"documentation": "https://docs.vllm.ai",
"website": "https://github.com/vllm-project/vllm",
"logo": "https://raw.githubusercontent.com/vllm-project/vllm/main/docs/source/assets/logos/vllm-logo-text-light.png",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utilize one from selfh.st/icons

Comment thread json/vllm.json
"cpu": 4,
"ram": 8192,
"hdd": 40,
"os": "Ubuntu",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is ubuntu preferrable from debian in any way?
because of drivers?

Comment thread json/vllm.json
},
"notes": [
{
"text": "GPU passthrough requires a privileged LXC container with NVIDIA drivers installed on the Proxmox host. Edit /etc/vllm/vllm.env to configure model and settings before starting the service.",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is just wrong, it does not need to be priviledged for gpu passthrough

@github-actions github-actions Bot added the stale label May 28, 2026
@MickLesk

MickLesk commented Jun 1, 2026

Copy link
Copy Markdown
Member

no feedback, stale pr / closed

@MickLesk MickLesk closed this Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants