Repository navigation
build(compose): make grafana port, root URL and datasource configurable - #9207
Merged
Merged
Conversation
Follow-up to apache#9090, same `${VAR:-default}` pattern. The grafana service in `docker-compose-dev-{mysql,postgresql}.yml` hard-codes its host port, its public root URL and the database it reads from, so running both stacks side by side, putting Grafana behind a different proxy URL, or pointing the dashboards at an existing database requires editing tracked files. - `GRAFANA_HOST_PORT` (default 3001 / 3002) for the published port. - `GRAFANA_ROOT_URL` for `GF_SERVER_ROOT_URL`. - `GRAFANA_DATABASE_{TYPE,HOST,PORT,NAME,USER,PASSWORD}` for the `DATABASE_*` variables read by `grafana/scripts/entrypoint.sh`. - The legacy `MYSQL_*` / `POSTGRES_*` variables are derived from the same values so dashboard images that predate the `DATABASE_*` entrypoint (e.g. an older tag pulled via `DEVLAKE_IMAGE_REGISTRY`) get a consistent datasource. The current entrypoint overwrites them from `DATABASE_*`, so they are inert there. - `env.example` documents the variables, commented out like `DEVLAKE_IMAGE_REGISTRY`, because the services read `.env` via `env_file`. With none of the variables set, `docker compose config` renders the same values as before; the only addition is the four legacy variables. Signed-off-by: DoDiODev <DoDiDev@proton.me>
klesh
approved these changes
Oct 14, 2026
klesh
left a comment
Contributor
There was a problem hiding this comment.
LGTM.
Thank you for your contribution.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #9090 using the same
${VAR:-default}pattern. Thegrafanaservice indocker-compose-dev-{mysql,postgresql}.ymlhard-codes its host port, its public root URL and the database it reads from. Running both dev stacks side by side, serving Grafana behind a different proxy URL, or pointing the dashboards at an existing database currently requires editing tracked files.Changes
GRAFANA_HOST_PORT3001/3002GRAFANA_ROOT_URLGF_SERVER_ROOT_URLhttp://localhost:4001/grafana/http://localhost:4000/grafanaGRAFANA_DATABASE_TYPEDATABASE_TYPEmysql/postgresqlGRAFANA_DATABASE_HOSTDATABASE_HOSTmysql/postgresGRAFANA_DATABASE_PORTDATABASE_PORT3306/5432GRAFANA_DATABASE_NAME/_USER/_PASSWORDDATABASE_NAME/_USER/_PASSWORDlake/merico/mericoMYSQL_*/POSTGRES_*variables are derived from the same values, so dashboard images that predate theDATABASE_*handling ingrafana/scripts/entrypoint.sh(e.g. an older tag pulled viaDEVLAKE_IMAGE_REGISTRY) get a consistent datasource. The current entrypoint overwrites them fromDATABASE_*, so they are inert there.env.exampledocuments the variables, commented out likeDEVLAKE_IMAGE_REGISTRY, because the services read.envviaenv_file.Verification
docker compose configwith no variables set, compared tomainDATABASE_*and legacy variables followGRAFANA_HOST_PORT=)