Files

89 lines
2.4 KiB
YAML

apiVersion: apps/v1
kind: StatefulSet
metadata:
name: dawarich-db
namespace: dawarich
labels:
app: dawarich-db
spec:
serviceName: dawarich-db
replicas: 1
selector:
matchLabels:
app: dawarich-db
template:
metadata:
labels:
app: dawarich-db
spec:
securityContext:
runAsUser: 999
runAsGroup: 999
fsGroup: 999
containers:
- name: postgres
# Dawarich requires PostGIS; the Debian variant keeps the postgres user at UID 999
# (the alpine variant upstream uses has 70). The image creates the postgis extension in POSTGRES_DB.
image: postgis/postgis:17-3.5
imagePullPolicy: IfNotPresent
env:
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: dawarich-credentials
key: username
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: dawarich-credentials
key: password
- name: POSTGRES_DB
value: dawarich
- name: PGDATA
value: /var/lib/postgresql/data/pgdata
ports:
- containerPort: 5432
startupProbe:
tcpSocket:
port: 5432
initialDelaySeconds: 10
periodSeconds: 10
failureThreshold: 30
livenessProbe:
tcpSocket:
port: 5432
periodSeconds: 30
failureThreshold: 5
readinessProbe:
tcpSocket:
port: 5432
periodSeconds: 10
failureThreshold: 3
resources:
requests:
cpu: 50m
memory: 256Mi
limits:
memory: 2Gi # includes the 1Gi /dev/shm below
volumeMounts:
- name: data
mountPath: /var/lib/postgresql/data
- name: shm
mountPath: /dev/shm
volumes:
# Upstream compose sets shm_size: 1G — parallel queries over the points table
# exceed the 64M container default.
- name: shm
emptyDir:
medium: Memory
sizeLimit: 1Gi
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: ["ReadWriteOnce"]
storageClassName: nfs-synology-ssd
resources:
requests:
storage: 10Gi