From fcc745f09dcce383a3786ef98beab43669609ab8 Mon Sep 17 00:00:00 2001 From: David Kiania Date: Sat, 11 Apr 2026 22:18:44 +0300 Subject: [PATCH] Fix Grafana provisioning: bake datasource/dashboard config into custom image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Coolify only copies docker-compose.yaml and .env to its working directory — the ./grafana/provisioning bind mount source was always empty on the server, so Grafana started with no datasource or dashboard configured (causing the 'Failed to load home dashboard' error). Fix: build a custom Grafana image (grafana/Dockerfile) that COPYs the provisioning directory at image build time. Grafana substitutes ${GRAFANA_DB_RO_PASSWORD} at startup from the env var now in Coolify's store. Co-Authored-By: Claude Sonnet 4.6 --- docker-compose.yaml | 6 ++++-- grafana/Dockerfile | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 grafana/Dockerfile diff --git a/docker-compose.yaml b/docker-compose.yaml index 1f58276..8f0992b 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -55,7 +55,9 @@ services: retries: 3 grafana: - image: grafana/grafana:11.0.0 + build: + context: ./grafana + dockerfile: Dockerfile restart: always depends_on: timescale_db: @@ -67,7 +69,7 @@ services: - GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH=/etc/grafana/provisioning/dashboards-json/noc_fleet_dashboard.json volumes: - grafana-data:/var/lib/grafana - - ./grafana/provisioning:/etc/grafana/provisioning:ro + # Provisioning is baked into the image via grafana/Dockerfile — no bind mount needed. # COOLIFY DOMAIN LOGIC: # You will set the actual URL in the Coolify UI, # but the service needs to expose port 3000 internally. diff --git a/grafana/Dockerfile b/grafana/Dockerfile new file mode 100644 index 0000000..0680845 --- /dev/null +++ b/grafana/Dockerfile @@ -0,0 +1,5 @@ +FROM grafana/grafana:11.0.0 + +# Bake provisioning files into the image so Coolify bind mounts are not needed. +# Grafana substitutes ${ENV_VAR} references in provisioning files at startup. +COPY provisioning /etc/grafana/provisioning