Skip to content

refactor(docker): move common, auth and telemetry env into env/docker - #21824

Open
devashish2203 wants to merge 5 commits into
pfp-8944-dev-env-modefrom
pfp-8941-env-anchors-common
Open

devashish2203 wants to merge 5 commits into
pfp-8944-dev-env-modefrom
pfp-8941-env-anchors-common

Conversation

@devashish2203

@devashish2203 devashish2203 commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

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 sees env_file values.
  • DATAHUB_SYSTEM_CLIENT_SECRET: every service that shares it keeps the same value, since the mae client secret cannot move yet (below).
  • DATAHUB_SERVER_TYPE on gms and mce (quickstart, or dev on 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.md now 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-consumers has 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-cdc has none, so it reuses the quickstart env_file list 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 bare and shell scenarios, and for the smoke, ai (both providers) and zdu (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 (profile quickstart-consumers) and quickstartDebug (profile debug), rendered with the env those tasks set: per-service environment identical.
  • ./gradlew :docker:generateQuickstartComposeConfig: no diff in docker/quickstart/, and no env_file key.
  • 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 new env/docker/variants/debug/ files for debug services.
  • Debug system-update and mae-consumer services now list the variants/debug files explicitly.
  • Two uneven telemetry and client-secret configs stay in environment:, marked Cleanup:.
  • datahub-upgrade.sh now skips ${...} lines when passing system-update.env to docker 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.md now 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.

Written for commit 28dd125. Summary will update on new commits.

View guided diff Turn on auto-fix

Move the common, authentication and telemetry values out of the
docker/profiles compose anchors into env/docker layer files:

- DATAHUB_BASE_PATH and DATAHUB_GMS_BASE_PATH go to the system-update,
  gms, mae-consumer, mce-consumer and frontend service files.
- DATAHUB_SYSTEM_CLIENT_SECRET goes to the system-update, gms,
  mce-consumer and frontend service files.
- The telemetry and usage aggregation keys go to the gms and
  mce-consumer service files, and to env/docker/variants/debug/ for the
  debug system-update and mae-consumer services, which are the only
  services of those kinds that had them.

The rendered compose config is unchanged in every scenario. Keys stay in
environment: where moving them would change a value: the token secrets,
DATAHUB_SERVER_TYPE on gms and mce (a later env file's ${KEY:-default}
resolves against values earlier files set, so a variant cannot change
that default), and the irregular mae client secret and telemetry, marked
for cleanup.

datahub-upgrade.sh passes system-update.env to docker run, which does
not interpolate, so it now skips lines that contain ${.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the devops PR or Issue related to DataHub backend & deployment label Dec 2, 2026
@cursor

cursor Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

PR Summary

Overview
Relocates shared Docker env (base paths, client secret, telemetry/usage aggregation) from docker/profiles compose anchors into env/docker service layers, with env/docker/variants/debug/ supplying dev telemetry for debug system-update and MAE only.

Compose environment: still carries keys where moving them would change precedence or cross-references: token secrets, DATAHUB_SERVER_TYPE on GMS/MCE (later env_file lines cannot override an earlier ${KEY:-default}), and a few uneven quickstart MAE/MCE blocks left as Cleanup: comments. Debug system-update/MAE get explicit env_file lists that include the new variant files.

datahub-upgrade.sh and its README now pass system-update.env through grep -v '${' so docker run --env-file does not receive unexpanded Compose placeholders. env/README.md documents variant env layering and the compose default-resolution rule.

Reviewed by Cursor Bugbot for commit 1b6c7f6. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d999884. Configure here.

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 12 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread docker/datahub-upgrade/README.md Resolved
Comment thread docker/profiles/docker-compose.gms.yml Resolved
Comment thread docker/profiles/docker-compose.gms.yml Resolved
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Smart test selection

pytest smoke tests

Mode: active. Only the selection below runs for the pytest smoke tests on this PR (applied: smart).

  • Selection: smart: tests for the tagged features, plus always-run modules, this PR's changed tests, and the plumbing sample if the PR changes the pytest harness
  • Size: 42 of 853 tests in 1 batch, predicted longest batch ~1 min
  • Tags: change-type: docs; feature-dev: billing-metrics, bootstrap
  • Confidence: MEDIUM (9 changed files)
  • Classifier reasoning: Telemetry and usage aggregation env settings move into per-service env files for billing-metrics, and the system-update env handling changes bootstrap, while the README edits are documentation.

Medium confidence: a wrong tag means tests are skipped, so check the tags above against what this PR touches.

Selected scopes (17 files or classes, 42 tests)
  • tests/e2e/authorization/test_self_entity_auth.py
  • tests/e2e/datapack/test_datapack_smoke.py::TestDatapackCLI
  • tests/e2e/datapack/test_datapack_smoke.py::TestDemoDataBootstrap
  • tests/e2e/datapack/test_datapack_smoke.py::TestShowcaseData
  • tests/e2e/delete/delete_assertion_cascade_test.py
  • tests/e2e/frontend/test_static_asset_encodings.py
  • tests/e2e/mcp/mcp_test.py
  • tests/e2e/metrics/test_metrics.py
  • tests/e2e/metrics/test_queue_ingest_usage.py
  • tests/e2e/metrics/test_usage_aggregation_audit.py::TestUsageAggregationActiveIdentities
  • tests/e2e/metrics/test_usage_aggregation_audit.py::TestUsageAggregationAdminSessions
  • tests/e2e/metrics/test_usage_aggregation_audit.py::TestUsageAggregationByteMetrics
  • tests/e2e/metrics/test_usage_aggregation_audit.py::TestUsageAggregationGraphqlOutputDedup
  • tests/e2e/metrics/test_usage_aggregation_audit.py::TestUsageAggregationPatTraffic
  • tests/e2e/object_storage/test_object_storage.py
  • tests/e2e/read_only/test_services_up.py
  • tests/e2e/search/test_search_projection.py::TestSearchProjection

Add the run-all-tests:pytest label to run the full pytest suite on this PR.

Playwright E2E tests

This run: p0

  • Selection: p0: no spec is tagged billing-metrics, bootstrap, so P0 tests plus the tests the change affects
  • Size: 145 tests in 79 spec files, ~32 min predicted on 4 shard(s)
  • Baseline: 79 spec files run for every PR (@p0)
  • No spec was selected because of this PR's changes.

Add the run-all-tests:playwright label to run the full Playwright suite on this PR.

commit 28dd125 · workflow run

@codecov

codecov Bot commented Dec 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

devashish2203 and others added 2 commits December 3, 2026 15:03
Other compose values interpolate DATAHUB_BASE_PATH and DATAHUB_GMS_BASE_PATH
(PLAY_HTTP_CONTEXT, the schema registry URLs, the AI service's GMS URL), and
interpolation never sees env_file values, so a layer file that set a base path
would split the config. The system client secret goes back to the shared auth
anchor so every service that uses it resolves the same value.

datahub-upgrade.sh now fails before pulling when system-update.env is
missing, and the README's docker run examples skip the ${...} lines as the
script does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
Preview — 28dd1250 Deployed Dec 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devops PR or Issue related to DataHub backend & deployment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant