Files
Artista-Filmcamp/k8s/base/postgres.yaml
T
Nick SzaunigandClaude Opus 5.5 f9349144ea
Docker-Images bauen und veroeffentlichen / build-and-push (push) Successful in 4m39s
refactor: Kubernetes-Ressourcen und Images heissen artista-filmcamp
Alle Ressourcen tragen den Praefix artista-filmcamp- (Deployment,
Service, StatefulSet, CronJobs, PVCs, ConfigMap, Secret, Ingress,
NetworkPolicies, Middleware) und liegen im Namespace artista. Die Images
heissen wieder <owner>/artista-filmcamp und <owner>/artista-filmcamp-tools,
passend zum Repo. DATABASE_URL-Host, Backup-Host und Betriebsdoku
entsprechend angepasst.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-27 14:15:12 +02:00

83 lines
2.6 KiB
YAML

# PostgreSQL fuer Buchungen, Zahlungen, Gutscheine und Protokoll.
#
# SPEICHER: Blockspeicher mit ReadWriteOnce verwenden (z. B. Longhorn,
# local-path, Ceph RBD). KEINE SMB/CIFS-Freigabe als Datenverzeichnis:
# SMB bildet POSIX-Sperren, fsync-Garantien und Dateirechte nicht so ab,
# wie PostgreSQL sie fuer Absturzsicherheit voraussetzt — Datenverlust bei
# Stromausfall oder Neustart ist die Folge. Sicherungen (backup-CronJob)
# duerfen dagegen auf SMB/NFS liegen.
#
# Alternative fuer hoehere Verfuegbarkeit: CloudNativePG-Operator; dann
# dieses Manifest weglassen und DATABASE_URL auf dessen Service zeigen lassen.
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: artista-filmcamp-postgres
spec:
serviceName: artista-filmcamp-postgres
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: artista-filmcamp-postgres
template:
metadata:
labels:
app.kubernetes.io/name: artista-filmcamp-postgres
spec:
securityContext:
runAsNonRoot: true
runAsUser: 70
runAsGroup: 70
fsGroup: 70
seccompProfile: { type: RuntimeDefault }
containers:
- name: postgres
image: postgres:18.1-alpine
ports:
- containerPort: 5432
env:
- name: POSTGRES_USER
value: artista
- name: POSTGRES_DB
value: artista
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef: { name: artista-filmcamp-secrets, key: DB_PASSWORD }
volumeMounts:
# Ab PostgreSQL 18 liegt PGDATA unter /var/lib/postgresql/18/docker.
- name: data
mountPath: /var/lib/postgresql
readinessProbe:
exec: { command: ["pg_isready", "-U", "artista"] }
periodSeconds: 5
livenessProbe:
exec: { command: ["pg_isready", "-U", "artista"] }
initialDelaySeconds: 30
periodSeconds: 20
resources:
requests: { cpu: 100m, memory: 256Mi }
limits: { memory: 1Gi }
securityContext:
allowPrivilegeEscalation: false
capabilities: { drop: ["ALL"] }
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: ["ReadWriteOnce"]
# storageClassName: longhorn
resources:
requests:
storage: 10Gi
---
apiVersion: v1
kind: Service
metadata:
name: artista-filmcamp-postgres
spec:
clusterIP: None
selector:
app.kubernetes.io/name: artista-filmcamp-postgres
ports:
- port: 5432