Skip to content

feat(docker): run the all-in-one image on DocumentDB instead of MongoDB 4.0.5 - #3734

Open
jordan-simonovski wants to merge 6 commits into
mainfrom
jordansimonovski/documentdb-aio
Open

jordan-simonovski wants to merge 6 commits into
mainfrom
jordansimonovski/documentdb-aio

Conversation

@jordan-simonovski

@jordan-simonovski jordan-simonovski commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The all-in-one image now runs DocumentDB (MIT, Postgres 18) in place of MongoDB 4.0.5. That removes the SSPL licence and the four critical OpenSSL 1.1.1k CVEs that came with the Alpine 3.9 MongoDB packages. It uses the same DocumentDB build that local dev, integration and e2e have run on since #3375.

  • Metadata stays on the /data/db mount the docs tell people to use, now under /data/db/pgdata.
  • The gateway listens on localhost only, because its hyperdx:hyperdx credentials are fixed. The old mongod was also localhost-only.
  • Image size is about the same: 2.47 GB, against 2.49 GB with MongoDB.

Breaking changes

  • Existing all-in-one users start with an empty metadata database after upgrading: users, sources, dashboards, alerts and webhooks. The old MongoDB files stay in /data/db and are not read. The container logs a warning on first boot when it finds them.
  • The changeset carries the one-off migration steps: mongodump with the 4.0 tools, then mongorestore into the new container. They were tested from an image built on main to this branch, and every document and index came across.
  • Helm and Docker Compose deployments are unaffected; they bring their own MongoDB.
Implementation detail
  • The DocumentDB build moves from docker/documentdb/Dockerfile into stages of docker/hyperdx/Dockerfile. The compose db service builds the documentdb target and the all-in-one copies from the same builder, so the two can't drift.
  • Shared libraries are installed with apk from a package list the builder writes, instead of being copied. Copying overwrote the ClickHouse base's musl and libssl with files from another Alpine point release, the same bug as fix(docker): stop clobbering the base image's /usr/lib, and build images on main #3157. apk audit --system is clean in both images.
  • The build runs ldd over Postgres, the gateway and the extensions, and fails if the base image's Alpine release is missing a library.
  • The postgres user is pinned to UID/GID 70, so files on a volume keep the right owner across upgrades.
  • The MongoDB VEX file is gone, since nothing it covered ships any more.
  • Tested locally on arm64: scripts/ci/smoke-all-in-one.sh passes, and the migration was run end to end. amd64 and the auth image were not built locally.

How to reproduce

Starting point: a checkout of this branch with Docker.

On main:

  1. docker run --rm --entrypoint mongod docker.clickhouse.com/clickhouse/clickstack-all-in-one:2 --version prints MongoDB 4.0.5.

On this branch:

  1. Build the image: docker buildx build . -f docker/hyperdx/Dockerfile --target all-in-one-noauth --build-context clickhouse=./docker/clickhouse --build-context otel-collector=./docker/otel-collector --build-context hyperdx=./docker/hyperdx --build-context api=./packages/api --build-context app=./packages/app -t aio:local --load
  2. Run scripts/ci/smoke-all-in-one.sh aio:local. It should print canary ingested end-to-end.
  3. To test the upgrade, run the main image with -v vol:/data/db, then follow the steps in .changeset/aio-documentdb.md.

References


Note

High Risk
Breaking storage and bootstrap behavior for all-in-one upgrades (metadata loss or mandatory migration), plus changes to how the container starts its primary metadata database.

Overview
The all-in-one image replaces bundled MongoDB 4.0.5 with DocumentDB (Postgres 18 + Mongo wire-protocol gateway). Metadata still mounts at /data/db, but Postgres data lives under /data/db/pgdata. The API keeps using Mongoose via a new MONGO_URI (TLS + SCRAM on port 10260), and the gateway is forced to localhost-only in the production bundle.

