refactor(docker): move frontend, actions and ai-service env into env/docker

DE
16h ago
+99-59

Stacked on #21827.

Moves the environment: values of the frontend, actions and ai-service compose services into env/docker layer and variant files. The rendered compose config is unchanged in every scenario.

Moved keys

KeyService(s)FromTo
DATAHUB_GMS_HOST, THEME_V2_DEFAULT, PLAY_HTTP_CONTEXT, LOG_AGGREGATOR_ENDPOINT, DATAHUB_AI_SERVICE_URLall frontendfrontend service anchorenv/docker/frontend.env (replaces stale DATAHUB_GMS_HOST line; stale DATAHUB_SECRET line removed)
DATAHUB_ANALYTICS_ENABLEDfrontend debugdev templateenv/docker/variants/debug/frontend.env
ACTIONS_EXTRA_PACKAGES, ACTIONS_CONFIG, SCHEMA_REGISTRY_URLall actionsthree templates + pgQueue anchorenv/docker/actions.env (replaces stale SCHEMA_REGISTRY_URL)
DATAHUB_ACTIONS_SYSTEM_CONFIGS_PATH, PGQUEUE_HOST_PORT, PGQUEUE_DATABASE, PGQUEUE_USERNAME, PGQUEUE_PASSWORD, DATAHUB_PGQUEUE_SCHEMA, DATAHUB_PGQUEUE_TABLE_PREFIX4 non-CDC Postgres actions servicespgQueue anchorenv/docker/variants/postgres/actions.env
DATAHUB_GMS_URL, DATAHUB_AI_MCP_ENABLEDai-serviceai-service anchornew env/docker/ai-service.env (now a required entry)

The debug frontend services and the non-CDC Postgres actions services get their own anchored env_file lists (x-env-files-frontend-debug, x-env-files-actions-postgres) with the variant in place. The postgres-cdc actions services never used pgQueue and keep the base list.

Kept in environment:

  • JAVA_TOOL_OPTIONS (frontend debug): tied to debug port 5002.
  • AWS_PROFILE (bare pass-through) and AWS_SDK_LOAD_CONFIG (actions): tied to the ~/.aws mounts.
  • DATAHUB_AI_PORT: tied to the container port mapping.
  • PYTHONPATH (ai-service dev): tied to the source mounts.
  • DATAHUB_BASE_PATH, DATAHUB_GMS_BASE_PATH, DATAHUB_SYSTEM_CLIENT_SECRET (frontend): the GMS-side services keep them in environment: too, so all read the same shell value.
  • DATAHUB_SECRET (frontend): no env layer or ad-hoc file can replace it with a short legacy value, which stops Play 3 from starting.
  • DATAHUB_AI_TRUSTED_PROXIES (ai-service): only the frontend is trusted to name the client host; no env layer can widen that.

Interpolation: PLAY_HTTP_CONTEXT=${DATAHUB_BASE_PATH:-/} (frontend), SCHEMA_REGISTRY_URL (actions) and DATAHUB_GMS_URL (ai-service) read the base paths, which no file in their lists sets, so they resolve from the shell as the environment: values did.

Verification

Rendered with compose_env_snapshot.py (from #21820) on a clean copy of the base and on this branch, then diffed:

  • bare and shell (every profile), smoke, ai (both embedding variants), zdu: no differences (71 scenarios; debug-frontend is known-broken on the base too).
  • gradle: all 27 quickstart_configs keys, with the print task's docker/build.gradle copied over scratch copies only: no differences (quickstartDebugSearchSplit is known-broken on the base too).
  • Ad-hoc files (smoke-test/test_resources/actions/actions.env, CI ai-gms.env, smoke.common.env, zdu-test.env, spark smoke-gms.env) set none of the moved keys, so no precedence change.
  • ./gradlew :docker:generateQuickstartComposeConfig then git diff --exit-code docker/quickstart/: clean, no env_file key.
  • python3 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): rendered-config snapshot diff, no new tests
  • Docs related to the changes have been added/updated (if applicable): env/README.md
  • For any breaking change/potential downtime/deprecation/big changes an entry has been made in Breaking Changes: not a breaking change

🤖 Generated with Claude Code


Summary by cubic

Moves the environment: values of the frontend, actions, and ai-service compose services into env/docker layer and variant files. The rendered compose config is unchanged in every scenario.

Refactor details

  • Frontend values move to env/docker/frontend.env, replacing its stale DATAHUB_GMS_HOST and DATAHUB_SECRET lines; ai-service values move to the new required env/docker/ai-service.env; actions values move to env/docker/actions.env, with pgQueue values for non-CDC Postgres services in env/docker/variants/postgres/actions.env and the debug analytics default in env/docker/variants/debug/frontend.env.
  • The debug frontend and non-CDC Postgres actions services get variant-aware env_file lists; postgres-cdc actions services keep the base list.
  • Keys tied to a service port or mount (JAVA_TOOL_OPTIONS, AWS_PROFILE/AWS_SDK_LOAD_CONFIG, DATAHUB_AI_PORT, PYTHONPATH) stay in environment:, as do DATAHUB_SECRET and DATAHUB_AI_TRUSTED_PROXIES, which an env layer could otherwise override (a short legacy secret stops Play 3 from starting; a wider trusted-proxies list would trust forwarded hosts from other peers).
  • Rendered configs were diffed against the base branch across all profiles and scenarios with no differences.