Problem
When the deployer generates a docker-compose.yml, the Grafana service does not include
GF_SERVER_ROOT_URL. Without it, Grafana defaults to http://localhost:3000 when
generating public dashboard share URLs, making them unreachable externally.
For example, sharing the Tracker Overview dashboard on the Torrust Tracker Demo produced:
http://localhost:3000/public-dashboards/186b355b56cd482d9c441a0affdb8ecd
instead of the correct:
https://grafana.torrust-tracker-demo.com/public-dashboards/186b355b56cd482d9c441a0affdb8ecd
See the Grafana documentation:
Externally shared dashboards
Fix
Follow the existing environment variable injection pattern already used for other
Grafana settings — value in .env, reference in docker-compose.yml.
docker-compose.yml template
grafana:
environment:
- GF_SECURITY_ADMIN_USER=${GF_SECURITY_ADMIN_USER}
- GF_SECURITY_ADMIN_PASSWORD=${GF_SECURITY_ADMIN_PASSWORD}
- GF_SERVER_ROOT_URL=${GF_SERVER_ROOT_URL}
.env template
# Grafana server root URL — used to generate correct public dashboard share links
GF_SERVER_ROOT_URL='https://<grafana-domain>'
The <grafana-domain> value should be derived from the same deployer input that
already defines the Grafana virtual host in the Caddyfile (e.g. grafana.torrust-tracker-demo.com).
Reference
This was discovered and manually patched on the Torrust Tracker Demo:
torrust/torrust-tracker-demo#9
Problem
When the deployer generates a
docker-compose.yml, the Grafana service does not includeGF_SERVER_ROOT_URL. Without it, Grafana defaults tohttp://localhost:3000whengenerating public dashboard share URLs, making them unreachable externally.
For example, sharing the Tracker Overview dashboard on the Torrust Tracker Demo produced:
instead of the correct:
See the Grafana documentation:
Externally shared dashboards
Fix
Follow the existing environment variable injection pattern already used for other
Grafana settings — value in
.env, reference indocker-compose.yml.docker-compose.ymltemplate.envtemplateThe
<grafana-domain>value should be derived from the same deployer input thatalready defines the Grafana virtual host in the Caddyfile (e.g.
grafana.torrust-tracker-demo.com).Reference
This was discovered and manually patched on the Torrust Tracker Demo:
torrust/torrust-tracker-demo#9