Careeroza
Real World Example
Zero-downtime Release at a Startup
A typical release of the ShopEase API on Google Cloud Run or Kubernetes, as done by many Indian startups:
- PR merged to
main: CI runs lint, unit and e2e tests against a Postgres service container. - CI builds the Docker image tagged with the commit SHA and pushes it to Artifact Registry (Mumbai region
asia-south1). - A migration job runs
prisma migrate deploy. Migrations are written to be backward compatible (add a column first, remove the old one in a later release), so old and new versions can run together. - The platform starts new containers; traffic shifts only after
/api/healthreturns 200. - Old containers get SIGTERM;
enableShutdownHooks()lets them finish in-flight requests and close DB pools. - If error rates rise, roll back to the previous image tag in one command.
Example
gcloud run deploy shopease-api --image asia-south1-docker.pkg.dev/shopease/api/api:3f9c2a7 --region asia-south1Example output
Deploying container to Cloud Run service [shopease-api] in project [shopease] region [asia-south1] ✓ Deploying... Done. ✓ Creating Revision... ✓ Routing traffic... Service [shopease-api] revision [shopease-api-00042-kib] has been deployed and is serving 100 percent of traffic. Service URL: https://shopease-api-xxxxx-el.a.run.app