- Database deployment script (scripts/deploy-database.sh) - Kubernetes manifests for CNPG PostgreSQL cluster (k8s/base/) - Documentation (docs/DEPLOYMENT_GUIDE.md, DATASTORE_SPEC.md, INTEGRATION_SPEC.md) - README with architecture overview and operations guide
98 lines
2.8 KiB
YAML
98 lines
2.8 KiB
YAML
# Copyright 2026 Umbra Tools (umbratools.com)
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
# CloudNativePG Cluster for UmbraTrans
|
|
# Requires CNPG operator installed: kubectl apply -f https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-1.24/releases/cnpg-1.24.0.yaml
|
|
|
|
apiVersion: postgresql.cnpg.io/v1
|
|
kind: Cluster
|
|
metadata:
|
|
name: umbratrans-db
|
|
namespace: umbratrans
|
|
labels:
|
|
app: umbratrans-db
|
|
environment: production
|
|
spec:
|
|
instances: 3
|
|
imageName: ghcr.io/cloudnative-pg/postgresql:16.4
|
|
primaryUpdateStrategy: unsupervised
|
|
postgresql:
|
|
parameters:
|
|
max_connections: "200"
|
|
shared_buffers: "256MB"
|
|
effective_cache_size: "1GB"
|
|
work_mem: "16MB"
|
|
maintenance_work_mem: "128MB"
|
|
max_worker_processes: "8"
|
|
max_parallel_workers_per_gather: "4"
|
|
max_parallel_workers: "8"
|
|
wal_buffers: "16MB"
|
|
min_wal_size: "1GB"
|
|
max_wal_size: "4GB"
|
|
checkpoint_completion_target: "0.9"
|
|
random_page_cost: "1.1"
|
|
effective_io_concurrency: "200"
|
|
log_destination: "stderr"
|
|
logging_collector: "off"
|
|
log_min_duration_statement: "1000"
|
|
log_line_prefix: "%t [%p]: [%l-1] user=%u,db=%d,app=%a,client=%h "
|
|
log_checkpoints: "on"
|
|
log_connections: "on"
|
|
log_disconnections: "on"
|
|
log_lock_waits: "on"
|
|
log_temp_files: "10MB"
|
|
log_autovacuum_min_duration: "1000"
|
|
statement_timeout: "300000"
|
|
idle_in_transaction_session_timeout: "300000"
|
|
bootstrap:
|
|
initdb:
|
|
database: umbratrans
|
|
owner: umbratrans
|
|
secret:
|
|
name: umbratrans-db-credentials
|
|
postInitApplicationSQL:
|
|
- CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
|
- CREATE EXTENSION IF NOT EXISTS "citext";
|
|
- CREATE EXTENSION IF NOT EXISTS "pgcrypto";
|
|
storage:
|
|
storageClass: nfs-client
|
|
size: 50Gi
|
|
backup:
|
|
barmanObjectStore:
|
|
destinationPath: s3://umbra-backups/postgresql/umbratrans-db
|
|
endpointURL: https://s3.example.com
|
|
s3Credentials:
|
|
accessKeyId:
|
|
name: umbratrans-backup-credentials
|
|
key: ACCESS_KEY_ID
|
|
secretAccessKey:
|
|
name: umbratrans-backup-credentials
|
|
key: SECRET_ACCESS_KEY
|
|
retentionPolicy: "30d"
|
|
schedule: "0 2 * * *"
|
|
proxy:
|
|
pgBouncer:
|
|
imageName: ghcr.io/cloudnative-pg/pgbouncer:1.23
|
|
replicas: 2
|
|
poolMode: transaction
|
|
maxClientConn: 2000
|
|
defaultPoolSize: 20
|
|
maxDbConnections: 100
|
|
admin:
|
|
secret:
|
|
name: umbratrans-pgbouncer-admin
|
|
monitoring:
|
|
enablePodMonitor: true
|
|
customQueriesConfigMap:
|
|
- name: umbratrans-db-queries
|
|
resources:
|
|
requests:
|
|
memory: "1Gi"
|
|
cpu: "500m"
|
|
limits:
|
|
memory: "2Gi"
|
|
cpu: "2000m"
|
|
affinity:
|
|
podAntiAffinityType: preferred
|
|
topologyKey: topology.kubernetes.io/zone
|