Skip to content

refactor(docker): move datastore, graph, search and kafka env into env/docker - #21825

Open
devashish2203 wants to merge 6 commits into
pfp-8941-env-anchors-commonfrom
pfp-8941-env-anchors-datastore
Open

devashish2203 wants to merge 6 commits into
pfp-8941-env-anchors-commonfrom
pfp-8941-env-anchors-datastore

Conversation

@devashish2203

@devashish2203 devashish2203 commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #21824 (step 3a). Moves the primary datastore, graph, search and Kafka values out of the docker/profiles/ compose anchors into env/docker layer files and new variant folders. The rendered compose config is unchanged in every scenario.

Moved keys

Key From anchor To file
EBEAN_DATASOURCE_{USERNAME,PASSWORD,HOST,URL,DRIVER} (MySQL) x-primary-datastore-mysql-env env/docker/{system-update,gms,mae-consumer,mce-consumer}.env
EBEAN_DATASOURCE_* (Postgres), EBEAN_POSTGRES_USE_AWS_IAM_AUTH, DATAHUB_PGQUEUE_ENABLED, DATAHUB_PGQUEUE_MAINTENANCE_CRON_ENABLED x-primary-datastore-postgres-env env/docker/variants/postgres/{system-update,gms,mae-consumer,mce-consumer}.env
CASSANDRA_*, ENTITY_SERVICE_IMPL, plus the inline ZDU_STAGE_20: 'false' x-primary-datastore-cassandra-env env/docker/variants/cassandra/{system-update,gms}.env
GRAPH_SERVICE_IMPL=elasticsearch x-graph-datastore-search-env the four service files
GRAPH_SERVICE_IMPL=neo4j, NEO4J_* x-graph-datastore-neo4j-env env/docker/variants/neo4j/{system-update,gms}.env
ELASTICSEARCH_{HOST,PORT,PROTOCOL,USE_SSL,IMPLEMENTATION,INDEX_DOC_IDS_SCHEMA_FIELD_HASH_ID_ENABLED} x-search-datastore-opensearch-env the four service files
ELASTICSEARCH_{HOST,PORT,PROTOCOL,USE_SSL} x-search-datastore-elasticsearch-env (actions) env/docker/actions.env
KAFKA_BOOTSTRAP_SERVER, SCHEMA_REGISTRY_TYPE x-kafka-env, inline in system-update, frontend, actions service files (frontend and actions already had the same value)

The stale values the service files carried (ELASTICSEARCH_HOST=elasticsearch, GRAPH_SERVICE_IMPL=neo4j, older MySQL URLs) are replaced in place by the effective values. The unused x-search-datastore-search anchor in docker-compose.prerequisites.yml is deleted.

Variant folders

Order in each list: datastore, graph, debug. Compose does not merge lists, so docker-compose.gms.yml defines 12 anchored env_file lists (x-env-files-<service>-<variants>), one per service and variant set.

  • postgres: system-update, gms, mae-consumer and mce-consumer services of the quickstart-postgres* and debug-postgres* profiles.
  • cassandra: system-update and gms of quickstart-cassandra (with neo4j) and debug-cassandra.
  • neo4j: system-update and gms of quickstart-cassandra and debug-neo4j.

No mysql folder is needed. The datasource user and password read DATAHUB_EBEAN_DATASOURCE_ROOT_*, a name no env file sets, so the Postgres variant's default still applies after the MySQL one.

Kept in environment:

  • KAFKA_SCHEMAREGISTRY_URL and the actions SCHEMA_REGISTRY_URL: they interpolate DATAHUB_GMS_BASE_PATH, which stays in environment: too, so both read the same shell value.
  • Per-engine search overrides on the opensearch2, opensearch3 and elasticsearch services: there is no variant folder for search engines.
  • DATAHUB_MESSAGING_TRANSPORT: its default differs between postgres (pgqueue) and postgres with CDC (kafka). A later env file cannot change an opt-in default an earlier one set.
  • DATAHUB_SQL_SETUP_ENABLED: 'false' on the Cassandra system-update services: the base environment: value would beat a variant file.

Verification

