Skip to content

build(compose): make grafana port, root URL and datasource configurable - #9207

Merged
klesh merged 1 commit into
apache:mainfrom
DoDiODev:pr/wave14-compose-overrides
Oct 14, 2026
Merged

klesh merged 1 commit into
apache:mainfrom
DoDiODev:pr/wave14-compose-overrides

Conversation

@DoDiODev

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #9090 using the 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. 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

Variable Replaces Default (mysql / postgresql)
GRAFANA_HOST_PORT published port 3001 / 3002
GRAFANA_ROOT_URL GF_SERVER_ROOT_URL http://localhost:4001/grafana / http://localhost:4000/grafana
GRAFANA_DATABASE_TYPE DATABASE_TYPE mysql / postgresql
GRAFANA_DATABASE_HOST DATABASE_HOST mysql / postgres
GRAFANA_DATABASE_PORT DATABASE_PORT 3306 / 5432
GRAFANA_DATABASE_NAME / _USER / _PASSWORD DATABASE_NAME / _USER / _PASSWORD lake / merico / merico
  • The legacy MYSQL_* / POSTGRES_* variables are derived from the same values, so dashboard images that predate the DATABASE_* handling in grafana/scripts/entrypoint.sh (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.

Verification

Check Result
docker compose config with no variables set, compared to main ✅ identical except the four added legacy variables
All variables overridden ✅ port, root URL, DATABASE_* and legacy variables follow
Empty value (GRAFANA_HOST_PORT=) ✅ falls back to the default

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 klesh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
Thank you for your contribution.

@klesh
klesh merged commit 9b111a0 into apache:main Oct 14, 2026
7 checks passed
@DoDiODev
DoDiODev deleted the pr/wave14-compose-overrides branch October 14, 2026 10:30
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.

2 participants