[Chore]: Replace Promtail with Grafana Alloy #97

Closed
opened 2026-02-05 23:35:51 +00:00 by egullickson · 2 comments
Owner

Parent Issue

Relates to #95

Summary

Replace the deprecated mvp-promtail container with mvp-alloy using Grafana Alloy. This is the critical fix for the Docker API v1.44 incompatibility error that prevents container log collection.

Root cause: Docker Engine v29 raised minimum API version to 1.44. Promtail 2.9.0 embeds Docker client API v1.42.

Files to Modify

1. docker-compose.yml

Rename service mvp-promtail to mvp-alloy (lines 289-307):

  • Image: grafana/promtail:2.9.0 -> grafana/alloy:v1.12.2
  • Container name: mvp-promtail -> mvp-alloy
  • Config mount: ./config/promtail/config.yml:/etc/promtail/config.yml:ro -> ./config/alloy/config.alloy:/etc/alloy/config.alloy
  • Keep: Docker socket mount (/var/run/docker.sock:/var/run/docker.sock:ro)
  • Keep: Container logs mount (/var/lib/docker/containers:/var/lib/docker/containers:ro)
  • Keep: depends_on: mvp-loki
  • Keep: backend network
  • Update command to: run --server.http.listen-addr=0.0.0.0:12345 --storage.path=/var/lib/alloy/data /etc/alloy/config.alloy

2. Create config/alloy/config.alloy (NEW FILE)

Replace config/promtail/config.yml with Alloy-native configuration:

discovery.docker "containers" {
  host             = "unix:///var/run/docker.sock"
  refresh_interval = "5s"
}

discovery.relabel "containers" {
  targets = discovery.docker.containers.targets
  rule {
    source_labels = ["__meta_docker_container_name"]
    regex         = "/(.*)"
    target_label  = "container"
  }
  rule {
    source_labels = ["__meta_docker_container_label_com_docker_compose_service"]
    target_label  = "service"
  }
}

loki.source.docker "containers" {
  host       = "unix:///var/run/docker.sock"
  targets    = discovery.relabel.containers.output
  forward_to = [loki.write.default.receiver]
}

loki.write "default" {
  endpoint {
    url = "http://mvp-loki:3100/loki/api/v1/push"
  }
}

3. Delete config/promtail/config.yml

Remove the old Promtail configuration directory.

4. .gitea/workflows/production.yaml (line 174)

Update shared services start command:

mvp-postgres mvp-redis mvp-loki mvp-promtail mvp-grafana

Change to:

mvp-postgres mvp-redis mvp-loki mvp-alloy mvp-grafana

Acceptance Criteria

  • mvp-alloy container starts without Docker API version errors
  • Container logs from all 6 application containers appear in Loki
  • Old Promtail config files cleaned up
  • Production workflow updated with new container name

Dependencies

  • Blocked by: Mirror script update (sub-issue 1)
  • Independent of: Loki upgrade, Grafana upgrade, Python upgrade
## Parent Issue Relates to #95 ## Summary Replace the deprecated `mvp-promtail` container with `mvp-alloy` using Grafana Alloy. This is the critical fix for the Docker API v1.44 incompatibility error that prevents container log collection. **Root cause**: Docker Engine v29 raised minimum API version to 1.44. Promtail 2.9.0 embeds Docker client API v1.42. ## Files to Modify ### 1. `docker-compose.yml` **Rename service** `mvp-promtail` to `mvp-alloy` (lines 289-307): - Image: `grafana/promtail:2.9.0` -> `grafana/alloy:v1.12.2` - Container name: `mvp-promtail` -> `mvp-alloy` - Config mount: `./config/promtail/config.yml:/etc/promtail/config.yml:ro` -> `./config/alloy/config.alloy:/etc/alloy/config.alloy` - Keep: Docker socket mount (`/var/run/docker.sock:/var/run/docker.sock:ro`) - Keep: Container logs mount (`/var/lib/docker/containers:/var/lib/docker/containers:ro`) - Keep: `depends_on: mvp-loki` - Keep: backend network - Update command to: `run --server.http.listen-addr=0.0.0.0:12345 --storage.path=/var/lib/alloy/data /etc/alloy/config.alloy` ### 2. Create `config/alloy/config.alloy` (NEW FILE) Replace `config/promtail/config.yml` with Alloy-native configuration: ```alloy discovery.docker "containers" { host = "unix:///var/run/docker.sock" refresh_interval = "5s" } discovery.relabel "containers" { targets = discovery.docker.containers.targets rule { source_labels = ["__meta_docker_container_name"] regex = "/(.*)" target_label = "container" } rule { source_labels = ["__meta_docker_container_label_com_docker_compose_service"] target_label = "service" } } loki.source.docker "containers" { host = "unix:///var/run/docker.sock" targets = discovery.relabel.containers.output forward_to = [loki.write.default.receiver] } loki.write "default" { endpoint { url = "http://mvp-loki:3100/loki/api/v1/push" } } ``` ### 3. Delete `config/promtail/config.yml` Remove the old Promtail configuration directory. ### 4. `.gitea/workflows/production.yaml` (line 174) Update shared services start command: ``` mvp-postgres mvp-redis mvp-loki mvp-promtail mvp-grafana ``` Change to: ``` mvp-postgres mvp-redis mvp-loki mvp-alloy mvp-grafana ``` ## Acceptance Criteria - [ ] `mvp-alloy` container starts without Docker API version errors - [ ] Container logs from all 6 application containers appear in Loki - [ ] Old Promtail config files cleaned up - [ ] Production workflow updated with new container name ## Dependencies - Blocked by: Mirror script update (sub-issue 1) - Independent of: Loki upgrade, Grafana upgrade, Python upgrade
egullickson added the
status
backlog
type
chore
labels 2026-02-05 23:36:32 +00:00
egullickson added
status
in-progress
and removed
status
backlog
labels 2026-02-06 01:02:20 +00:00
Author
Owner

