-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchirpstack-postgresql.yaml
88 lines (80 loc) · 1.93 KB
/
chirpstack-postgresql.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
apiVersion: apps/v1
kind: Deployment
metadata:
name: chirpstack-postgresql
spec:
selector:
matchLabels:
app: chirpstack-postgresql
template:
metadata:
labels:
app: chirpstack-postgresql
spec:
containers:
- name: chirpstack-postgresql
image: postgres:14-alpine
env:
- name: POSTGRES_PASSWORD
value: "root"
resources:
limits:
memory: "128Mi"
cpu: "500m"
ports:
- containerPort: 5432
volumeMounts:
- mountPath: /bitnami/postgresql
name: chirpstack-postgresql-data
- mountPath: /docker-entrypoint-initdb.d
name: chirpstack-postgresql-config
volumes:
- name: chirpstack-postgresql-data
persistentVolumeClaim:
claimName: chirpstack-postgresql-data
- name: chirpstack-postgresql-config
configMap:
name: chirpstack-postgresql-config
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: chirpstack-postgresql-data
spec:
resources:
requests:
storage: 1Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
---
apiVersion: v1
kind: ConfigMap
metadata:
name: chirpstack-postgresql-config
data:
001-int-chirpstack.sh: |
#!/bin/bash
set -e
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
create role chirpstack with login password 'chirpstack';
create database chirpstack with owner chirpstack;
EOSQL
002-chirpstack_extensions.sh: |
#!/bin/bash
set -e
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname="chirpstack" <<-EOSQL
create extension pg_trgm;
create extension hstore;
EOSQL
---
apiVersion: v1
kind: Service
metadata:
name: chirpstack-postgresql-service
spec:
selector:
app: chirpstack-postgresql
ports:
- port: 5432
targetPort: 5432