Skip to content

Example 21: Graceful Shutdown #19

Description

@patterncatalyst

Chapter

_docs/21-appendix-h-shutdown.md — Graceful Shutdown

Example Path

examples/21-graceful-shutdown/

What to demonstrate

  • Fail readiness first, cover deregistration race
  • Drain HTTP connections and Kafka consumers within grace budget
  • Idempotent handling for hard kill (SIGKILL)
  • signal.NotifyContext + atomic.Bool shutdown (Go) or signal handlers (Python)

Stack

  • Infra: Podman — Kafka + LGTM (simulating K8s SIGTERM)
  • Language: Go (signal.NotifyContext) or Python
  • Priority: Medium

Deliverables

  • compose.yaml
  • Service with graceful shutdown protocol
  • Script to simulate SIGTERM during active work
  • README.md
  • verify.sh
  • Flip chapter footer to verified

Metadata

Metadata

Assignees

No one assigned

    Labels

    exampleRunnable example implementationpodman-stackExample uses podman compose infrastructure

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions