refactor(docker): share repeated env keys through group files
Stacked on #21839.
Why
Before this stack, a group of keys was one YAML anchor merged into several services. Moving the keys into per-service env files turned each group into N identical copies (134 redundant KEY=value lines under env/docker/). This PR puts each group in one file that the services needing it list in env_file.
What
| File | Keys | Listed by |
|---|---|---|
env/docker/shared/datastore.env | MySQL datasource, schema registry type/URL, OpenSearch implementation + _id hashing, Elasticsearch graph | gms, system-update, mae-consumer, mce-consumer |
env/docker/shared/search.env | ELASTICSEARCH_{HOST,PORT,PROTOCOL,USE_SSL} | the four above + actions |
env/docker/shared/neo4j.env | Neo4j connection | gms, system-update, mae-consumer |
env/docker/shared/indexing.env | reindex flags, timeseries refresh interval | gms, system-update |
env/docker/variants/{postgres,cassandra,neo4j,localstack,onnx}/shared.env | the variant's values (the per-service files were identical) | the services of that variant |
Layer order per service: env/docker/all.env, the service's group files, env/docker/<service>.env, mode files, then per variant variants/<name>/shared.env and variants/<name>/<service>.env. A group file loads before the service file, so the service file still wins. Only identical lines moved; no value changed.
Other readers updated: every compose env_file list (incl. the legacy docker/mysql override), docker/datahub-upgrade/datahub-upgrade.sh (the env_file of its one-service compose file lists the four group files, then system-update.env) and its README, the GMS layer listing in scripts/dev/datahub_dev.py (+ test), and env/README.md (layout, order, group table, where a new value goes).
The GMS/system-update group list must stay in sync in three places: the compose lists, _docker_layer_order in scripts/dev/datahub_dev.py, and datahub-upgrade.sh.
Redundant copies: 134 before, 30 after. Left on purpose: the debug-variant telemetry keys and DATAHUB_TELEMETRY_ENABLED (touched by a separate telemetry change), ZDU_STAGE_10/20 (2-key pair), ES_BULK_REFRESH_POLICY + EXTRACT_JAR_ENABLED (unrelated pair), and single keys shared by odd service sets (DATAHUB_GMS_HOST, KAFKA_BOOTSTRAP_SERVER, ...).
Verification
- Compose env snapshot (bare, shell, smoke, ai scenarios) base vs head: no differences in the rendered compose model. Gradle scenarios need a task not on this branch, so they were not compared.
.github/scripts/check_quickstart_compose.sh: up to date;docker/quickstart/unchanged.smoke-test/check_env_parity.py: rc 0../gradlew :scripts:dev:test: 191 passed.datahub-upgrade.sh(compose-resolved one-service project,docker compose config) and the READMEgrepvariant produce the same 31 keys as before.
Checklist
- The PR conforms to DataHub's Contributing Guideline (PR Title Format)
- Tests for the changes have been added/updated (if applicable)
- Docs related to the changes have been added/updated (if applicable)
- For any breaking change/potential downtime/deprecation/big changes an entry has been made in Breaking Changes (not breaking: no rendered change)
š¤ Generated with Claude Code
Summary by cubic
Restores the rendered compose model while replacing duplicated per-service env keys with shared group files: services list the groups they need in env_file, and shared files load before service files so per-service and variant overrides still win.
Group files
- New
env/docker/shared/holds datastore, search, Neo4j, and indexing groups;datahub-upgrade.shand its README load the same group files in the same order as compose. - Variant values move from per-service files into
variants/<name>/shared.envfor postgres, cassandra, neo4j, localstack, and onnx. - Redundant lines drop from 134 to 30; remaining pairs and odd single keys stay duplicated deliberately.
Keep in sync
- GMS and system-update group lists must match across the compose
env_filelists,_docker_layer_orderinscripts/dev/datahub_dev.py, anddatahub-upgrade.sh.