57 lines
1.5 KiB
YAML
57 lines
1.5 KiB
YAML
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: postgres-init-script
|
|
namespace: matrix
|
|
data:
|
|
init-multiple-dbs.sql: |
|
|
CREATE DATABASE synapse;
|
|
CREATE DATABASE mas;
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: postgres
|
|
namespace: matrix
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: postgres
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: postgres
|
|
spec:
|
|
containers:
|
|
- name: postgres
|
|
image: postgres:15-alpine
|
|
env:
|
|
- name: POSTGRES_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: matrix-secrets
|
|
key: POSTGRES_USER
|
|
- name: POSTGRES_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: matrix-secrets
|
|
key: POSTGRES_PASSWORD
|
|
- name: POSTGRES_INITDB_ARGS
|
|
value: "--encoding=UTF8 --lc-collate=C --lc-ctype=C"
|
|
ports:
|
|
- containerPort: 5432
|
|
volumeMounts:
|
|
- name: postgres-data
|
|
mountPath: /var/lib/postgresql/data
|
|
subPath: synapse-data
|
|
- name: init-script
|
|
mountPath: /docker-entrypoint-initdb.d/init-multiple-dbs.sql
|
|
subPath: init-multiple-dbs.sql
|
|
volumes:
|
|
- name: postgres-data
|
|
persistentVolumeClaim:
|
|
claimName: postgres-data
|
|
- name: init-script
|
|
configMap:
|
|
name: postgres-init-script
|