Breaking for existing volume users: startup fails if legacy Mongo files (WiredTiger) are present unless HYPERDX_ACCEPT_EMPTY_METADATA=true; the changeset documents a one-time mongodump / mongorestore migration path.

Build/CI: DocumentDB moves from docker/documentdb/Dockerfile into docker/hyperdx/Dockerfile (documentdb-builder / documentdb stages) so dev, CI, E2E, and all-in-one share one build; shared libs are installed via apk package lists (avoids cross-Alpine .so overwrites). The OpenSSL–MongoDB VEX file is removed. entrypoint.sh pins postgres UID 70 and fixes volume ownership on boot.

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

…DB 4.0.5

MongoDB 4.0.5 is EOL, SSPL licensed, and comes from Alpine 3.9 packages
that carry OpenSSL 1.1.1k critical CVEs. The all-in-one image now runs
DocumentDB v1.2-0 (MIT, Postgres 18) from the same Dockerfile stage the
dev, integration and e2e stacks use. Metadata stays on the /data/db mount
under /data/db/pgdata; the changeset documents moving old MongoDB data.
@jordan-simonovski
jordan-simonovski requested a review from a team as a code owner November 19, 2026 23:03
@vercel

vercel Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hyperdx-oss Ready Ready Preview Nov 30, 2026 1:08am UTC
hyperdx-storybook Ready Ready Preview Nov 30, 2026 1:08am UTC

Request Review

@changeset-bot

changeset-bot Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9e64f12

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@hyperdx/api Minor
@hyperdx/app Minor
@hyperdx/otel-collector Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added the review/tier-4 Critical — deep review + domain expert sign-off label Nov 19, 2026
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

🔴 Tier 4 — Critical

Touches authentication, tenancy data models, the public API or shipped database config — or substantially changes the query rendering engine, background tasks, the OTel pipeline, image build, or release CI.

Why this tier:

  • Background tasks or delivery pipeline substantially modified — 104 lines (bar: 30):
    • docker/hyperdx/Dockerfile
    • docker/hyperdx/entry.local.base.sh

Review process: Deep review from a domain expert. Synchronous walkthrough may be required.
SLA: Schedule synchronous review within 2 business days.

Stats
  • Production files changed: 8
  • Production lines changed: 317 (+ 5 in test files, excluded from tier calculation)
  • Critical-path lines changed: 104
  • Branch: jordansimonovski/documentdb-aio
  • Author: jordan-simonovski

To override this classification, remove the review/tier-4 label and apply a different review/tier-* label. Manual overrides are preserved on subsequent pushes.

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Duplicate code analysis

No new duplicate code introduced by this PR.


jscpd compared this branch against origin/main
across app, api and common-utils. Only new clones are listed; the codebase
currently holds 108 in total (1.10%).
Run yarn dupes locally to reproduce, or yarn dupes:all for the full picture.

Comment thread docker/hyperdx/Dockerfile
FROM alpine:3.24 AS documentdb
COPY --from=documentdb-builder /out/ /
RUN apk add --no-cache bash openssl su-exec $(cat /etc/documentdb/apk-packages) \
&& addgroup -S -g 70 postgres && adduser -S -u 70 -G postgres -h /var/lib/postgresql postgres \

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.

🔴 P1 — Pinning postgres to UID/GID 70 breaks existing dev DocumentDB volumes

The old docker/documentdb/Dockerfile ran addgroup -S postgres && adduser -S ..., which on alpine:3.24 picks the first free system ID (100 or above), not 70. docker-compose.dev.yml:21 keeps /data/docdb on a host bind mount (.volumes/docdb_dev_<slot>), so a dev who already ran #3375 has a PGDATA full of files owned by the old UID. docker/documentdb/entrypoint.sh:9 (install -d -o postgres ...) only re-owns the top directory. The .documentdb-initialised marker skips initdb, so pg_ctl running as UID 70 gets permission denied on PG_VERSION/global/* and the db container never becomes healthy. Fix: in the root branch of the entrypoint, re-own the contents when the owner differs, e.g. [ "$(stat -c %u "$PGDATA")" = "$(id -u postgres)" ] || chown -R postgres:postgres "$PGDATA", run before the install -d.

