Files
ngqileandClaude Opus 5.5 ad5996283e fix: address review of the Postgres move
- close the pool on SIGTERM before exiting; query_timeout on the pool
- SIGTERM test fails instead of hanging; test cleanup in finally
- preStop sleep so rollouts don't drop form posts; Postgres startupProbe
- CI step timeout, clear error if test Postgres never starts, remove test image
- export stops on SQL errors; README note on changing the DB password

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfmHGGiYUjNcvJoyzdf
2026-12-01 11:59:55 +08:00

99 lines
2.9 KiB
YAML

apiVersion: v1
kind: Service
metadata:
name: ins-landing-page
namespace: ins-landing-page
spec:
selector:
app: ins-landing-page
ports:
- name: http
port: 3000
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ins-landing-page
namespace: ins-landing-page
spec:
replicas: 1
selector:
matchLabels:
app: ins-landing-page
template:
metadata:
labels:
app: ins-landing-page
spec:
imagePullSecrets:
- name: regcred
terminationGracePeriodSeconds: 10
securityContext:
runAsNonRoot: true
runAsUser: 1000 # the image's `node` user
runAsGroup: 1000
# Start the app only once Postgres answers, instead of crash-looping into a growing back-off
# after a first install or a node restart. Same image as the StatefulSet, so nothing extra is pulled.
initContainers:
- name: wait-for-postgres
image: postgres:18
command: ["sh", "-c", "until pg_isready -h postgres -p 5432 -U ins -d ins; do sleep 2; done"]
resources:
requests:
cpu: 10m
memory: 16Mi
limits:
memory: 64Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: ["ALL"]
containers:
- name: ins-landing-page
# One moving tag per profile (CI); the rollout restarts the pod to pull it.
image: gitea.containerverse.dev/solvway/ins-landing-page:ins-landing-page-prd-latest
imagePullPolicy: Always
env:
- name: PORT
value: "3000"
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: ins-landing-page-db
key: POSTGRES_PASSWORD
- name: DATABASE_URL
value: postgres://ins:$(POSTGRES_PASSWORD)@postgres:5432/ins
ports:
- name: http
containerPort: 3000
# Keep serving for a moment after SIGTERM while Traefik drops this pod from its endpoints,
# so a rollout doesn't turn a form submission into a 502.
lifecycle:
preStop:
exec:
command: ["sleep", "3"]
readinessProbe:
httpGet:
path: /
port: http
periodSeconds: 10
livenessProbe:
httpGet:
path: /
port: http
initialDelaySeconds: 10
periodSeconds: 30
failureThreshold: 3
resources:
requests:
cpu: 20m
memory: 48Mi
limits:
memory: 192Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: ["ALL"]