Health Check

Ref.: https://learn.microsoft.com/en-us/azure/container-apps/health-probes?tabs=yaml

Probes

  • Startup: Checks if your application has successfully started. This check is separate from the liveness probe and executes during the initial startup phase of your application.
  • Liveness: Checks if your application is still running and responsive.
  • Readiness: Checks to see if a replica is ready to handle incoming requests.

Example Liveness Endpoint

const express = require('express');
const app = express();

app.get('/liveness', (req, res) => {
  let isSystemStable = false;
  
  // check for database availability
  // check filesystem structure
  //  etc.

  // set isSystemStable to true if all checks pass

  if (isSystemStable) {
    res.status(200); // Success
  } else {
    res.status(503); // Service unavailable
  }
})