Description/Context
The Next.js frontend (frontends/main) already has a health endpoint at src/app/healthcheck/route.ts that returns { status, version, timestamp } using the NEXT_PUBLIC_VERSION build arg. However it is missing git_sha and build_timestamp fields, which are needed to:
- Align the response shape with the Django backend's
ol_django.health endpoint (ol-django#436) so monitoring and release pipeline tooling can query either service with the same field names
- Enable the Concourse post-deploy verification step to confirm
git_sha and build_timestamp in addition to the version string
- Give the release pipeline a more precise signal —
version alone can collide if a release is re-built; git SHA is unambiguous
Additionally, the Dockerfile.web does not currently pass GIT_SHA or BUILD_TIMESTAMP as build args, and there is no K8s probe configuration pointing at /healthcheck in the deployment manifests.
Part of the release management modernization: mitodl/hq#7185.
Plan/Design
1. Update frontends/main/Dockerfile.web
Add GIT_SHA and BUILD_TIMESTAMP as build args alongside the existing NEXT_PUBLIC_VERSION:
ARG GIT_SHA
ENV GIT_SHA=$GIT_SHA
ARG BUILD_TIMESTAMP
ENV BUILD_TIMESTAMP=$BUILD_TIMESTAMP
Note: these do NOT use the NEXT_PUBLIC_ prefix — they are server-only values consumed only by the Route Handler, not exposed to the browser bundle.
2. Update src/app/healthcheck/route.ts
Extend the existing handler to include the new fields and align field names with the Django backend:
const VERSION = process.env.NEXT_PUBLIC_VERSION ?? "unknown"
const GIT_SHA = process.env.GIT_SHA ?? "unknown"
const BUILD_TIMESTAMP = process.env.BUILD_TIMESTAMP ?? "unknown"
export async function GET() {
return Response.json(
{
status: "ok",
version: VERSION,
git_sha: GIT_SHA,
build_timestamp: BUILD_TIMESTAMP,
timestamp: new Date().toISOString(),
},
{ status: 200 },
)
}
3. Update Concourse build step (in ol-infrastructure)
The Concourse image build step for the Next.js image should pass the new args:
- put: oci-image-frontend
params:
build: source
dockerfile: source/frontends/main/Dockerfile.web
build_args:
NEXT_PUBLIC_VERSION: ((.:version))
GIT_SHA: ((.:git_sha))
BUILD_TIMESTAMP: ((.:build_timestamp))
These values are written to the workspace by get: release (ol-concourse#13).
4. K8s probe configuration
Update the Next.js K8s Deployment manifest in ol-infrastructure to use /healthcheck for liveness and readiness probes:
livenessProbe:
httpGet:
path: /healthcheck
port: 3000
initialDelaySeconds: 10
periodSeconds: 15
readinessProbe:
httpGet:
path: /healthcheck
port: 3000
initialDelaySeconds: 5
periodSeconds: 10
Consistent response shape across both services
| Field |
Django /health/?format=json |
Next.js /healthcheck |
version |
"2025.04.14.1" |
"2025.04.14.1" |
git_sha |
"a3f9c12" |
"a3f9c12" |
build_timestamp |
"2025-04-14T10:22:00Z" |
"2025-04-14T10:22:00Z" |
timestamp |
(not present) |
"2025-04-14T15:00:00Z" (response time) |
| HTTP status on healthy |
200 |
200 |
| HTTP status on degraded |
500 |
200 (Next.js has no service deps to check) |
The timestamp field (current response time) is unique to the Next.js endpoint and is already present — it helps confirm the response is live and not a cached CDN response.
Description/Context
The Next.js frontend (
frontends/main) already has a health endpoint atsrc/app/healthcheck/route.tsthat returns{ status, version, timestamp }using theNEXT_PUBLIC_VERSIONbuild arg. However it is missinggit_shaandbuild_timestampfields, which are needed to:ol_django.healthendpoint (ol-django#436) so monitoring and release pipeline tooling can query either service with the same field namesgit_shaandbuild_timestampin addition to the version stringversionalone can collide if a release is re-built; git SHA is unambiguousAdditionally, the
Dockerfile.webdoes not currently passGIT_SHAorBUILD_TIMESTAMPas build args, and there is no K8s probe configuration pointing at/healthcheckin the deployment manifests.Part of the release management modernization: mitodl/hq#7185.
Plan/Design
1. Update
frontends/main/Dockerfile.webAdd
GIT_SHAandBUILD_TIMESTAMPas build args alongside the existingNEXT_PUBLIC_VERSION:Note: these do NOT use the
NEXT_PUBLIC_prefix — they are server-only values consumed only by the Route Handler, not exposed to the browser bundle.2. Update
src/app/healthcheck/route.tsExtend the existing handler to include the new fields and align field names with the Django backend:
3. Update Concourse build step (in
ol-infrastructure)The Concourse image build step for the Next.js image should pass the new args:
These values are written to the workspace by
get: release(ol-concourse#13).4. K8s probe configuration
Update the Next.js K8s Deployment manifest in
ol-infrastructureto use/healthcheckfor liveness and readiness probes:Consistent response shape across both services
/health/?format=json/healthcheckversion"2025.04.14.1""2025.04.14.1"git_sha"a3f9c12""a3f9c12"build_timestamp"2025-04-14T10:22:00Z""2025-04-14T10:22:00Z"timestamp"2025-04-14T15:00:00Z"(response time)200200500200(Next.js has no service deps to check)The
timestampfield (current response time) is unique to the Next.js endpoint and is already present — it helps confirm the response is live and not a cached CDN response.