When working on projects related to homelab infrastructure patterns, apply this domain knowledge.
Homelab Infrastructure — Domain Knowledge
Proxmox VE (PVE)
NVIDIA GPU Passthrough to LXC Containers
Host setup:
- Blacklist nouveau driver:
echo "blacklist nouveau" > /etc/modprobe.d/blacklist-nouveau.conf
- Install build deps:
apt install dkms pve-headers-$(uname -r)
- Download and install latest NVIDIA driver from download.nvidia.com via DKMS
- Load kernel modules:
nvidia, nvidia_uvm (persist in /etc/modules-load.d/)
Container configuration (/etc/pve/lxc/<CTID>.conf):
lxc.cgroup2.devices.allow: c 195:* rwm # nvidia devices
lxc.cgroup2.devices.allow: c 509:* rwm # nvidia-uvm
lxc.mount.entry: /dev/nvidia0 dev/nvidia0 none bind,optional,create=file
lxc.mount.entry: /dev/nvidiactl dev/nvidiactl none bind,optional,create=file
lxc.mount.entry: /dev/nvidia-uvm dev/nvidia-uvm none bind,optional,create=file
lxc.mount.entry: /dev/nvidia-uvm-tools dev/nvidia-uvm-tools none bind,optional,create=file
- Read device major:minor numbers from host device nodes dynamically.
- Make config idempotent — remove old GPU entries before adding new ones.
Container-side driver install:
- Use
pct push to send the install script into the container.
- Use
pct exec <CTID> to execute it inside.
- Install with
--no-kernel-module flag (userspace libraries only).
- Driver version MUST match the host's kernel module version exactly.
- Detect host version via
nvidia-smi --query-gpu=driver_version --format=csv,noheader.
Proxmox Boot Management
update-initramfs -u -k all — update initramfs for ALL installed kernels.
proxmox-boot-tool refresh — REQUIRED on Proxmox to sync initramfs to EFI System Partition(s).
A plain update-initramfs -u does NOT refresh the actual boot ESP partitions.
-q (quiet) flag may not be valid for all versions of update-initramfs.
LXC Container Management
pct start/stop/restart <CTID> — container lifecycle.
pct push <CTID> <local-path> <container-path> — copy files into container.
pct exec <CTID> -- <command> — run commands inside container.
Home Assistant
Proxmox Integration Entities
Entity naming pattern for Proxmox VE integration:
binary_sensor.pve_<node>_status — running/stopped
sensor.pve_<node>_cpu_usage — CPU percentage
sensor.pve_<node>_memory_usage — memory in GiB
sensor.pve_<node>_disk_usage — disk in GiB
sensor.pve_<node>_max_cpu / max_memory_usage / max_disk_usage
button.pve_<node>_start / stop / restart
- Same pattern for VMs/LXCs:
sensor.pve_<vm_name>_cpu_usage, etc.
Dashboard YAML Structure
- Dashboards can be YAML-based or UI-managed (
.storage/lovelace*).
- For YAML: add
lovelace: section to configuration.yaml.
- Use gauge cards for CPU/memory/disk metrics.
- Use entity cards with conditional visibility for VM/LXC status.
- Group by: Node overview → VMs → LXC Containers.
Configuration Patterns
configuration.yaml splits config via !include directives.
- Automation IDs follow specific format conventions.
- REST sensor naming patterns for external integrations.
- PyScript:
@pyscript_executor for I/O, @service for HA services.
- Secrets referenced via
!secret — never committed.
Jellyfin Plugin Development
Provider Pattern
- Each content type needs: local metadata provider + remote metadata provider + image provider.
Video base type uses ItemLookupInfo directly (no custom lookup info class).
- Implement
IHasLookupInfo<T> for metadata lookup.
IRemoteMetadataProvider<Video, ItemLookupInfo> for remote providers.
ILocalMetadataProvider<Video> for local file-based metadata.
Plugin Architecture
- Entry point → DI registration → controller → service → web UI.
- Data flow:
ILibraryManager → IMediaSourceManager → post-filtering.
- NuGet
ExcludeAssets="runtime" on host framework references (don't bundle host assemblies).
build.yaml manifest must be kept in sync with plugin metadata.
- Dev containers recommended for Jellyfin plugin development.
ComfyUI Custom Nodes
Node Development
- Files follow
nodes_*.py naming convention — auto-discovered on startup.
- Node class needs:
INPUT_TYPES, RETURN_TYPES, FUNCTION, CATEGORY class attributes.
- Category format:
"api node/image/Vendor Name" for API-based nodes.
- Use
sync_op_raw with absolute URLs to bypass Comfy.org auth headers.
- SD WebUI API response:
{"images": ["base64..."], "parameters": {...}, "info": "..."}.
Blueprint Format
- Top level: single "container" node representing a subgraph.
definitions.subgraphs[]: inner nodes, links, inputs, outputs.
- Follow existing patterns (e.g., Gemini Image Captioning) for single-node wrappers.
Remote API Integration (Qualcomm AIC100 / SD WebUI)
- Port 7860 = Gradio / Stable Diffusion WebUI API.
- Key endpoints:
/sdapi/v1/txt2img, /sdapi/v1/img2img, /sdapi/v1/sd-models,
/sdapi/v1/samplers, /sdapi/v1/loras, /sdapi/v1/progress.
- Images returned as base64-encoded strings in response arrays.
- Use RemoteOptions pattern for dynamic dropdown options from API.
WebSocket Integration
- AsyncAPI spec at
/asyncapi.yaml describes all WS channels.
- Key WebSocket channels:
/ws/generate — image generation with per-image streaming progress
/ws/video — video processing with frame-by-frame streaming
/ws/llm — token-by-token LLM output streaming
/ws/progress — global inference progress (0→1) + job updates
/ws/registry — model load/unload change notifications
/ws/jobs/{job_id} — per-job tracking
/ws/queue — queue status changes
- Pattern: create a WS helper module with reusable async connect/send/stream functions.
- Relay progress to ComfyUI via
set_progress during streaming.
- Keep non-streaming nodes (classify, detect, depth, encode) on HTTP.
Proxmox Administration
System Update Scripts
- Pattern: script that updates the host node, then iterates through containers:
pct exec <CTID> -- apt update && apt upgrade -y
- Support skip lists for containers that shouldn't be auto-updated
- Support running per-container
update.sh scripts in home directories
- Use
pct list to enumerate running containers.
Container Troubleshooting
- Container failing to start: check LXC config for invalid mount entries or resource conflicts.
- SSH session dying: check TCP keepalive and
ClientAliveInterval/ClientAliveCountMax in sshd_config.
Drive Health Monitoring
- Use
smartctl for SMART data on physical drives.
- Proxmox shows drive health in the web UI under Disks.
Backup Space Optimization
- Proxmox Backup Server (PBS) supports deduplication and incremental backups.
- Backups only store changes when using PBS (not local vzdump).
BIOS Remote Management
- HP iLO / IPMI for remote BIOS management on server hardware.
Jellyfin Server Administration
Hardware Acceleration (Transcoding)
- GPU passthrough to LXC container required for HW transcoding.
- Configure in Jellyfin Dashboard → Playback → Transcoding.
- Verify with test playback — check ffmpeg logs for hardware codec usage.
- Common issue: container needs matching NVIDIA userspace drivers (see Proxmox GPU section).
Media Troubleshooting
- Playback failures: check ffmpeg codec support and container format compatibility.
- Space issues: use
du -sh to find large directories, consider removing duplicate formats.
- Missing metadata: check file naming conventions and library scan settings.
1---2name: homelab-infra3description: Proxmox GPU passthrough and administration, LXC containers, Home Assistant dashboards, Jellyfin server management, and ComfyUI node development with WebSocket integration4---5
6When working on projects related to homelab infrastructure patterns, apply this domain knowledge.
7
8# Homelab Infrastructure — Domain Knowledge
9
10## Proxmox VE (PVE)
11
12### NVIDIA GPU Passthrough to LXC Containers
13**Host setup:**
141. Blacklist nouveau driver: `echo "blacklist nouveau" > /etc/modprobe.d/blacklist-nouveau.conf`
152. Install build deps: `apt install dkms pve-headers-$(uname -r)`
163. Download and install latest NVIDIA driver from download.nvidia.com via DKMS
174. Load kernel modules: `nvidia`, `nvidia_uvm` (persist in `/etc/modules-load.d/`)
18
19**Container configuration (`/etc/pve/lxc/<CTID>.conf`):**
20```
21lxc.cgroup2.devices.allow: c 195:* rwm # nvidia devices
22lxc.cgroup2.devices.allow: c 509:* rwm # nvidia-uvm
23lxc.mount.entry: /dev/nvidia0 dev/nvidia0 none bind,optional,create=file
24lxc.mount.entry: /dev/nvidiactl dev/nvidiactl none bind,optional,create=file
25lxc.mount.entry: /dev/nvidia-uvm dev/nvidia-uvm none bind,optional,create=file
26lxc.mount.entry: /dev/nvidia-uvm-tools dev/nvidia-uvm-tools none bind,optional,create=file
27```
28- Read device major:minor numbers from host device nodes dynamically.
29- Make config idempotent — remove old GPU entries before adding new ones.
30
31**Container-side driver install:**
32- Use `pct push` to send the install script into the container.
33- Use `pct exec <CTID>` to execute it inside.
34- Install with `--no-kernel-module` flag (userspace libraries only).
35- Driver version MUST match the host's kernel module version exactly.
36- Detect host version via `nvidia-smi --query-gpu=driver_version --format=csv,noheader`.
37
38### Proxmox Boot Management
39- `update-initramfs -u -k all` — update initramfs for ALL installed kernels.
40- `proxmox-boot-tool refresh` — REQUIRED on Proxmox to sync initramfs to EFI System Partition(s).
41 A plain `update-initramfs -u` does NOT refresh the actual boot ESP partitions.
42- `-q` (quiet) flag may not be valid for all versions of `update-initramfs`.
43
44### LXC Container Management
45- `pct start/stop/restart <CTID>` — container lifecycle.
46- `pct push <CTID> <local-path> <container-path>` — copy files into container.
47- `pct exec <CTID> -- <command>` — run commands inside container.
48
49## Home Assistant
50
51### Proxmox Integration Entities
52Entity naming pattern for Proxmox VE integration:
53- `binary_sensor.pve_<node>_status` — running/stopped
54- `sensor.pve_<node>_cpu_usage` — CPU percentage
55- `sensor.pve_<node>_memory_usage` — memory in GiB
56- `sensor.pve_<node>_disk_usage` — disk in GiB
57- `sensor.pve_<node>_max_cpu` / `max_memory_usage` / `max_disk_usage`
58- `button.pve_<node>_start` / `stop` / `restart`
59- Same pattern for VMs/LXCs: `sensor.pve_<vm_name>_cpu_usage`, etc.
60
61### Dashboard YAML Structure
62- Dashboards can be YAML-based or UI-managed (`.storage/lovelace*`).
63- For YAML: add `lovelace:` section to `configuration.yaml`.
64- Use gauge cards for CPU/memory/disk metrics.
65- Use entity cards with conditional visibility for VM/LXC status.
66- Group by: Node overview → VMs → LXC Containers.
67
68### Configuration Patterns
69- `configuration.yaml` splits config via `!include` directives.
70- Automation IDs follow specific format conventions.
71- REST sensor naming patterns for external integrations.
72- PyScript: `@pyscript_executor` for I/O, `@service` for HA services.
73- Secrets referenced via `!secret` — never committed.
74
75## Jellyfin Plugin Development
76
77### Provider Pattern
78- Each content type needs: local metadata provider + remote metadata provider + image provider.
79- `Video` base type uses `ItemLookupInfo` directly (no custom lookup info class).
80- Implement `IHasLookupInfo<T>` for metadata lookup.
81- `IRemoteMetadataProvider<Video, ItemLookupInfo>` for remote providers.
82- `ILocalMetadataProvider<Video>` for local file-based metadata.
83
84### Plugin Architecture
85- Entry point → DI registration → controller → service → web UI.
86- Data flow: `ILibraryManager` → `IMediaSourceManager` → post-filtering.
87- NuGet `ExcludeAssets="runtime"` on host framework references (don't bundle host assemblies).
88- `build.yaml` manifest must be kept in sync with plugin metadata.
89- Dev containers recommended for Jellyfin plugin development.
90
91## ComfyUI Custom Nodes
92
93### Node Development
94- Files follow `nodes_*.py` naming convention — auto-discovered on startup.
95- Node class needs: `INPUT_TYPES`, `RETURN_TYPES`, `FUNCTION`, `CATEGORY` class attributes.
96- Category format: `"api node/image/Vendor Name"` for API-based nodes.
97- Use `sync_op_raw` with absolute URLs to bypass Comfy.org auth headers.
98- SD WebUI API response: `{"images": ["base64..."], "parameters": {...}, "info": "..."}`.
99
100### Blueprint Format
101- Top level: single "container" node representing a subgraph.
102- `definitions.subgraphs[]`: inner nodes, links, inputs, outputs.
103- Follow existing patterns (e.g., Gemini Image Captioning) for single-node wrappers.
104
105### Remote API Integration (Qualcomm AIC100 / SD WebUI)
106- Port 7860 = Gradio / Stable Diffusion WebUI API.
107- Key endpoints: `/sdapi/v1/txt2img`, `/sdapi/v1/img2img`, `/sdapi/v1/sd-models`,
108 `/sdapi/v1/samplers`, `/sdapi/v1/loras`, `/sdapi/v1/progress`.
109- Images returned as base64-encoded strings in response arrays.
110- Use RemoteOptions pattern for dynamic dropdown options from API.
111
112### WebSocket Integration
113- AsyncAPI spec at `/asyncapi.yaml` describes all WS channels.
114- Key WebSocket channels:
115 - `/ws/generate` — image generation with per-image streaming progress
116 - `/ws/video` — video processing with frame-by-frame streaming
117 - `/ws/llm` — token-by-token LLM output streaming
118 - `/ws/progress` — global inference progress (0→1) + job updates
119 - `/ws/registry` — model load/unload change notifications
120 - `/ws/jobs/{job_id}` — per-job tracking
121 - `/ws/queue` — queue status changes
122- Pattern: create a WS helper module with reusable async connect/send/stream functions.
123- Relay progress to ComfyUI via `set_progress` during streaming.
124- Keep non-streaming nodes (classify, detect, depth, encode) on HTTP.
125
126## Proxmox Administration
127
128### System Update Scripts
129- Pattern: script that updates the host node, then iterates through containers:
130 - `pct exec <CTID> -- apt update && apt upgrade -y`
131 - Support skip lists for containers that shouldn't be auto-updated
132 - Support running per-container `update.sh` scripts in home directories
133- Use `pct list` to enumerate running containers.
134
135### Container Troubleshooting
136- Container failing to start: check LXC config for invalid mount entries or resource conflicts.
137- SSH session dying: check TCP keepalive and `ClientAliveInterval`/`ClientAliveCountMax` in sshd_config.
138
139### Drive Health Monitoring
140- Use `smartctl` for SMART data on physical drives.
141- Proxmox shows drive health in the web UI under Disks.
142
143### Backup Space Optimization
144- Proxmox Backup Server (PBS) supports deduplication and incremental backups.
145- Backups only store changes when using PBS (not local vzdump).
146
147### BIOS Remote Management
148- HP iLO / IPMI for remote BIOS management on server hardware.
149
150## Jellyfin Server Administration
151
152### Hardware Acceleration (Transcoding)
153- GPU passthrough to LXC container required for HW transcoding.
154- Configure in Jellyfin Dashboard → Playback → Transcoding.
155- Verify with test playback — check ffmpeg logs for hardware codec usage.
156- Common issue: container needs matching NVIDIA userspace drivers (see Proxmox GPU section).
157
158### Media Troubleshooting
159- Playback failures: check ffmpeg codec support and container format compatibility.
160- Space issues: use `du -sh` to find large directories, consider removing duplicate formats.
161- Missing metadata: check file naming conventions and library scan settings.