Skip to content

[Refactor] Phase 0: Convert volumes to bind mounts with domain type #292

Closed

Description

@josecelano

Overview

This task converts all Docker named volumes to bind mounts and introduces domain types (BindMount, MountOption) to represent volume mounts in a type-safe manner. This is a foundational change that simplifies the architecture by eliminating top-level volume declarations and provides observability into all persistent data via the ./storage/ directory.

Parent Epic: #287

Related:

Goals

  • Convert all named volumes to bind mounts under ./storage/{service}/
  • Remove top-level volumes: section from docker-compose template
  • Create domain types (BindMount, MountOption) for type-safe mount representation
  • Create Ansible playbooks to set correct directory ownership for Grafana and MySQL
  • Update ADR status for grafana-integration-pattern.md (partially superseded)

Scope

Named Volumes to Convert

Service Current Named Volume New Bind Mount Host Path
Caddy caddy_data:/data ./storage/caddy/data:/data ./storage/caddy/data
Caddy caddy_config_vol:/config ./storage/caddy/config:/config ./storage/caddy/config
Grafana grafana_data:/var/lib/grafana ./storage/grafana/data:/var/lib/grafana ./storage/grafana/data
MySQL mysql_data:/var/lib/mysql ./storage/mysql/data:/var/lib/mysql ./storage/mysql/data

Directory Ownership Requirements

Service Container User Required Host Ownership
Grafana 472:472 (grafana) 472:472
MySQL 999:999 (mysql) 999:999

Domain Types

New types in src/domain/deployment/topology/volume.rs:

  • MountOption enum (ReadOnly, SELinux)
  • BindMount struct (host_path, container_path, option)

Implementation Plan

  1. Template Changes: Update docker-compose template (4 volume conversions + remove top-level volumes:)
  2. Ansible Playbooks: Create create-grafana-storage.yml and create-mysql-storage.yml
  3. Domain Types: Create BindMount and MountOption in domain layer
  4. Documentation: Update ADR status

Acceptance Criteria

  • Pre-commit checks pass: ./scripts/pre-commit.sh
  • No named volumes remain in docker-compose template
  • Top-level volumes: section is removed
  • Grafana/MySQL storage playbooks create directories with correct ownership
  • Domain types have unit tests
  • E2E tests pass
  • grafana-integration-pattern.md status updated

Specification

Full specification: docs/issues/292-convert-volumes-to-bind-mounts-with-domain-type.md

Activity

  1. self-assigned this
    on Jan 24, 2026
  2. added 2 commits that reference this issue on Jan 24, 2026
  3. added 3 commits that reference this issue on Jan 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions