Skip to content

ConfigRenderer::render_compose omits top-level volumes: block, breaking services with named volumes (same class as #211) #236

Description

@vsilent

Summary

Same root-cause class as #211 (which was just fixed for networks): the server-side compose renderer emits a volumes: mapping under a service (e.g. postgres_data:/var/lib/postgresql/data) but never emits the corresponding top-level volumes: declaration block, making the generated compose invalid.

Steps to reproduce

  1. Deploy a project with a service that declares a named volume, e.g. miniflux's stacker.yml:
    services:
      - name: postgres
        image: postgres:16-alpine
        volumes:
          - postgres_data:/var/lib/postgresql/data
    volumes:
      postgres_data: {}
  2. stacker deploy --target cloud --key <key> --force-new --watch (completes fine — this uses the CLI-generated compose, not the server-rendered one)
  3. stacker agent deploy-app miniflux --image miniflux/miniflux:latest --force
  4. Fails:
    Error: Agent command '...' failed: Image pull had issues (continuing): ...
    service "postgres" refers to undefined volume postgres_data: invalid compose project (pull_warning)
    

Confirmed via remote compose file

/home/trydirect/project/docker-compose.yml on the target server, freshly rendered at the time of the failing command:

  postgres:
    ...
    volumes:
      - postgres_data:/var/lib/postgresql/data
    networks:
      - default_network
    ...

networks:
  default_network:
    driver: bridge

Note networks: top-level block is present and correct (the #211 fix working as intended) — but there is no top-level volumes: block at all, even though postgres_data is referenced by the service.

Expected

Same fix pattern as #211: the top-level volumes: block should be derived from the named volumes actually referenced by services, so it never diverges from what's referenced.

Environment

  • stacker CLI 0.3.1 (144d1a6)
  • Found immediately after re-verifying Remote compose references undefined network default_network #211 was fixed — the network fix uncovered this sibling bug in the same render path (ConfigRenderer::render_compose), which previously errored out on the network mismatch before ever reaching the volumes-rendering step.
  • Reproduced via stacker-projects/miniflux in trydirect/stacker-project-examples

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions