Files
wild-directory/postgres/versions/1/deployment.yaml

63 lines
2.3 KiB
YAML

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres-deployment
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: "pgvector/pgvector:pg15"
command: ["/bin/bash", "-c"]
args:
- |
# Install English Hunspell dictionary (needed by apps like Zulip for full-text search)
if [ ! -f /usr/share/postgresql/15/tsearch_data/en_us.dict ]; then
apt-get install -y -qq hunspell-en-us 2>/dev/null || true
[ -f /usr/share/hunspell/en_US.aff ] && cp /usr/share/hunspell/en_US.aff /usr/share/postgresql/15/tsearch_data/en_us.affix
[ -f /usr/share/hunspell/en_US.dic ] && cp /usr/share/hunspell/en_US.dic /usr/share/postgresql/15/tsearch_data/en_us.dict
fi
# Install PostGIS (needed by apps like Mobilizon for geographic data)
if [ ! -f /usr/share/postgresql/15/extension/postgis.control ]; then
apt-get update -qq 2>/dev/null && apt-get install -y -qq postgresql-15-postgis-3 postgresql-15-postgis-3-scripts 2>/dev/null || true
fi
exec docker-entrypoint.sh postgres \
-c tcp_keepalives_idle=600 \
-c tcp_keepalives_interval=30 \
-c tcp_keepalives_count=3 \
-c statement_timeout=300000 \
-c idle_in_transaction_session_timeout=600000
ports:
- containerPort: 5432
env:
- name: PGDATA
value: /var/lib/postgresql/data/pgdata
- name: TZ
value: "UTC"
- name: POSTGRES_DB
value: "{{ .database }}"
- name: POSTGRES_USER
value: "{{ .user }}"
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-secrets
key: password
volumeMounts:
- name: postgres-data
mountPath: /var/lib/postgresql/data
volumes:
- name: postgres-data
persistentVolumeClaim:
claimName: postgres-pvc