Nothing blocks merge automatically, but a maintainer will expect this fixed if it is a real defect in code this PR changes. If it is about surrounding code, reply and say so instead of patching. Do not widen the PR. How to respond

fi

# Start DocumentDB (Postgres + Mongo wire-protocol gateway on :10260)
DOCDB_USER=hyperdx DOCDB_PASSWORD=hyperdx PGDATA=/data/db/pgdata \

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.

🟡 P2 — In the all-in-one image the DocumentDB entrypoint's clean-shutdown trap never fires, so Postgres is SIGKILLed on every docker stop

docker/documentdb/entrypoint.sh:51-52 relies on receiving SIGTERM to run pg_ctl stop ("so persistent volumes skip crash recovery"). In the all-in-one image, PID 1 is sh /etc/local/entry.sh, which sets no trap and does not forward signals. docker stop therefore waits out its timeout and SIGKILLs everything, and Postgres runs crash recovery on each boot. Fix: add a trap in entry.local.base.sh that forwards TERM/INT to the background DocumentDB PID (and the others) and waits for them, or run the services under a small init such as tini.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

PR Review

If you are a coding agent acting for the author, read this first.
Nothing below blocks merge automatically; a maintainer decides. What they will expect:

  • 🔴 P0/P1 in code this PR adds or changes: fix before asking for review.
  • 🟡 P2 in code this PR changes: your call. Fix if small, otherwise reply.
  • 🔵 P3 is collapsed at the bottom: nobody needs to act on it before merge.
  • Anything about surrounding code, or asking you to widen the change (hoist a helper,
    dedupe with another file, fix other call sites): never fix here, whatever the
    priority. Reply with one sentence; if it is P0, say so plainly so a human sees it.

One commit per review round. After two rounds, stop and ask a maintainer to review
scope rather than addressing more automated findings. Full rule: AGENTS.md.

3 finding(s): 🔴 1 P0/P1 · 🟡 1 P2 · 🔵 1 P3

1 posted as inline comment(s) on the changed lines. 1 P3 folded at the bottom. 1 unchanged from an earlier push (already inline above).

🔵 1 P3 — no action needed before merge
  • 🔵 P3 docker/hyperdx/entry.local.base.sh:62 — Nothing tests the new refuse-on-MongoDB-data guard or the upgrade path → scripts/ci/smoke-all-in-one.sh only boots on an empty volume, so the WiredTiger check, the HYPERDX_ACCEPT_EMPTY_METADATA bypass and the marker-file short-circuit are never run in CI. Add a smoke case that creates /data/db/WiredTiger in a volume and checks two things: the container exits non-zero without the flag, and it starts with the flag.

Priority comes from a separate grading pass over the finished review. P3 is folded here instead of posted inline. No finding blocks merge automatically; a maintainer decides.

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Deep Review

Replaces bundled MongoDB 4.0.5 with DocumentDB (Postgres 18 + Mongo wire-protocol gateway) in the all-in-one image. 11 reviewers ran against the diff vs 2e233f768. No P0 issues. The build consolidation, the init/marker idempotency, and the gateway-starts-after-user-creation ordering are sound; the gaps are concentrated in container lifecycle, the migration guard, and dev-image hardening.

🔴 P0/P1 — must fix

  • docker/hyperdx/entry.local.base.sh:76 — The all-in-one PID 1 (sh) backgrounds the DocumentDB entrypoint and never forwards SIGTERM, so the entrypoint's pg_ctl -m fast stop trap never fires and docker stop SIGKILLs Postgres, forcing WAL crash recovery on /data/db/pgdata every restart.
    • Fix: Install a trap in the entrypoint that forwards SIGTERM/SIGINT to the backgrounded DocumentDB process so Postgres shuts down cleanly on docker stop.
    • reliability, previous-comments, adversarial