Milestone: Execution Complete

Phase: Execution | Agent: Platform | Status: PASS

Changes Made

M1: docker-compose.yml - Replaced mvp-promtail service with mvp-alloy

  • Image: grafana/promtail:2.9.0 -> grafana/alloy:v1.12.2
  • Container name: mvp-promtail -> mvp-alloy
  • Config mount: config/promtail/config.yml -> config/alloy/config.alloy
  • Command: Alloy run with --server.http.listen-addr=0.0.0.0:12345 and --storage.path=/var/lib/alloy/data
  • Retained: Docker socket, container logs, depends_on mvp-loki, backend network

M2: config/alloy/config.alloy - Created Alloy-native configuration

  • discovery.docker for container auto-discovery via Docker socket
  • discovery.relabel for container name and compose service labels
  • loki.source.docker forwarding to loki.write.default
  • loki.write pushing to http://mvp-loki:3100/loki/api/v1/push

M3: config/promtail/ - Deleted old Promtail configuration directory

M4: .gitea/workflows/production.yaml - Updated shared services start command from mvp-promtail to mvp-alloy

M5: docs/LOGGING.md + CLAUDE.md - Updated all Promtail references to Alloy

Commit

1b20673 - chore: replace Promtail with Grafana Alloy for log collection (refs #97)

Verdict: PASS | Next: Quality review

## Milestone: Execution Complete **Phase**: Execution | **Agent**: Platform | **Status**: PASS ### Changes Made **M1: docker-compose.yml** - Replaced `mvp-promtail` service with `mvp-alloy` - Image: `grafana/promtail:2.9.0` -> `grafana/alloy:v1.12.2` - Container name: `mvp-promtail` -> `mvp-alloy` - Config mount: `config/promtail/config.yml` -> `config/alloy/config.alloy` - Command: Alloy `run` with `--server.http.listen-addr=0.0.0.0:12345` and `--storage.path=/var/lib/alloy/data` - Retained: Docker socket, container logs, depends_on mvp-loki, backend network **M2: config/alloy/config.alloy** - Created Alloy-native configuration - `discovery.docker` for container auto-discovery via Docker socket - `discovery.relabel` for container name and compose service labels - `loki.source.docker` forwarding to `loki.write.default` - `loki.write` pushing to `http://mvp-loki:3100/loki/api/v1/push` **M3: config/promtail/** - Deleted old Promtail configuration directory **M4: .gitea/workflows/production.yaml** - Updated shared services start command from `mvp-promtail` to `mvp-alloy` **M5: docs/LOGGING.md + CLAUDE.md** - Updated all Promtail references to Alloy ### Commit `1b20673` - `chore: replace Promtail with Grafana Alloy for log collection (refs #97)` *Verdict*: PASS | *Next*: Quality review
egullickson added
status
review
and removed
status
in-progress
labels 2026-02-06 01:08:56 +00:00
Author
Owner

QR Review: Post-Implementation

Phase: Review | Agent: Quality | Status: PASS

RULE 0 (CRITICAL) - Production Reliability

  • PASS: No unhandled errors, security issues, or resource exhaustion risks
  • NOTE: Loki version mismatch (docker-compose 2.9.0 vs mirror script 3.6.1) is out of scope per issue spec ("Independent of: Loki upgrade") - separate sub-issue of #95

RULE 1 (HIGH) - Project Conformance

  • PASS: Naming conventions followed (mvp-alloy)
  • PASS: CI/CD production workflow updated correctly
  • PASS: Documentation updated (CLAUDE.md, LOGGING.md)
  • FIXED: Added healthcheck to mvp-alloy (/ready on port 12345)

RULE 2 (SHOULD_FIX) - Structural Quality

  • PASS: Old Promtail config deleted, no dead code
  • PASS: No duplicate logic
  • PASS: Alloy config uses native syntax (not Promtail YAML translated)

PR

#102

Verdict: PASS | Next: Merge PR

## QR Review: Post-Implementation **Phase**: Review | **Agent**: Quality | **Status**: PASS ### RULE 0 (CRITICAL) - Production Reliability - PASS: No unhandled errors, security issues, or resource exhaustion risks - NOTE: Loki version mismatch (docker-compose 2.9.0 vs mirror script 3.6.1) is out of scope per issue spec ("Independent of: Loki upgrade") - separate sub-issue of #95 ### RULE 1 (HIGH) - Project Conformance - PASS: Naming conventions followed (mvp-alloy) - PASS: CI/CD production workflow updated correctly - PASS: Documentation updated (CLAUDE.md, LOGGING.md) - FIXED: Added healthcheck to mvp-alloy (`/ready` on port 12345) ### RULE 2 (SHOULD_FIX) - Structural Quality - PASS: Old Promtail config deleted, no dead code - PASS: No duplicate logic - PASS: Alloy config uses native syntax (not Promtail YAML translated) ### PR https://git.motovaultpro.com/egullickson/motovaultpro/pulls/102 *Verdict*: PASS | *Next*: Merge PR
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: egullickson/motovaultpro#97