homek8s/apps/base/farrisilk/postgres.yaml
Lance Walters 79206e0487 ops(farrisilk): park the client replica stack to cut siriussec draw
siriussec is on a 15 W USB-C adapter and low-battery-shutdown fired 2026-11-22
04:20. The farrisilk replica (Odoo + Metabase JVM + Postgres) is the largest
single stack on that node and is not client production. Scale its three
Deployments to 0 and suspend the nightly pg_dump; PVCs and data stay put.

Restore: set replicas back to 1 in odoo.yaml, metabase.yaml, postgres.yaml and
unsuspend backup.yaml, then let Flux reconcile.
2026-11-22 05:54:53 -05:00

143 lines
4.3 KiB
YAML

# 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.
#
# 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.
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:
# Parked 2026-11-22 (power budget) — see apps/base/farrisilk/odoo.yaml.
# Recreate: the data directory must be released before anything restarts.
replicas: 0
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