Skip to content

Replica drain contract

The server and web images use explicit STOPSIGNAL SIGTERM under tini. At the signal, /healthz and /readyz fail with 503. /healthz checks only process drain state and never a database; Docker healthchecks use it. /livez retains liveness during the drain. The server’s /readyz is process-local too: it also answers 503 warming until the boot finished, and it never checks the database. The database verdict is the server’s /readyz/deps, for deploy gates only. The web’s probes use its local state.

Both listeners serve application requests for at least ten seconds after SIGTERM. SUPACLOUD_SHUTDOWN_LB_DELAY_SECS defaults to 10 and has a floor of 10. The server preserves its checkpoint drain before closing listeners and gives open requests SUPACLOUD_SHUTDOWN_GRACE_SECS (default 20). The web serves the adapter-node handler from its custom server.mjs, then closes gracefully with SHUTDOWN_TIMEOUT (default 20); upgraded connections share the same forced-close deadline. Compose allows 11 minutes for the server’s checkpoint budget and 40 seconds for the web. Increase the stop grace when increasing either timing bound. Healthcheck retries are 1 with a five-second interval so the load balancer observes failure within the serving window.

Replicas do not call a peer server by service name. Hub fan-out uses PostgreSQL LISTEN/NOTIFY (server/src/app/hub_relay.rs); runner transport uses the public hub gRPC ingress; realtime publication calls the shared Centrifugo cluster. Its internal HTTP proxy binds an explicit socket address. Infrastructure routes Centrifugo proxy callbacks through the shared ingress or explicit task endpoints, never a node-local Swarm service name. Web BACKEND_URL names an ingress or explicit address in a Swarm deployment; Compose’s server hostname applies to its shared bridge only.

The custom web server follows the adapter-node handler contract.