feat(stacks): map host devices into stack containers from the UI (ADR-0030) - #71
Merged
Merged
Conversation
…-0030) Device paths like /dev/dri/renderD128 are host-specific, so they must not live in the product's shared compose file. Store them per (stack, service) in Watchtower instead and render them as a devices: block in the ADR-0012 generated override on every deploy — Compose merges devices: by container path, so entries append to whatever the repository declares and a per-host value can deliberately override a repo default. - StackDeviceMapping entity + stack_device_mappings migration - DeviceMappingPlan: runtime-neutral policy (ADR-0010 seam), warns instead of failing when a mapping names a service the resolved project lacks - ComposeOverrideFile renders devices: after image/environment; unchanged byte-for-byte for stacks with no mappings - stacks.getDevices / stacks.setDevices RPCs; the set is replaced atomically, validated (absolute paths, rwm permissions, duplicate targets) and audit-logged as a host-access grant - Settings-tab "Device mappings" editor riding the existing Save button - Deploy log names every applied device and every skipped mapping
…oy time (ADR-0031) Literal device paths were still one notch too concrete for the GPU case: renderD128 is host-specific, and mapping the node is not enough — the container user must carry the node's owning group, whose GID differs per host. Store a host-neutral per-service intent instead and resolve it on the deploying host. - HostGpuProbe: short-lived helper container (backup helper image) with /dev and /sys bind-mounted read-only; reads each render node's vendor, driver, PCI address and owning GID from sysfs; cached 5 min; failure degrades to "no GPUs" and never fails a deploy - StackGpuMapping entity + stack_gpu_mappings migration; replaced atomically by the same stacks.setDevices call and audit entry - DeviceMappingPlan resolves intents to every mappable node plus supplementary group ids; NVIDIA nodes are skipped with a note (the toolkit, not a device mapping, is the working route); a GPU-less host is a note, not a warning - ComposeOverrideFile renders group_add (quoted GIDs) after devices; Compose appends group_add, so repository entries survive - stacks.hostGpus RPC + Settings-tab "GPU passthrough" editor showing what the probe detected on this host
Owner
Author
|
Second commit adds ADR-0031: "map host GPU(s)" as a per-service intent, resolved by probing the Docker host at deploy time.
Verified live against the dev instance: the probe found Docker Desktop's virtio-gpu render node end to end (helper container → sysfs parse → UI read-out), and the intent round-trips through the Settings save. 1910/1910 tests green, model-changes check clean. |
…ck-ui-71210e # Conflicts: # docs/decisions/README.md
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.
What
Host devices (e.g.
/dev/dri/renderD128for GPU transcoding) can now be mapped into a stack's containers from the stack's Settings tab, without thedevices:key ever appearing in the product's repository compose file.StackDeviceMappingentity +stack_device_mappingsmigration, keyed by compose service name so rows survive redeploys.DeviceMappingPlan— the runtime-neutral policy half (ADR-0010 seam rule, mirroringImagePinPlan): a mapping naming a service the resolved project lacks becomes a deploy-log warning, never a failed deploy.ComposeOverrideFile.Rendergains a third plan and emits adevices:list in Compose'shost:container[:permissions]string form. Compose mergesdevices:by container path, so override entries append to the repo's own. A stack with no mappings renders a byte-identical override to before.stacks.getDevices/stacks.setDevicesRPCs. The set is replaced atomically (thestacks.setEnvshape), validated — absolute paths,rwmpermission subset, duplicate host paths and duplicate container targets refused — and audit-logged, since mapping a host device is a host-access grant.Why
Device paths are host-specific: which render node exists differs per machine, while the compose file is shared by every stack of the product (ADR-0026). Committing them breaks hosts without the device; env-var pass-through still forces the stanza into the repo. The ADR-0012 generated override is the one place that can add them per stack without touching the repository.
Reviewer notes
gpus/CDI (deploy.resources.reservations.devicesis a different mechanism).rpc-schema.jsonis regenerated (154 methods).Testing
DeviceMappingPlanTests+ComposeOverrideFileTestsdevice cases; full suite green (1896/1896).dotnet ef migrations has-pending-model-changesis clean; frontendtsc+ lint clean.