Add ZOEKT_INDEXER_INTERNAL_URL env var for Zoekt health relay
What does this merge request do and why?
feat: set ZOEKT_INDEXER_INTERNAL_URL on the Zoekt webserver Procfile entries so the new webserver-to-indexer process health relay works end-to-end in GDK.
The relay is implemented in gitlab-zoekt-indexer!911 (merged) per gitlab-org/gitlab#593552:
- The webserver periodically POSTs process health metrics (mmap, RSS, uptime, restart counts, shards loaded) to the indexer at
<ZOEKT_INDEXER_INTERNAL_URL>/indexer/internal/process_health. - The indexer stores the latest report in memory and includes it under
process_health.webserverin each heartbeat to Rails. Stale reports (>30s old, matchingONLINE_DURATION_THRESHOLD) are omitted.
Why update the GDK Procfile
In production (Kubernetes / Helm chart) the indexer and webserver containers run in the same pod on default ports, so the webserver's default http://localhost:6065 discovery URL works with zero configuration. The GDK is different:
- GDK runs two indexer/webserver pairs on a single host (
indexer-1+webserver-1andindexer-2+webserver-2). - Each indexer listens on a different port (
6080,6081), neither of which is the production default6065. - Without this Procfile change, the webservers would default to
http://localhost:6065, fail to connect (connection refused), and spam WARN logs every 10s. Rails would also see both GDK webservers as perpetually offline because no fresh health reports would ever reach the indexer.
Setting ZOEKT_INDEXER_INTERNAL_URL per webserver in the Procfile points each one at its paired indexer's actual port. After this change:
- Pair 1: webserver-1 →
http://localhost:6080(indexer-1's main port) - Pair 2: webserver-2 →
http://localhost:6081(indexer-2's main port)
This lets developers and reviewers actually exercise and verify the health-relay feature locally in GDK before it ships.
Why only the webserver line sets the env var
The ZOEKT_INDEXER_INTERNAL_URL variable is read only by the webserver; it tells the webserver where to POST its health reports.
The indexer does not read this variable at all. The new POST /indexer/internal/process_health route is just another chi route registered on the indexer's existing HTTP listener (the same listener that serves the indexing API), so the indexer already knows its own address via -listen. There is nothing for it to discover from an env var.
This keeps the design minimal:
- One env var, on one side (the webserver).
- One HTTP listener per indexer (no extra "internal" server, no second port).
- In production, both containers share a pod and the default
http://localhost:6065works with zero configuration. - In GDK, each webserver's env var points at its paired indexer's main port (
6080for pair 1,6081for pair 2).
Defaults & backward compatibility
- Production / Helm chart:
ZOEKT_INDEXER_INTERNAL_URLunset → webserver falls back tohttp://localhost:6065(matchesindexer.listen.port: 6065). No configuration needed. - GDK: Procfile sets the var explicitly per webserver so the two pairs don't collide.
- Opt out: set
ZOEKT_INDEXER_INTERNAL_URL=(empty string) to disable health reporting. The webserver's push loop returns immediately.
This change is backward compatible — existing GDK setups continue to work; only the webserver lines gain a new env var, and the variable is only consumed by the new health-relay code path in gitlab-zoekt-indexer.
Related to: gitlab#593552 Implementation MR: gitlab-zoekt-indexer!911 (merged)
How to set up and validate locally
Note: this GDK MR can be merged independently of gitlab-zoekt-indexer!911 (merged). Until that MR is merged and released, the GDK's
gitlab-zoekt-indexer/binary won't recogniseZOEKT_INDEXER_INTERNAL_URLor expose/indexer/internal/process_health. The env var is harmless when unread, so this Procfile change is safe to land first.
What you can verify here (GDK MR only):
-
Check out this branch of GDK and run
gdk restart. -
Confirm the rendered Procfile contains the env var on both webserver lines:
grep 'gitlab-zoekt-webserver' ~/gdk/ProcfileExpected output (relevant parts):
gitlab-zoekt-webserver-development-1: exec /usr/bin/env ZOEKT_INDEXER_INTERNAL_URL=http://localhost:6080 ... gitlab-zoekt-webserver-development-2: exec /usr/bin/env ZOEKT_INDEXER_INTERNAL_URL=http://localhost:6081 ... -
Confirm both zoekt webserver and indexer processes start cleanly (no Procfile syntax regressions, no crash from the new env var):
gdk status | grep gitlab-zoekt gdk tail gitlab-zoekt-webserver-development-1 # should show normal startup logs gdk tail gitlab-zoekt-indexer-development-1 # should show normal startup logs
Full end-to-end verification of the health relay (push loop, heartbeat integration, Rails-side metadata) requires the companion gitlab-zoekt-indexer MR and is documented there.