6. Reliability & Observability
Health Checks, Readiness & Graceful Shutdown
Make deployments aware of service health and stop processes without dropping safe work.
Lesson overview
Liveness asks whether a process is alive; readiness asks whether it should receive traffic. Graceful shutdown should stop new work, drain safe requests and give workers time to finish or requeue jobs.
Learning path
Theory → Example → Code → Practice → Quiz → Challenge → Completion
Step 1
Theory
Liveness asks whether a process is alive; readiness asks whether it should receive traffic. Graceful shutdown should stop new work, drain safe requests and give workers time to finish or requeue jobs.
Step 2
Example
During deployment, mark the instance unready, drain active requests, stop claiming new jobs and exit after a bounded grace period.
Step 3
Code
typescript
process.on("SIGTERM", async () => {
server.close();
await worker.stopAcceptingNewJobs();
await worker.drain();
});
Step 4
Practice
Review your current application and apply Health Checks, Readiness & Graceful Shutdown. Document the current behavior, one production risk, the change you would make, and how you would verify it.
Step 5
Quiz
1. What is the central production concern in "Health Checks, Readiness & Graceful Shutdown"?
Step 6
Challenge
Design a production-ready implementation for Health Checks, Readiness & Graceful Shutdown. Include failure handling, security considerations, observability, testing and a rollback or recovery path where applicable.
Complete every stage
Work through every step in order, then the lesson will be marked complete.
Each chapter and subtopic has its own public URL under /full-stack-to-production.