2026-11-22 02:15:56 -05:00
|
|
|
# Plain PostgreSQL 16 — deliberately NOT CloudNativePG.
|
|
|
|
|
#
|
|
|
|
|
# The client runs Odoo against a plain Postgres on a Proxmox VM. This namespace
|
|
|
|
|
# is a *lab replica of that shape*, so the database is a bare container with a
|
|
|
|
|
# single local-path volume, no operator, no replicas, no WAL archive. Do not
|
|
|
|
|
# "improve" this into a CNPG Cluster: the point is to develop and audit against
|
|
|
|
|
# the client's actual architecture, not ours.
|
|
|
|
|
#
|
2026-11-22 02:43:17 -05:00
|
|
|
# Backups: none at the database level — no WAL archive, no replica, no PITR.
|
|
|
|
|
# The client's practice (a cron-driven `pg_dump` of the DB only) is mirrored by
|
|
|
|
|
# `backup.yaml` in this directory: nightly logical dumps, 14-day retention, on a
|
|
|
|
|
# node-local PVC, with the filestore deliberately NOT covered. See README.
|
|
|
|
|
# Do not "improve" this into a CNPG Cluster: the point is to develop and audit
|
|
|
|
|
# against the client's actual architecture, not ours.
|
2026-11-22 02:15:56 -05:00
|
|
|
apiVersion: v1
|
|
|
|
|
kind: PersistentVolumeClaim
|
|
|
|
|
metadata:
|
|
|
|
|
name: pg-data
|
|
|
|
|
namespace: farrisilk
|
|
|
|
|
spec:
|
|
|
|
|
accessModes: [ReadWriteOnce]
|
|
|
|
|
storageClassName: local-path
|
|
|
|
|
resources:
|
|
|
|
|
requests:
|
|
|
|
|
storage: 10Gi
|
|
|
|
|
---
|
|
|
|
|
apiVersion: apps/v1
|
|
|
|
|
kind: Deployment
|
|
|
|
|
metadata:
|
|
|
|
|
name: pg
|
|
|
|
|
namespace: farrisilk
|
|
|
|
|
spec:
|
|
|
|
|
replicas: 1
|
|
|
|
|
# RWO volume: two pods must never hold the data directory at once.
|
|
|
|
|
strategy:
|
|
|
|
|
type: Recreate
|
|
|
|
|
selector:
|
|
|
|
|
matchLabels:
|
|
|
|
|
app: pg
|
|
|
|
|
template:
|
|
|
|
|
metadata:
|
|
|
|
|
labels:
|
|
|
|
|
app: pg
|
|
|
|
|
app.kubernetes.io/part-of: farrisilk
|
|
|
|
|
spec:
|
|
|
|
|
nodeSelector:
|
|
|
|
|
kubernetes.io/hostname: siriussec
|
|
|
|
|
tolerations:
|
|
|
|
|
- key: dedicated
|
|
|
|
|
operator: Exists
|
|
|
|
|
effect: PreferNoSchedule
|
|
|
|
|
containers:
|
|
|
|
|
- name: postgres
|
|
|
|
|
image: postgres:16
|
|
|
|
|
imagePullPolicy: IfNotPresent
|
|
|
|
|
args: ["-c", "max_connections=60"]
|
|
|
|
|
ports:
|
|
|
|
|
- name: postgres
|
|
|
|
|
containerPort: 5432
|
|
|
|
|
env:
|
|
|
|
|
- name: POSTGRES_USER
|
|
|
|
|
valueFrom:
|
|
|
|
|
secretKeyRef:
|
|
|
|
|
name: pg-app
|
|
|
|
|
key: username
|
|
|
|
|
- name: POSTGRES_PASSWORD
|
|
|
|
|
valueFrom:
|
|
|
|
|
secretKeyRef:
|
|
|
|
|
name: pg-app
|
|
|
|
|
key: password
|
|
|
|
|
# The bootstrap superuser's own database. `odoo` and `metabase` are
|
|
|
|
|
# created by the init script below.
|
|
|
|
|
- name: POSTGRES_DB
|
|
|
|
|
value: postgres
|
|
|
|
|
- name: PGDATA
|
|
|
|
|
value: /var/lib/postgresql/data/pgdata
|
|
|
|
|
# Consumed only by 01-init-dbs.sh on first start.
|
|
|
|
|
- name: ODOO_DB_PASSWORD
|
|
|
|
|
valueFrom:
|
|
|
|
|
secretKeyRef:
|
|
|
|
|
name: pg-users
|
|
|
|
|
key: odoo_password
|
|
|
|
|
- name: METABASE_DB_PASSWORD
|
|
|
|
|
valueFrom:
|
|
|
|
|
secretKeyRef:
|
|
|
|
|
name: pg-users
|
|
|
|
|
key: metabase_password
|
|
|
|
|
- name: METABASE_RO_PASSWORD
|
|
|
|
|
valueFrom:
|
|
|
|
|
secretKeyRef:
|
|
|
|
|
name: pg-users
|
|
|
|
|
key: metabase_ro_password
|
|
|
|
|
- name: TZ
|
|
|
|
|
value: America/Los_Angeles
|
|
|
|
|
readinessProbe:
|
|
|
|
|
exec:
|
|
|
|
|
command: ["pg_isready", "-U", "postgres", "-d", "postgres"]
|
|
|
|
|
initialDelaySeconds: 5
|
|
|
|
|
periodSeconds: 5
|
|
|
|
|
timeoutSeconds: 3
|
|
|
|
|
livenessProbe:
|
|
|
|
|
exec:
|
|
|
|
|
command: ["pg_isready", "-U", "postgres", "-d", "postgres"]
|
|
|
|
|
initialDelaySeconds: 60
|
|
|
|
|
periodSeconds: 20
|
|
|
|
|
timeoutSeconds: 5
|
|
|
|
|
failureThreshold: 4
|
|
|
|
|
resources:
|
|
|
|
|
requests:
|
|
|
|
|
cpu: 100m
|
|
|
|
|
memory: 256Mi
|
|
|
|
|
limits:
|
|
|
|
|
memory: 1Gi
|
|
|
|
|
volumeMounts:
|
|
|
|
|
- name: data
|
|
|
|
|
mountPath: /var/lib/postgresql/data
|
|
|
|
|
- name: initdb
|
|
|
|
|
mountPath: /docker-entrypoint-initdb.d
|
|
|
|
|
readOnly: true
|
|
|
|
|
volumes:
|
|
|
|
|
- name: data
|
|
|
|
|
persistentVolumeClaim:
|
|
|
|
|
claimName: pg-data
|
|
|
|
|
- name: initdb
|
|
|
|
|
configMap:
|
|
|
|
|
name: pg-init
|
|
|
|
|
defaultMode: 0555
|
|
|
|
|
---
|
|
|
|
|
apiVersion: v1
|
|
|
|
|
kind: Service
|
|
|
|
|
metadata:
|
|
|
|
|
name: pg
|
|
|
|
|
namespace: farrisilk
|
|
|
|
|
spec:
|
|
|
|
|
type: ClusterIP
|
|
|
|
|
selector:
|
|
|
|
|
app: pg
|
|
|
|
|
ports:
|
|
|
|
|
- name: postgres
|
|
|
|
|
port: 5432
|
|
|
|
|
targetPort: postgres
|
|
|
|
|
protocol: TCP
|