The env snapshot tool (#21820) ran on this branch and on its base (#21824):

  • bare, shell, smoke, ai, zdu: 71 scenarios, no differences. That includes ad-hoc env files: none of them now wins over a moved key.
  • Gradle: all 27 quickstart_configs keys, including quickstart, quickstartDebug, quickstartPostgres and quickstartCassandra, rendered with the env and arguments that :docker:printComposeSettings (from ci(docker): add compose env snapshot tool and checks #21820) reports. No differences. quickstartDebugSearchSplit does not render on either side, because its override file is not in the repo.
  • ./gradlew :docker:generateQuickstartComposeConfig produces no diff, and the generated file has no env_file key.
  • smoke-test/check_env_parity.py: exit 0.
  • datahub-upgrade.sh -u SystemUpdate against a running local stack: the upgrade job ran and succeeded.

Legacy consumers

These read the env files directly and now get the profile values instead of stale ones. The old values pointed at hosts the profile stacks do not run.

  • docker/datahub-upgrade/datahub-upgrade.sh (env/docker/system-update.env): the script no longer uses docker run --env-file, which passes ${...} literally. It pipes a one-service compose file, with env_file: ../../env/docker/system-update.env, into docker compose ... -f - run --rm -T upgrade. Compose resolves ${KEY:-default} and ${KEY} from the shell, as it does for the stack's own services, so those lines are no longer skipped. The README explains this; its plain docker run examples still drop those lines. Changed values:
    • EBEAN_DATASOURCE_USERNAME: datahub → root
    • EBEAN_DATASOURCE_URL: gains &rewriteBatchedStatements=true&enabledTLSProtocols=TLSv1.2
    • ELASTICSEARCH_HOST: elasticsearch → search
    • GRAPH_SERVICE_IMPL: neo4j → elasticsearch
    • New keys: ELASTICSEARCH_PROTOCOL=http, ELASTICSEARCH_USE_SSL=false, ELASTICSEARCH_IMPLEMENTATION=opensearch, ELASTICSEARCH_INDEX_DOC_IDS_SCHEMA_FIELD_HASH_ID_ENABLED=true, SCHEMA_REGISTRY_TYPE=INTERNAL
    • The ${...} lines from step 3a, which the script skipped before, are now passed with their resolved values.
    • Known limitations, older than this change and not fixed here: run on its own, the script still needs DATAHUB_SYSTEM_CLIENT_SECRET, DATAHUB_TOKEN_SERVICE_SIGNING_KEY and DATAHUB_TOKEN_SERVICE_SALT from the shell, because the env file never carried them; and the image tag uses DATAHUB_VERSION directly, so the script's VERSION default (quickstart) is not applied.
  • docker/mysql/docker-compose.mysql.yml (env/docker/gms.env through compose) gets the same changes: user root, host search, the Elasticsearch graph, and the new search and schema registry keys.

Deferred

  • CDC env: the CDC key sets differ from service to service. A later PR will make them uniform and then move them.
  • LocalStack env: it moves with the cloud keys. Its AWS_REGION only beats the bare AWS_REGION: pass-through through merge order.

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 new tests; verified with the snapshot tool above
  • Docs related to the changes have been added/updated (if applicable): env/README.md, docker/datahub-upgrade/README.md
  • For any breaking change/potential downtime/deprecation/big changes an entry has been made in Breaking Changes: not needed

🤖 Generated with Claude Code


Summary by cubic

Moves datastore, graph, search, and Kafka defaults from Compose anchors into env/docker service files and Postgres, Cassandra, and Neo4j variants, without changing the rendered Compose configuration.

  • datahub-upgrade.sh now runs the job through a one-service docker compose run so ${KEY} and ${KEY:-default} lines in system-update.env resolve from the shell environment; it no longer needs a host perl or drops the placeholders.
  • Schema-registry URLs and profile-specific overrides (search engine, messaging transport, Cassandra SQL setup) stay in environment: where moving them would change value resolution; CDC and LocalStack settings remain there for now.

Written for commit a86f08f. Summary will update on new commits.

View guided diff Turn on auto-fix

…v/docker

Move the primary datastore, graph, search and Kafka values out of the
docker/profiles compose anchors into env/docker layer files:

- The default stack (MySQL, Elasticsearch graph, OpenSearch, Kafka
  bootstrap and schema registry type) goes to the system-update, gms,
  mae-consumer and mce-consumer service files, replacing the stale
  values those files carried. Actions gets its search keys in actions.env.
- New variant folders env/docker/variants/{postgres,cassandra,neo4j}
  hold the other datastores. Services that use them restate their
  env_file list with the variant in place (datastore, graph, debug).

The rendered compose config is unchanged in every scenario. Keys stay in
environment: where an env file would change a value: the schema registry
URLs (they read DATAHUB_GMS_BASE_PATH, which earlier env files set), the
per-engine search overrides, the messaging transport default and the
Cassandra SQL setup flag. CDC and LocalStack env stay for later changes.

datahub-upgrade.sh now resolves ${KEY:-default} and ${KEY} lines of
system-update.env from its own environment instead of skipping them, so
it keeps passing the datasource user and password.

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
Refactors Docker stack configuration so MySQL, OpenSearch search, Elasticsearch graph, and Kafka defaults live in env/docker service files instead of large YAML anchors in docker/profiles/. Postgres, Cassandra, and Neo4j overrides move into new env/docker/variants/* files; profile-specific services in docker-compose.gms.yml now use dedicated anchored env_file lists (Compose does not merge lists), while environment: blocks keep only keys that must share shell interpolation or per-profile overrides (e.g. schema registry URL with DATAHUB_GMS_BASE_PATH, Cassandra DATAHUB_SQL_SETUP_ENABLED).

datahub-upgrade.sh no longer strips ${...} lines for plain docker run; it runs the upgrade image via a one-service docker compose run so system-update.env resolves the same way as the main stack. Docs in env/README.md and docker/datahub-upgrade/README.md describe the variant layer order and env-file behavior.

Default service env values are updated in place (e.g. ELASTICSEARCH_HOST=search, GRAPH_SERVICE_IMPL=elasticsearch, parameterized MySQL credentials), which also affects legacy consumers that read those files directly.

Reviewed by Cursor Bugbot for commit 73951ed. Bugbot is set up for automated code reviews on this repo. 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 20 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
@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: 212 of 853 tests in 1 batch, predicted longest batch ~4 min
  • Tags: change-type: docs; feature-dev: bootstrap, graph-index, mce-mcl-pipeline, search-indexing, zero-downtime-upgrade; feature-user: search; technical-layer: ebean-mysql, elasticsearch, kafka-events, spring-config
  • Confidence: MEDIUM (20 changed files)
  • Classifier reasoning: The change reworks Docker and env wiring for datastores, graph, OpenSearch and Kafka across gms, consumers and system-update, so it maps to the bootstrap, graph, consumer, search-indexing and ZDU features, with docs for the README edits.

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

Selected scopes (45 files or classes, 212 tests)
  • tests/e2e/audit_events/audit_events_test.py
  • tests/e2e/authorization/test_self_entity_auth.py
  • tests/e2e/browse/browse_test.py
  • tests/e2e/cli/search_cmd/test_search_cmd.py::TestSearchBasic
  • tests/e2e/cli/search_cmd/test_search_cmd.py::TestSearchDiagnose
  • tests/e2e/cli/search_cmd/test_search_cmd.py::TestSearchDryRun
  • tests/e2e/cli/search_cmd/test_search_cmd.py::TestSearchErrorHandling
  • tests/e2e/cli/search_cmd/test_search_cmd.py::TestSearchFilterCombinations
  • tests/e2e/cli/search_cmd/test_search_cmd.py::TestSearchFiltersByEntityType
  • tests/e2e/cli/search_cmd/test_search_cmd.py::TestSearchFiltersByPlatform
  • tests/e2e/cli/search_cmd/test_search_cmd.py::TestSearchPagination
  • tests/e2e/cli/search_cmd/test_search_cmd.py::TestSearchProjectionLive
  • tests/e2e/cli/search_cmd/test_search_cmd.py::TestSearchWhereFilter
  • 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/delete/delete_test.py
  • tests/e2e/entity_graph_cache/test_entity_graph_cache.py::TestContainer
  • tests/e2e/entity_graph_cache/test_entity_graph_cache.py::TestDomain
  • tests/e2e/entity_graph_cache/test_entity_graph_cache.py::TestGlossary
  • tests/e2e/entity_graph_cache/test_entity_graph_cache.py::TestMembership
  • tests/e2e/frontend/test_static_asset_encodings.py
  • tests/e2e/graph/test_graph_client.py
  • tests/e2e/mcp/mcp_test.py
  • tests/e2e/openapi/v3/test_scroll_relationships.py
  • tests/e2e/pgqueue/test_messaging_operations.py
  • tests/e2e/query_projection/test_query_projection_smoke.py
  • tests/e2e/read_only/test_search.py
  • tests/e2e/read_only/test_services_up.py
  • tests/e2e/search/test_lineage_search_index_fields.py
  • tests/e2e/search/test_search_projection.py::TestSearchProjection
  • tests/e2e/semantic/test_classical_embedding_provider.py::TestClassicalEmbeddingProvider
  • tests/e2e/semantic/test_config_fingerprint.py::TestConfigFingerprint
  • tests/e2e/semantic/test_current_offset_api.py
  • tests/e2e/semantic/test_event_driven_docs.py::TestEventDrivenDocumentIngestion
  • tests/e2e/semantic/test_event_mode_fallback.py::TestEventModeFallback
  • tests/e2e/semantic/test_local_embedding_provider.py::TestLocalEmbeddingProvider
  • tests/e2e/semantic/test_semantic_search.py::TestSemanticSearchWithIngestion
  • tests/e2e/semantic/test_source_type_filtering.py::TestSourceTypeFiltering
  • tests/e2e/semantic/test_stateful_ingestion.py::TestStatefulIngestion
  • tests/e2e/siblings/siblings_search_batching_test.py
  • tests/e2e/test_e2e.py
  • tests/e2e/test_kafka_default_sink.py
  • tests/e2e/test_rapid.py

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

Playwright E2E tests

This run: smart

  • Selection: smart: specs tagged bootstrap, graph-index, mce-mcl-pipeline, search, search-indexing, zero-downtime-upgrade plus the tests the change affects
  • Size: 52 tests in 8 spec files, ~9 min predicted on 2 shard(s)
Specs selected because of this PR (8)
Spec Tests Why
autocomplete-v2/autocomplete.spec.ts 2/2 tagged search
browse-v2/browse-v2.spec.ts 10/10 tagged search
logical-models/physical-children-view.spec.ts 2/2 tagged search
search/query-and-filter-search.spec.ts 10/10 tagged search
search/search-filters.spec.ts 5/5 tagged search
search/search-within-operator.spec.ts 1/1 tagged search
search/search.spec.ts 7/7 tagged search
search/searchv2.spec.ts 15/15 tagged search

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

commit a86f08f · 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
…laceholder resolution

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	docker/datahub-upgrade/datahub-upgrade.sh
#	docker/profiles/docker-compose.gms.yml
devashish2203 and others added 2 commits December 3, 2026 18:53
… datahub-upgrade.sh

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

@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 73951ed. Configure here.

# docker run --env-file passes ${...} literally; a one-service compose project resolves the file
# the way the stack's own compose files do (shell value, else the default).
cd "$DIR" && test -r ../../env/docker/system-update.env && docker pull "${IMAGE}" &&
docker compose --project-name datahub-upgrade --project-directory "$DIR" -f - run --rm -T upgrade "$@" <<EOF

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Compose run swallows upgrade CLI flags

High Severity

docker compose run defines -u as --user, and "$@" is passed after the service name with no -- separator. Callers such as datahub-upgrade.sh -u LoadIndices can have the job flag consumed as a Compose user (or -a rejected as unknown) instead of reaching the upgrade entrypoint, which docker run IMAGE "$@" previously forwarded intact.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 73951ed. Configure here.

@david-leifker david-leifker left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

This branch was successfully deployed

1 active deployment
Preview — a86f08ff 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.

2 participants