🟡 P2 — recommended

  • docker/hyperdx/entry.local.base.sh:76 — DocumentDB is started in the background with no readiness gate before the API launches, unlike the explicit ClickHouse wait loop; on a slow first-boot init the API's Mongoose connection can exhaust its timeout and concurrently --kill-others-on-fail tears the container down.
    • Fix: Add a wait loop that blocks until the gateway on db:10260 accepts connections before starting the API, mirroring the existing ClickHouse readiness check.
    • adversarial, reliability, correctness
  • docker/hyperdx/entry.local.base.sh:62 — The old-metadata guard keys only on /data/db/WiredTiger (false-negative for non-default engines or sub-path mounts) and, because it also passes once /data/db/pgdata/.documentdb-initialised exists, a single bypassed empty start is permanent — later boots silently run an empty metadata DB while the old Mongo files sit unread, reopening first-user signup on the auth image.
    • Fix: Base the guard on the continued presence of the old Mongo data rather than the init marker, and broaden detection beyond the single WiredTiger filename.
    • data-migrations, correctness, security, adversarial
  • docker/hyperdx/Dockerfile:271 — The all-in-one forces UseLocalHost: true, but the standalone documentdb stage used by the dev, CI, and e2e compose files applies no such rewrite, so its gateway binds all container interfaces with the fixed hyperdx:hyperdx admin credentials and is reachable by any peer on the compose network.
    • Fix: Apply the UseLocalHost: true rewrite (or an explicit loopback bind) in the documentdb stage, or move it into the shared builder so both consumers inherit it.
    • security, adversarial
🔵 P3 nitpicks (4)
  • docker/hyperdx/Dockerfile:199 — The runtime assembly (apk package list, UID/GID-70 postgres user, entrypoint copy) is duplicated between the documentdb and all-in-one-base stages, so the two can still drift despite sharing the heavy builder.
    • Fix: Factor the pinned UID/GID into a per-stage ARG and add a cross-reference comment (or a CI check) tying the two runtime blocks together.
  • docker/hyperdx/Dockerfile:174 — The sed -i that rewrites the upstream validate_rum_core_exports.sh export filter has no post-edit verification, unlike the sibling UseLocalHost sed which is immediately grep-guarded.
    • Fix: Follow the sed with a grep -q on the expected result so a moved upstream target fails at the patch site rather than deep in the build.
  • .changeset/aio-documentdb.md:2 — The changeset lists only @hyperdx/api, though the all-in-one image also bundles @hyperdx/app, whereas the comparable image-only precedent lists both; the fixed version group bumps all three regardless, so only the @hyperdx/app changelog note is lost.
    • Fix: Add @hyperdx/app to the changeset frontmatter to match the image-change precedent.
  • docker/hyperdx/Dockerfile:304 — The all-in-one HEALTHCHECK probes only the app /health liveness endpoint, so a dead or unauthenticated DocumentDB still reports healthy (pre-existing posture; a metadata-backed /ready endpoint already exists).
    • Fix: Have the healthcheck (or the smoke test) hit the metadata-backed readiness path so a DB failure surfaces as unhealthy.

Reviewers (11): correctness, testing, maintainability, project-standards, agent-native, learnings, security, reliability, data-migrations, adversarial, previous-comments.

Testing gaps:

  • The migration guard's blocking and HYPERDX_ACCEPT_EMPTY_METADATA=true bypass branches have no automated coverage — CI only ever boots on a fresh volume where the guard is a no-op.
  • The documented mongodump (4.0) → mongorestore (7.0) migration round-trip through the gateway is never exercised in CI, so the release-note procedure is unverified end-to-end.
  • scripts/ci/smoke-all-in-one.sh asserts only app liveness and ClickHouse ingest; it never touches the metadata store, so a DocumentDB that fails to start or authenticate passes every gate.
  • No test covers clean docker stop shutdown or cold first-boot API-vs-DocumentDB startup timing.

