Skip to content

[Epic] Docker Compose Topology Domain Model Refactoring #287

Description

@josecelano

Overview

This epic tracks the implementation of the Docker Compose Topology Domain Model refactoring, moving topology logic from Tera templates to the Rust domain layer.

Refactoring Plan Reference

From docs/refactors/plans/docker-compose-topology-domain-model.md:

> This refactoring plan addresses architectural issues in the docker-compose template rendering where infrastructure topology rules (networks, volumes, dependencies) are scattered between Rust code and Tera templates. The goal is to move all topology decisions to the domain layer, enforcing invariants and making the template a pure rendering layer.

Scope

  • Convert all named volumes to bind mounts (unified ./storage/ directory)
  • Standardize bind mount representation in template context
  • Create domain types for Docker Compose topology (networks, dependencies)
  • Derive global network lists from service configurations (single source of truth)
  • Move topology decision logic from template conditionals to domain layer
  • Enforce invariants like "if a service uses a network, that network must be defined"

Tasks

Implementation follows a multi-phase strategy:

Completed PRs

Phase PR Description Status
ADR #288 Bind Mount Standardization ADR ✅ Merged
Phase 1 #290 Convert named volumes to bind mounts ✅ Merged
Phase 2 #292 Create Network domain type ✅ Merged
Phase 3 #299 Create DockerComposeTopology aggregate ✅ Merged
Phase 4 #303 Extract ServiceTopology shared type ✅ Merged

PR Dependencies

PR 1 (ADR-01)
    │
    ▼
PR 2 (Phase 1 - Bind Mounts)
    │
    ▼
PR 3 (Phase 2 - Network Type)
    │
    ▼
PR 4 (Phase 3 - DockerComposeTopology)
    │
    ▼
PR 5 (Phase 4 - ServiceTopology Extract)
    │
    ▼
PR 6 (Phase 5 - Final Cleanup)

Key Decisions

  • Use bind mounts exclusively (9 reasons documented in ADR task)
  • Type-safe MountOption enum (ReadOnly, SELinux)
  • Domain-driven network derivation (single source of truth)
  • ~47 domain rules identified with test specifications
  • ServiceTopology extracted as shared domain type for reuse

Related

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions