Skip to content

feat: [#415] add GF_SERVER_ROOT_URL to Grafana service in generated docker-compose#418

Merged
josecelano merged 2 commits intomainfrom
415-add-gf-server-root-url-to-grafana-docker-compose
Apr 6, 2026
Merged

feat: [#415] add GF_SERVER_ROOT_URL to Grafana service in generated docker-compose#418
josecelano merged 2 commits intomainfrom
415-add-gf-server-root-url-to-grafana-docker-compose

Conversation

@josecelano
Copy link
Copy Markdown
Member

Summary

Closes #415

When the deployer generates a docker-compose.yml, the Grafana service now includes GF_SERVER_ROOT_URL so that public dashboard share links use the correct external URL instead of http://localhost:3000.

Changes

The implementation follows the existing env-var injection pattern (value in .env, reference in docker-compose.yml):

  • templates/docker-compose/.env.tera — emits GF_SERVER_ROOT_URL='<url>' conditionally when a Grafana domain is configured
  • templates/docker-compose/docker-compose.yml.tera — adds - GF_SERVER_ROOT_URL=${GF_SERVER_ROOT_URL} to the Grafana environment: block, conditionally
  • GrafanaServiceContext (infrastructure layer) — computes server_root_url from domain + use_tls_proxy flag: https://<domain> when TLS is enabled, http://<domain> otherwise, None when no domain is set
  • GrafanaServiceConfig / EnvContext (infrastructure layer) — carries server_root_url through to the .env template
  • apply_grafana_env_context (application layer) — derives and passes server_root_url when building the env context

Behaviour

Config GF_SERVER_ROOT_URL emitted
No domain set ❌ omitted
domain set, use_tls_proxy=false http://<domain>
domain set, use_tls_proxy=true https://<domain>

Testing

All existing tests pass (cargo test — 416 tests). Pre-commit checks pass (TORRUST_TD_SKIP_SLOW_TESTS=true ./scripts/pre-commit.sh).

@josecelano josecelano self-assigned this Apr 6, 2026
@josecelano
Copy link
Copy Markdown
Member Author

ACK 8a269d1

@josecelano josecelano merged commit a174f4a into main Apr 6, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add GF_SERVER_ROOT_URL to Grafana service in generated docker-compose

1 participant