rebours/k8s/postgres.yml
ordinarthur bf5bf977e9
All checks were successful
Build & Deploy to K3s / build-and-deploy (push) Successful in 4m13s
feat: replace Astro + Sanity + Fastify with Next.js + Payload CMS
Single Next.js 15 app now serves frontend SSR, admin CMS, and Stripe API.
Replaces the Sanity quota-limited headless CMS with self-hosted Payload 3.0
on Postgres, removing the split-service topology (ssr/api/proxy → web).

- nextjs/: Next.js 15 app with Payload 3.0, Postgres adapter, Stripe plugin
- k8s/: new single-pod deployment + Postgres StatefulSet + PVCs (media, db)
- .gitea/workflows/deploy.yml: single-image build, tears down legacy pods

New Gitea secrets required: PAYLOAD_SECRET, POSTGRES_PASSWORD.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 10:28:29 +02:00

93 lines
2.7 KiB
YAML

# ─── Postgres data volume ─────────────────────────────────────────────────────
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: rebours-postgres-data
namespace: rebours
spec:
accessModes: [ReadWriteOnce]
storageClassName: local-path
resources:
requests:
storage: 5Gi
---
# ─── Postgres headless service (stable DNS inside the cluster) ────────────────
apiVersion: v1
kind: Service
metadata:
name: rebours-postgres
namespace: rebours
spec:
selector:
app: rebours-postgres
ports:
- name: postgres
port: 5432
targetPort: 5432
clusterIP: None
---
# ─── Postgres StatefulSet ─────────────────────────────────────────────────────
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: rebours-postgres
namespace: rebours
spec:
serviceName: rebours-postgres
replicas: 1
selector:
matchLabels:
app: rebours-postgres
template:
metadata:
labels:
app: rebours-postgres
spec:
containers:
- name: postgres
image: postgres:16-alpine
ports:
- containerPort: 5432
env:
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
name: rebours-db-secret
key: POSTGRES_DB
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: rebours-db-secret
key: POSTGRES_USER
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: rebours-db-secret
key: POSTGRES_PASSWORD
- name: PGDATA
value: /var/lib/postgresql/data/pgdata
volumeMounts:
- name: data
mountPath: /var/lib/postgresql/data
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "1Gi"
cpu: "1000m"
readinessProbe:
exec:
command: ["sh", "-c", "pg_isready -U $POSTGRES_USER -d $POSTGRES_DB"]
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
exec:
command: ["sh", "-c", "pg_isready -U $POSTGRES_USER -d $POSTGRES_DB"]
initialDelaySeconds: 30
periodSeconds: 30
volumes:
- name: data
persistentVolumeClaim:
claimName: rebours-postgres-data