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

91 lines
2.3 KiB
YAML

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: ins-landing-page-postgres
namespace: ins-landing-page
spec:
storageClassName: longhorn
# ReadWriteOnce, not ReadWriteMany: Longhorn serves RWX over NFS, which a database should not
# write through. One replica mounts it.
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
---
apiVersion: v1
kind: Service
metadata:
name: postgres
namespace: ins-landing-page
spec:
clusterIP: None
selector:
app: postgres
ports:
- name: postgres
port: 5432
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: postgres
namespace: ins-landing-page
spec:
serviceName: postgres
replicas: 1
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
terminationGracePeriodSeconds: 60
containers:
- name: postgres
image: postgres:18
env:
- name: POSTGRES_USER
value: ins
- name: POSTGRES_DB
value: ins
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: ins-landing-page-db
key: POSTGRES_PASSWORD
ports:
- name: postgres
containerPort: 5432
# Allow up to 5 minutes for crash recovery before liveness can restart the pod.
startupProbe:
exec:
command: ["pg_isready", "-U", "ins", "-d", "ins"]
periodSeconds: 10
failureThreshold: 30
readinessProbe:
exec:
command: ["pg_isready", "-U", "ins", "-d", "ins"]
periodSeconds: 5
livenessProbe:
exec:
command: ["pg_isready", "-U", "ins", "-d", "ins"]
periodSeconds: 20
failureThreshold: 6
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
memory: 1Gi
volumeMounts:
# postgres:18 keeps its data under /var/lib/postgresql/<major>/docker.
- name: data
mountPath: /var/lib/postgresql
volumes:
- name: data
persistentVolumeClaim:
claimName: ins-landing-page-postgres