feat(docker): zero-downtime rolling deploy for the 3 replicas
Adds a dependency-free liveness endpoint (GET /api/health), a Docker healthcheck against it, and docker/rolling-deploy.sh which rebuilds the shared image once and restarts pawfeed-1/2/3 sequentially, gated on each becoming healthy before moving to the next. Verified zero-downtime via continuous curl monitoring through a full run against production.
This commit is contained in:
1 parent
faf8ee98b0
commit
6a61bbcc81
7 files changed
+99
-3
No files matched your search
@@ -0,0 +1,14 @@
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
/**
|
||||
* GET /api/health
|
||||
*
|
||||
* Pure liveness check — no DB/Redis calls — used by the Docker HEALTHCHECK
|
||||
* in docker/docker-compose.yml and docker/rolling-deploy.sh to confirm a
|
||||
* replica has finished starting up before moving on to the next one.
|
||||
* Deliberately does not check dependencies: a DB/Redis outage must not make
|
||||
* every replica report unhealthy and get pulled from rotation.
|
||||
*/
|
||||
export async function GET() {
|
||||
return NextResponse.json({ status: "ok" });
|
||||
}
|
||||
@@ -31,6 +31,7 @@ const isPublicRoute = createRouteMatcher([
|
||||
"/api/auth/(.*)",
|
||||
"/api/cron/(.*)",
|
||||
"/api/csp-report",
|
||||
"/api/health",
|
||||
// tRPC handles its own auth per-procedure (protectedProcedure vs.
|
||||
// publicProcedure) and returns a proper JSON UNAUTHORIZED error — letting
|
||||
// Clerk's page-level auth.protect() intercept it first produced a 307 HTML
|
||||
|
||||
Reference in new issue
Block a user