No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

E2E Test Results

✅ All tests passed • 479 passed • 1 skipped • 1050s

Status Count
✅ Passed 479
❌ Failed 0
⚠️ Flaky 12
⏭️ Skipped 1

Tests ran across 4 shards in parallel.

View full report →

…mentdb-aio

# Conflicts:
#	docker/hyperdx/Dockerfile
Comment thread docker/hyperdx/entry.local.base.sh Outdated
# Start Mongo Server
mongod --quiet --dbpath /data/db > /var/log/mongod.log 2>&1 &
# Images before DocumentDB kept MongoDB data directly in /data/db, which this image cannot read.
if [ -f /data/db/WiredTiger ] && [ ! -f /data/db/pgdata/.documentdb-initialised ]; then

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.

🔴 P1 — Upgrading an auth all-in-one install silently starts with an empty database, so the first visitor can register and take over

When the container finds /data/db/WiredTiger but no .documentdb-initialised marker, it should refuse to start, for example by exiting non-zero with the migration steps, unless the user opts in with something like HYPERDX_ACCEPT_EMPTY_METADATA=1. Right now it prints a warning and carries on. With no team, POST /register/password in packages/api/src/routers/api/root.ts:94 accepts a signup again, so on an exposed auth image the first person to reach :8080 becomes the team owner. The warning also only prints once, because the marker exists after the first boot. The image ships under the floating :2 tag and the changeset is only a minor bump, so users who pull :2 will hit this without choosing to upgrade.

Nothing blocks merge automatically, but a maintainer will expect this fixed if it is a real defect in code this PR changes. If it is about surrounding code, reply and say so instead of patching. Do not widen the PR. How to respond

@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.

Stale Bugbot comment from a previous run.

Comment thread docker/hyperdx/Dockerfile Resolved
# Start DocumentDB (Postgres + Mongo wire-protocol gateway on :10260)
DOCDB_USER=hyperdx DOCDB_PASSWORD=hyperdx PGDATA=/data/db/pgdata \
PATH="/usr/libexec/postgresql18:$PATH" \
bash /usr/local/bin/documentdb-entrypoint.sh > /var/log/documentdb.log 2>&1 &

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Postgres killed uncleanly on container stop

Medium Severity

The DocumentDB entrypoint trap that runs pg_ctl -m fast stop never runs in the all-in-one image. The script is started in the background, and PID 1 (entry.local.base.sh) does not forward SIGTERM. docker stop therefore SIGKILLs Postgres, so the /data/db/pgdata volume needs crash recovery on every restart and can be left inconsistent if a write was in flight.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8b60457. Configure here.

…ld dev PGDATA

An auth all-in-one image upgraded onto a /data/db volume with MongoDB data
started empty, so the first visitor could register as team owner. It now
exits unless HYPERDX_ACCEPT_EMPTY_METADATA=true.

Dev DocumentDB volumes created before postgres was pinned to UID 70 now
get their files re-owned on start instead of failing permission checks.
@@ -0,0 +1,24 @@
---
'@hyperdx/api': minor

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.

🔴 P1 — Breaking all-in-one change ships as a minor bump, so the floating :2 and latest tags pick it up

release.yml (around lines 859–864 and 1052–1057) retags every release as ${IMAGE}:${MAJOR} and latest. The PR description's own repro uses clickstack-all-in-one:2. With a minor changeset, anyone tracking :2 who pulls or restarts gets an image that exits at boot (because of the WiredTiger gate) or, with the opt-in set, starts with an empty metadata database. Either mark this major or publish it under a new image major tag, so existing :2 deployments don't hit the breaking upgrade unannounced.

Nothing blocks merge automatically, but a maintainer will expect this fixed if it is a real defect in code this PR changes. If it is about surrounding code, reply and say so instead of patching. Do not widen the PR. How to respond

