refactor(docker): move common, auth and telemetry env into env/docker
Stacked on #21823.
Step 3a of moving the Docker env into the env/ layers: the common, authentication and telemetry values leave the docker/profiles compose anchors and go into env/docker files.
Moved keys
All keep the KEY=${KEY:-default} form, so a shell value still wins.
| Key | From | To |
|---|---|---|
DATAHUB_TELEMETRY_ENABLED, USAGE_AGGREGATION_{ENABLED,FLUSH_INTERVAL_SECONDS,ALIGNMENT_PERIOD_SECONDS,INCLUDE_AGENT_NAME} | quickstart telemetry anchor (gms, mce) | env/docker/{gms,mce-consumer}.env |
The same 5 keys plus DATAHUB_SERVER_TYPE (dev) | dev telemetry anchor (debug system-update, debug mae-consumer) | new env/docker/variants/debug/{system-update,mae-consumer}.env, listed only by the debug services that had them |
The stale copies in env/docker/mce-consumer.env are removed.
Kept in environment:
DATAHUB_TOKEN_SERVICE_SIGNING_KEY,DATAHUB_TOKEN_SERVICE_SALT: the shell or Gradle supplies them.DATAHUB_BASE_PATH,DATAHUB_GMS_BASE_PATH: other compose values interpolate them (PLAY_HTTP_CONTEXT, the schema registry URLs, the AI service's GMS URL), and interpolation never seesenv_filevalues.DATAHUB_SYSTEM_CLIENT_SECRET: every service that shares it keeps the same value, since the mae client secret cannot move yet (below).DATAHUB_SERVER_TYPEon gms and mce (quickstart, ordevon debug services). Compose resolves${KEY:-default}in a later env file against the values that earlier files in the same list set. So a variant file cannot change the default of a key that the service file already sets: the earlier value wins unless the shell sets the key.env/README.mdnow states this rule.- Two irregularities, left untouched on purpose because fixing them would change values. Both are marked
Cleanup:in the compose file:datahub-mae-consumer-quickstart-postgres-consumershas no client secret or token keys, while every other mae service has them.- Telemetry on system-update and mae is uneven. Quickstart system-update and mae quickstart-consumers have none. The two mae postgres quickstart services have the quickstart values.
system-update-debug-postgres-cdchas none, so it reuses the quickstartenv_filelist without the debug variant.
Upgrade script
docker/datahub-upgrade/datahub-upgrade.sh passes env/docker/system-update.env to docker run --env-file, which does not resolve ${...}. The script now skips lines that contain ${, so it gets the same keys as before. The one line that was already passed through literally is now skipped too. docker/datahub-upgrade/README.md notes this.
Verification
- The env snapshot tool (base vs head) shows no differences in the rendered compose model for every profile in the
bareandshellscenarios, and for thesmoke,ai(both providers) andzdu(both topologies) scenarios. No ad-hoc file sets a moved key for a service that reads it, so there are no ad-hoc precedence differences. - Gradle
quickstart(profilequickstart-consumers) andquickstartDebug(profiledebug), rendered with the env those tasks set: per-service environment identical. ./gradlew :docker:generateQuickstartComposeConfig: no diff indocker/quickstart/, and noenv_filekey.smoke-test/check_env_parity.py: exit 0.
Checklist
- The PR conforms to DataHub's Contributing Guideline (PR Title Format)
- Links to related issues (if applicable)
- Tests for the changes have been added/updated (if applicable): no behaviour change; verified by rendered config snapshots
- Docs related to the changes have been added/updated (
env/README.md,docker/datahub-upgrade/README.md) - Breaking changes: none
🤖 Generated with Claude Code
Summary by cubic
Moves the telemetry and usage aggregation values out of the docker/profiles compose anchors and into the env/docker layer files. The rendered compose config is unchanged for every scenario.
The common and authentication keys (DATAHUB_BASE_PATH, DATAHUB_GMS_BASE_PATH, DATAHUB_SYSTEM_CLIENT_SECRET) stay in environment:, because other compose values interpolate them and interpolation never sees env_file values. DATAHUB_SERVER_TYPE also stays, since a later env file's ${KEY:-default} resolves against values earlier files set, so a variant file cannot change that default. The token secrets stay, as the shell or Gradle supplies them.
- Telemetry keys move to
gms.env,mce-consumer.env, and newenv/docker/variants/debug/files for debug services. - Debug system-update and mae-consumer services now list the
variants/debugfiles explicitly. - Two uneven telemetry and client-secret configs stay in
environment:, markedCleanup:. datahub-upgrade.shnow skips${...}lines when passingsystem-update.envtodocker run --env-file(which does not interpolate), and exits before pulling when the file is missing; both READMEs document this.
Migration
- No breaking changes;
env/README.mdnow states that a later env file's${KEY:-default}resolves against values earlier files set, so it cannot change a default already set by the service file.