stack.basicstack.de/apps/pangolin/postgres.yaml
CTO Agent 3fff00cfd0 feat(pangolin): Switch Pangolin database from SQLite to PostgreSQL
Deploy a dedicated PostgreSQL 17 instance in the pangolin namespace
and switch Pangolin (fosrl/pangolin) to the postgresql-1.21.1 image
variant. The database URL is provided via a sealed secret and pulled
into the Pangolin container as DATABASE_URL, which the PostgreSQL
Pangolin build reads at startup.

- New: postgres.yaml (Deployment + PVC on hcloud-volumes-encrypted + Service)
- New: pangolin-postgres-secrets-sealed.yaml (postgres creds + connection string)
- pangolin-deployment.yaml: image -> fosrl/pangolin:postgresql-1.21.1,
  DATABASE_URL from secret, /app/config PVC mount, init container waits
  for postgres, removed obsolete DATABASE_PATH env
- pangolin-config.yaml: dropped SQLite database.path stanza

Fixes DEV-451.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-08-08 11:14:43 +00:00

116 lines
2.9 KiB
YAML

---
# PostgreSQL PersistentVolumeClaim
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pangolin-postgres-data
namespace: pangolin
annotations:
argocd.argoproj.io/sync-options: Delete=false
spec:
accessModes:
- ReadWriteOnce
storageClassName: hcloud-volumes-encrypted
resources:
requests:
storage: 10Gi
---
# PostgreSQL Service (headless-friendly ClusterIP)
apiVersion: v1
kind: Service
metadata:
name: pangolin-postgres
namespace: pangolin
labels:
app: pangolin-postgres
spec:
type: ClusterIP
selector:
app: pangolin-postgres
ports:
- name: postgres
port: 5432
targetPort: 5432
protocol: TCP
---
# PostgreSQL Deployment (single-replica; PVC is RWO)
apiVersion: apps/v1
kind: Deployment
metadata:
name: pangolin-postgres
namespace: pangolin
labels:
app: pangolin-postgres
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: pangolin-postgres
template:
metadata:
labels:
app: pangolin-postgres
spec:
securityContext:
fsGroup: 999
containers:
- name: postgres
image: postgres:17.5
imagePullPolicy: IfNotPresent
ports:
- containerPort: 5432
name: postgres
env:
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: pangolin-postgres-secrets
key: postgres-user
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: pangolin-postgres-secrets
key: postgres-password
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
name: pangolin-postgres-secrets
key: postgres-db
- 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:
- /bin/sh
- -c
- pg_isready -U "$POSTGRES_USER" -d "$POSTGRES_DB"
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 6
livenessProbe:
exec:
command:
- /bin/sh
- -c
- pg_isready -U "$POSTGRES_USER" -d "$POSTGRES_DB"
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
volumes:
- name: data
persistentVolumeClaim:
claimName: pangolin-postgres-data