Operational Concerns
12-Factor adapted to C++, state externalization patterns, the ephemeral filesystem trap, and health checks as the orchestrator's public API into the service — the operational disciplines that make a stateless posture hold up in practice.
12-Factor adapted to C++
The opinionated document. Most twelve factors map directly to C++; three collide: Config (compile-time/link-time/env-time/runtime split), Processes (Meyers singleton critique and DI alternative), Disposability (C++ startup tax, staged-startup pattern, constinit).
State externalization patterns
What goes outside the process: authoritative session state, counters, durable workflow, queues, business data. Connection pools as process-scoped infrastructure with per-handler RAII checkout. ScopedConnection pattern with invalidate() for broken connections. Idempotency keys, deadlines propagating to backing services, the Outbox pattern.
The ephemeral filesystem trap
The container filesystem is ephemeral. The overlayfs layer model, read_only: true as the forcing function, what goes where, logs to stdout, the C++ library traps (spdlog file defaults, crash dumps, ML model caches, coverage data, prometheus_cpp textfiles), restart semantics as a feature.
Health checks as the public API of statelessness
The orchestrator's API into the service. The three probes (startup, liveness, readiness). The gRPC standard health protocol with HealthCheckServiceInterface. Separate-port vs same-port trade-offs. The graceful-shutdown sequence that ties together stop_token, pool draining, and reverse-order destruction. Anti-patterns.