Fix Grafana provisioning: bake datasource/dashboard config into custom image
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 <noreply@anthropic.com>
This commit is contained in:
parent
d706d17cc8
commit
fcc745f09d
2 changed files with 9 additions and 2 deletions
|
|
@ -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.
|
||||
|
|
|
|||
5
grafana/Dockerfile
Normal file
5
grafana/Dockerfile
Normal file
|
|
@ -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
|
||||
Loading…
Reference in a new issue