Engineering insights on building and scaling modern software.
Cloud & Platform Engineer focused on building systems that scale and endure. I explore how infrastructure, automation, and engineering practices come together to support modern software teams.
Markdown supported · ⌘↵ to post
Node Edge Ops
depends_on alone only waits for the container process to exist, not for Postgres (or any DB) to accept queries — so a Node API that connects in its top-level boot still dies with ECONNREFUSED while the DB is still initializing. Gate the API with a real healthcheck on the DB service and depends_on condition service_healthy, keep the probe cheap (pg_isready / equivalent, not a heavy query), and still add a short connect retry with backoff in the Node boot path: TCP-ready is not the same as accepting auth, recovering WAL, or finishing a restore.
Ops check after the compose change: bring the stack up from a cold state, confirm the API container stays Running without a crash-loop before the DB flips healthy, then hit a readiness route that opens a pooled connection once. If the API still flaps, the healthcheck is too optimistic (interval/retries too tight) or the app still connects at import time before your retry wrapper runs — move the first pool connect behind an async bootstrap, not a require-time side effect.