Add a frontend health route for container probes - #2571
Merged
Conversation
Liveness and readiness probes hit `/`, so every check rendered the real
root page with its data fetching and log lines — every 10s for readiness.
Add a static `/api/health` returning `{"status":"ok"}` and point the k8s
probes, the Dockerfile HEALTHCHECK and the compose healthcheck at it. The
compose check was hitting `/api/auth/session`, which pulled in the auth
stack on every poll.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
The frontend's liveness and readiness probes point at
/, the app's root page. Every probe renders the real page — data fetching, auth, log lines — and readiness runs every 10 seconds. That's the frontend half of the same noise #2565 fixed on the backend.What Changed
apps/frontend/src/app/api/health/route.ts— returns{"status":"ok"}and nothing else. Markeddynamic = 'force-static', so no auth, no backend call, no data fetching.livenessProbeandreadinessProbeincharts/rhesis/templates/frontend/deployment.yamlat/api/healthinstead of/.HEALTHCHECKinapps/frontend/Dockerfileat/api/healthinstead of/.frontendservice healthcheck indocker-compose.ymlat/api/health. It was hitting/api/auth/session, which pulled in the whole auth stack on every poll.architect-helppattern.No middleware change was needed: the matcher in
apps/frontend/src/proxy.tsalready excludesapi, so/api/healthnever reaches the auth check.Additional Context
playwright.config.tsstill waits on/for dev-server readiness. That's a one-shot startup wait, not a repeating probe, so it's untouched.PUBLIC_PATHSinapps/frontend/src/constants/paths.tshas a stale/api/warmupentry for a route that no longer exists. Not touched here.Testing
Rendered probe paths:
Both probes render as
path: /api/healthon port 3000.Manually: start the frontend and
curl -i localhost:3000/api/health→200with{"status":"ok"}, and no page-render log line.