A hardlink to a root-owned file planted in PGDATA would otherwise be
chowned to postgres on the next boot.
Comment thread docker/hyperdx/Dockerfile
adduser -S -u ${USER_UID} -G otel otel && \
addgroup -S -g 70 postgres && adduser -S -u 70 -G postgres -h /var/lib/postgresql postgres && \
mkdir -p /data/db && \
! ldd /usr/libexec/postgresql18/postgres /usr/bin/documentdb-gateway /usr/lib/postgresql18/*.so 2>&1 | grep 'Error loading shared library' && \

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.

🟡 P2 — The ldd guard catches missing libraries but not symbol mismatches from an older base Alpine

musl ldd reports a library that exists but is too old as Error relocating ...: symbol not found, the same drift this Dockerfile's own comment at line 233 describes. That output does not contain Error loading shared library, so a ClickHouse base on an older Alpine point release than the 3.24 builder passes the guard and Postgres or the gateway fails at runtime. Match both messages: grep -E 'Error (loading shared library|relocating)'.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

@RoryCrispin

Copy link
Copy Markdown
Member

still no perms :/

@brandon-pereira

brandon-pereira commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

🔴 P1 — Breaking all-in-one change ships as a minor bump, so the floating :2 and latest tags pick it up

release.yml (around lines 859–864 and 1052–1057) retags every release as ${IMAGE}:${MAJOR} and latest. The PR description's own repro uses clickstack-all-in-one:2. With a minor changeset, anyone tracking :2 who pulls or restarts gets an image that exits at boot (because of the WiredTiger gate) or, with the opt-in set, starts with an empty metadata database. Either mark this major or publish it under a new image major tag, so existing :2 deployments don't hit the breaking upgrade unannounced.

Nothing blocks merge automatically, but a maintainer will expect this fixed if it is a real defect in code this PR changes. If it is about surrounding code, reply and say so instead of patching. Do not widen the PR. How to respond

Should this be a major version?

Also, thoughts on automatically migrating in a minor version then remove the migrator in a few releases?

@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 2 potential issues.

There are 3 total unresolved issues (including 1 from previous review).

Fix All in Cursor

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

Reviewed by Cursor Bugbot for commit 9e64f12. Configure here.

@@ -0,0 +1,24 @@
---
'@hyperdx/api': minor
---

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Breaking change shipped as minor bump

High Severity

The changeset marks this as a minor bump of @hyperdx/api, but the all-in-one image now refuses to boot on an existing /data/db volume (or starts empty if HYPERDX_ACCEPT_EMPTY_METADATA=true). Release tagging still promotes every release to :2 and latest, so anyone tracking those tags who pulls or restarts gets a crash loop or an empty metadata database (users, sources, dashboards, alerts).

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 9e64f12. Configure here.

# Start DocumentDB (Postgres + Mongo wire-protocol gateway on :10260)
DOCDB_USER=hyperdx DOCDB_PASSWORD=hyperdx PGDATA=/data/db/pgdata \
PATH="/usr/libexec/postgresql18:$PATH" \
bash /usr/local/bin/documentdb-entrypoint.sh > /var/log/documentdb.log 2>&1 &

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

App starts before DocumentDB is ready

Medium Severity

The entrypoint waits for ClickHouse, then starts the API, app, and alert task, but never waits for the DocumentDB gateway on :10260. First-boot initdb plus CREATE EXTENSION documentdb is much slower than the old mongod, so those processes can run while the gateway is still down. Mongoose retries; connect-mongo (session store) and the alert task may not, so first boot can break sessions or take down concurrently via --kill-others-on-fail.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 9e64f12. Configure here.

This branch was successfully deployed

2 active deployments
Preview – hyperdx-oss — 9e64f12d Deployed Nov 30, 2026 by vercel[bot]
Preview – hyperdx-storybook — 9e64f12d Deployed Nov 30, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review/tier-4 Critical — deep review + domain expert sign-off

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants