Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

feat: zero downtime lightship on hasura branch #182

Open
wants to merge 4 commits into
base: hasura
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .kontinuous/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,18 @@ app:
host: "{{.Values.global.host}}"
imagePackage: app
containerPort: 3000
probesPath: "/healthz"
livenessProbe:
httpGet:
path: /live
port: 9000
startupProbe:
httpGet:
path: /live
port: 9000
readinessProbe:
httpGet:
path: /ready
port: 9000
envFrom:
- configMapRef:
name: app
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,6 @@ COPY --from=builder --chown=node:node /app/.next ./.next

USER 1001

CMD ["yarn", "start"]
ENV NEXT_MANUAL_SIG_HANDLE=true

CMD ["node_modules/next/dist/bin/next"]
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"@sentry/nextjs": "^7.60.1",
"@socialgouv/matomo-next": "^1.6.1",
"dayjs": "^1.11.9",
"lightship": "^9.0.2",
"next": "13.4.12",
"next-auth": "^4.22.3",
"react": "18.2.0",
Expand Down
6 changes: 6 additions & 0 deletions src/lib/graceful-shutdown.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { createLightship } from "lightship";

export default async function handleGracefulShutdown() {
const lightship = await createLightship();
lightship.signalReady();
}
3 changes: 3 additions & 0 deletions src/pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Html, Head, Main, NextScript, DocumentProps } from "next/document";
import handleGracefulShutdown from "../lib/graceful-shutdown";
import { dsfrDocumentApi, augmentDocumentWithEmotionCache } from "./_app";

const { getColorSchemeHtmlAttributes, augmentDocumentForDsfr } =
Expand Down Expand Up @@ -26,3 +27,5 @@ export default function Document(props: DocumentProps) {
augmentDocumentForDsfr(Document);

augmentDocumentWithEmotionCache(Document);

handleGracefulShutdown();
Loading
Loading