Skip to content

FEATURE_REQUEST: services[].profiles in stacker.yml schema (compose profiles passthrough) #300

Open

Description

@vsilent

Summary

stacker.yml's services: schema has no profiles field, so profile gating
is lost when Stacker generates .stacker/docker-compose.yml. Services that
upstream compose treats as optional variants (e.g. GPU builds) always end up
in the generated compose and are always started — which breaks deploys on
hosts where those variants cannot run.

Background

Docker Compose profiles mark services as opt-in:

services:
  ollama-cpu:            # no profiles -> starts by default
    image: ollama/ollama:0.40.4
  ollama-gpu-amd:
    image: ollama/ollama:0.40.4-rocm
    profiles: [gpu-amd]  # started only with COMPOSE_PROFILES=gpu-amd
    devices: [/dev/kfd, /dev/dri]

Upstream coleam00/local-ai-packaged uses exactly this to ship three Ollama
variants (cpu / gpu-nvidia / gpu-amd) in one compose file.

Motivating failure

Deploying the local-ai-packaged stack to a CPU-only host aborts the whole
docker compose up:

Error response from daemon: error gathering device information while adding
custom device "/dev/kfd": no such file or directory

One service (ollama-gpu-amd) failing on a missing device kills the entire
compose up — half the containers stay Created, the deployment is marked
paused [local_exec_provisioner_error] (cloud path) or paused [internal_error] (server path). Seen in deployments #1382, #1383, #1385
(2026-10-16 / 2026-10-19). COMPOSE_PROFILES= in .env cannot help because
the generated compose contains no profiles: keys to activate.

Proposal

Add profiles to the stacker.yml service schema and pass it through:

  1. ServiceDefinition (src/cli/config_parser.rs): pub profiles: Vec<String>
    (default empty).
  2. ComposeService (src/cli/generator/compose.rs): emit profiles: when
    non-empty (same pattern as cap_add / devices).
  3. Validate & tests: accepted by stacker config validate; generator test
    asserting the emitted compose block; omitted field behaves exactly as
    today.

Example:

services:
  - name: ollama-gpu-amd
    image: ollama/ollama:0.40.4-rocm
    profiles: ["gpu-amd"]
    devices: ["/dev/kfd", "/dev/dri"]

Related gap (same class)

ComposeService already has user (and shm_size) but ServiceDefinition
cannot express them, so services[].user: root (e.g. the surrealdb volume
ownership workaround in open-notebook) is likewise impossible from
stacker.yml. Worth adding in the same pass.

Workarounds today

None inside the schema. Templates must either drop optional variants
(feature loss) or replace devices: with privileged: true (broader device
access than intended).

Activity

  1. vsilent commented on Oct 19, 2026

    @vsilent
    CollaboratorAuthor

    Update (2026-10-19): profiles already landed — this request is resolved

    Closing the loop for future readers:

    • services[].profiles support merged in PR Feature/service runtime fields #288 (dev, 2026-10-15) and
      reached main via Dev #298 (2026-10-19). Both the parser
      (ServiceDefinition.profiles) and the compose generator emit it.
    • The motivating local-ai-packaged template already declares
      profiles: [gpu-amd] / [gpu-nvidia] on the Ollama GPU variants.
    • The CPU-host failures (/dev/kfd aborting the whole docker compose up,
      deployments #1382/#1383/#1385 in the templates repo) were caused by
      deploying with a pre-Feature/service runtime fields #288 CLI build that silently dropped the unknown
      profiles key
      , which made the GPU variant start unconditionally. The
      baked snapshot from 2026-10-15 was produced with the same old code and
      likely carries the same problem.

    Still open (split into separate tickets)

    1. services[].user and services[].shm_size — the compose generator
      (ComposeService) already supports both, but the stacker.yml schema
      cannot express them (e.g. user: root needed for root-owned volume
      workarounds). → FEATURE_REQUEST: services[].user and services[].shm_size in stacker.yml schema #302
    2. Unknown keys in services[] are ignored silently — that is exactly how
      profiles disappeared without an error. At minimum this needs a warning.
      → FEATURE_REQUEST: warn on unknown keys in services[] (silent config drops) #303
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FEATURE_REQUESTFeature request for the Stacker platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions