Overview
Remove dead code from the Docker Compose template that handles an impossible configuration state: Grafana enabled without Prometheus. This template branch can never be executed because environment validation should reject this configuration. The code misleads readers into thinking this is a valid configuration.
Problem
The template has an {%- else %} branch for when Grafana is enabled but Prometheus is NOT:
grafana:
depends_on:
{%- if prometheus %}
prometheus:
condition: service_healthy
{%- else %}
- tracker # <-- This branch handles an INVALID case
{%- endif %}
Why it's a bug
- Grafana requires Prometheus as its data source - it has no purpose without it
- The environment creation should fail validation if
grafana.enabled = true and prometheus.enabled = false
- This template branch can NEVER be reached in valid configurations
- The code is dead code that misleads readers into thinking this is a valid configuration
Goals
Expected Template State After Fix
grafana:
depends_on:
prometheus:
condition: service_healthy
Since Grafana can only exist when Prometheus exists (enforced by validation), no conditional is needed.
Implementation Plan
- Verify Validation - Search codebase for existing validation of Grafana/Prometheus relationship
- Remove Dead Code - Edit
templates/docker-compose/docker-compose.yml.tera to remove the {%- else %} branch
- Verification - Run linters and E2E tests
Acceptance Criteria
Related
Overview
Remove dead code from the Docker Compose template that handles an impossible configuration state: Grafana enabled without Prometheus. This template branch can never be executed because environment validation should reject this configuration. The code misleads readers into thinking this is a valid configuration.
Problem
The template has an
{%- else %}branch for when Grafana is enabled but Prometheus is NOT:Why it's a bug
grafana.enabled = trueandprometheus.enabled = falseGoals
grafana.enabled && !prometheus.enabled{%- else %}branch from the Docker Compose templateExpected Template State After Fix
Since Grafana can only exist when Prometheus exists (enforced by validation), no conditional is needed.
Implementation Plan
templates/docker-compose/docker-compose.yml.terato remove the{%- else %}branchAcceptance Criteria
./scripts/pre-commit.sh{%- else %}branch removed from Grafanadepends_onsectiongrafana.enabled && !prometheus.enabledRelated
docs/issues/XXX-remove-invalid-grafana-without-prometheus-template-branch.md