File tree Expand file tree Collapse file tree
charts/database/templates
rootfs/usr/share/scripts/patroni Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,14 +5,16 @@ COPY rootfs/usr /usr/
55COPY rootfs/entrypoint.sh /entrypoint.sh
66ENV PG_MAJOR=15 \
77 PG_MINOR=8 \
8- PYTHON_VERSION="3.12"
8+ PYTHON_VERSION="3.12" \
9+ POSTGRES_EXPORTER_VERSION="0.17.1"
910
1011ENV HOME /data
1112ENV PGDATA $HOME/$PG_MAJOR
1213
1314RUN install-packages vim gcc \
1415 && install-stack python $PYTHON_VERSION \
1516 && install-stack postgresql $PG_MAJOR.$PG_MINOR \
17+ && install-stack postgres_exporter $POSTGRES_EXPORTER_VERSION \
1618 && . init-stack \
1719 && set -eux; pip3 install --disable-pip-version-check --no-cache-dir psycopg[binary] patroni[kubernetes] 2>/dev/null; set +eux \
1820 && apt-get purge -y --auto-remove gcc \
Original file line number Diff line number Diff line change 1515 cluster-name : drycc-database
1616 template :
1717 metadata :
18+ annotations :
19+ prometheus.io/path : /metrics
20+ prometheus.io/port : " 9187"
21+ prometheus.io/scrape : " true"
1822 labels : {{- include "common.labels.standard" . | nindent 8 }}
1923 app : drycc-database
2024 cluster-name : drycc-database
7882 volumeMounts :
7983 - name : database-data
8084 mountPath : /data
85+ - name : drycc-database-metrics
86+ image : {{.Values.imageRegistry}}/{{.Values.imageOrg}}/database:{{.Values.imageTag}}
87+ imagePullPolicy : {{.Values.imagePullPolicy}}
88+ {{- if .Values.diagnosticMode.enabled }}
89+ command : {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 10 }}
90+ args : {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 10 }}
91+ {{- else }}
92+ command :
93+ - init-stack
94+ args :
95+ - postgres_exporter
96+ {{- end }}
97+ ports :
98+ - containerPort : 9187
99+ protocol : TCP
100+ env :
101+ - name : DATA_SOURCE_URI
102+ value : " 127.0.0.1:5432/postgres?sslmode=disable"
103+ - name : DATA_SOURCE_USER
104+ valueFrom :
105+ secretKeyRef :
106+ name : database-creds
107+ key : user
108+ - name : DATA_SOURCE_PASS
109+ valueFrom :
110+ secretKeyRef :
111+ name : database-creds
112+ key : password
113+ startupProbe :
114+ initialDelaySeconds : 10
115+ tcpSocket :
116+ port : 9187
117+ periodSeconds : 10
118+ timeoutSeconds : 1
119+ failureThreshold : 15
120+ successThreshold : 1
121+ livenessProbe :
122+ initialDelaySeconds : 5
123+ httpGet :
124+ path : /
125+ port : 9187
126+ periodSeconds : 10
127+ timeoutSeconds : 5
128+ failureThreshold : 6
129+ successThreshold : 1
130+ readinessProbe :
131+ initialDelaySeconds : 5
132+ httpGet :
133+ path : /
134+ port : 9187
135+ periodSeconds : 10
136+ timeoutSeconds : 5
137+ failureThreshold : 6
138+ successThreshold : 1
81139 {{- if .Values.persistence.enabled }}
82140 volumeClaimTemplates :
83141 - metadata :
Original file line number Diff line number Diff line change 44if [[ ( -n " $DRYCC_DATABASE_USER " ) && ( -n " $DRYCC_DATABASE_PASSWORD " )]]; then
55 echo " Creating user ${DRYCC_DATABASE_USER} "
66 psql " $1 " -w -c " create user ${DRYCC_DATABASE_USER} WITH LOGIN ENCRYPTED PASSWORD '${DRYCC_DATABASE_PASSWORD} '"
7+ psql " $1 " -w -c " GRANT pg_monitor TO ${DRYCC_DATABASE_USER} "
78 for dbname in ${DRYCC_DATABASE_INIT_NAMES// ,/ }
89 do
910 echo " Creating database ${dbname} "
You can’t perform that action at this time.
0 commit comments