NestJS API on Container Apps
ca-fit-api-prod-139d
NestJS runs as one Container App with scale rules of 10 concurrent requests per replica, 0 to 3 replicas, 0.5 vCPU and 1 GiB each. Liveness and readiness both hit /api/health, so a replica only receives traffic once Nest has booted and answers HTTP.
Why it's built this way activeRevisionsMode: Multiple makes every deploy a new revision named after the commit SHA, created at 0% traffic. Ingress routes by the production label, not by "latest", so CI can smoke-test the new revision on its own URL and then move the label. Rolling back is moving the label back, with no rebuild or redeploy.
The trade-off Scale to zero means a cold start: the first request after an idle period waits for a replica to boot. I tried minReplicas: 1 in prod to remove it, then reverted to 0, because a portfolio app idles most of the day and a warm replica would bill around the clock. /api/health also doesn't query the database, so the smoke test proves a revision boots, not that it can reach Neon.
infrastructure/bicep/modules/container-apps.bicep
traffic: empty(currentProductionRevisionName) ? [
{ latestRevision: true, weight: 100 }
] : [
{
revisionName: currentProductionRevisionName
label: 'production'
weight: 100
}
]
