Skip to content

PRJ2 Healthcheck

Date: 2026-01-09 Status: Accepted Context: PRJ2 apps, making sure report healthy

Decision

Implement a health check endpoint so the platform knowns when the app is sucessfully 'up'. 'up' means, the rest api is running, and the database is successfully connected. For students, this provided a nice starting point, as it touches all layers of the app.

Implementation and Reasoning

Our platform (Kubernetes) has built in ways to wait for and report liveness and readiness. PRJ2's endpoint is /api/v1/health. An example response would be:

{
  "status":"UP",
  "timestamp":"2026-01-07T16:04:37.355732868Z"
}

Platform Timeouts

the JVM needs some initial setup time, to reduce the noisy events (visible in ArgoCD) at startup, we changed the delays. Explained as following:

  ┌─────────────────────┬───────────┬──────────┬────────────────────────────────────┐
  │       Setting       │ Readiness │ Liveness │              Purpose               │
  ├─────────────────────┼───────────┼──────────┼────────────────────────────────────┤
  │ initialDelaySeconds │ 30 →      │ 60 →     │ Wait for JVM + Javalin context init│
  ├─────────────────────┼───────────┼──────────┼────────────────────────────────────┤
  │ periodSeconds       │ 10        │ 15       │ How often to check                 │
  ├─────────────────────┼───────────┼──────────┼────────────────────────────────────┤
  │ timeoutSeconds      │ 5         │ 5        │ Max time for HTTP response         │
  ├─────────────────────┼───────────┼──────────┼────────────────────────────────────┤
  │ failureThreshold    │ 6         │ 3        │ Failures before action             │
  └─────────────────────┴───────────┴──────────┴────────────────────────────────────┘