Skip to content

Commit bb4c073

Browse files
committed
pgbouncer by bitnamy is replaced with icoretech/pgbouncer-docker
1 parent 89c75ec commit bb4c073

File tree

6 files changed

+88
-24
lines changed

6 files changed

+88
-24
lines changed

charts/synapse/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
---
22
name: synapse
3-
version: 0.41.0
3+
version: 0.42.0
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: synapse-pgbouncer
5+
metadata:
6+
labels:
7+
app: synapse-pgbouncer
8+
data:
9+
pgbouncer.ini: |
10+
[databases]
11+
synapse=host={{ .Values.synapse.postgres.host }} port=5432 dbname={{ .Values.synapse.postgres.dbname }}
12+
[pgbouncer]
13+
listen_port=5432
14+
listen_addr=0.0.0.0
15+
unix_socket_dir=/tmp/
16+
unix_socket_mode=0777
17+
auth_file = /app/users/userlist.txt
18+
server_reset_query = SELECT pg_advisory_unlock_all()
19+
server_reset_query_always = 1
20+
admin_users={{ .Values.synapse.postgres.user }}
21+
pool_mode={{ .Values.synapse.pgbouncer.poolMode }}
22+
auth_type={{ .Values.synapse.pgbouncer.authType }}
23+
default_pool_size={{ .Values.synapse.pgbouncer.poolSize }}
24+
max_client_conn={{ .Values.synapse.pgbouncer.maxClientConn }}
25+
{{- range $key, $val := .Values.synapse.pgbouncer.extraParameters }}
26+
{{ $key }} = {{ $val }}
27+
{{- end }}

charts/synapse/templates/pgbouncer-deployment.yaml

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,29 @@ spec:
2525
imagePullPolicy: {{ .Values.synapse.pgbouncer.image.pullPolicy }}
2626
resources:
2727
{{ toYaml .Values.synapse.pgbouncer.resources | nindent 10 }}
28+
{{- if .Values.synapse.pgbouncer.extraEnvs }}
2829
env:
29-
- name: PGBOUNCER_PORT
30-
value: "5432"
31-
- name: POSTGRESQL_HOST
32-
value: {{ .Values.synapse.postgres.host | quote }}
33-
- name: PGBOUNCER_DATABASE
34-
value: {{ .Values.synapse.postgres.dbname | quote }}
35-
- name: POSTGRESQL_USERNAME
36-
value: {{ .Values.synapse.postgres.user | quote }}
37-
- name: POSTGRESQL_PASSWORD
38-
value: {{ .Values.synapse.postgres.password | quote }}
39-
- name: PGBOUNCER_AUTH_TYPE
40-
value: {{ .Values.synapse.pgbouncer.authType | quote }}
41-
- name: PGBOUNCER_MAX_CLIENT_CONN
42-
value: {{ .Values.synapse.pgbouncer.maxClientConn | quote }}
43-
- name: PGBOUNCER_DEFAULT_POOL_SIZE
44-
value: {{ .Values.synapse.pgbouncer.poolSize | quote }}
45-
- name: PGBOUNCER_POOL_MODE
46-
value: {{ .Values.synapse.pgbouncer.poolMode | quote }}
30+
{{ toYaml .Values.synapse.pgbouncer.extraEnvs | trimSuffix "\n" | nindent 10 }}
31+
{{- end }}
4732
ports:
4833
- containerPort: 5432
4934
name: pgbouncer
5035
protocol: TCP
36+
readinessProbe:
37+
tcpSocket:
38+
port: 5432
39+
initialDelaySeconds: 10
40+
periodSeconds: 5
41+
livenessProbe:
42+
tcpSocket:
43+
port: 5432
44+
initialDelaySeconds: 60
45+
periodSeconds: 10
46+
volumeMounts:
47+
- name: config
48+
mountPath: /etc/pgbouncer/
49+
- name: userlist
50+
mountPath: /etc/userlist/
5151
{{- if .Values.synapse.pgbouncer.nodeSelector }}
5252
nodeSelector:
5353
{{ toYaml .Values.synapse.pgbouncer.nodeSelector | nindent 8 }}
@@ -68,3 +68,10 @@ spec:
6868
priorityClassName: "{{ .Values.synapse.pgbouncer.priorityClassName }}"
6969
{{- end }}
7070
terminationGracePeriodSeconds: 10
71+
volumes:
72+
- name: config
73+
configMap:
74+
name: synapse-pgbouncer
75+
- name: userlist
76+
secret:
77+
secretName: synapse-pgbouncer
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: synapse-pgbouncer
5+
metadata:
6+
labels:
7+
app: synapse-pgbouncer
8+
data:
9+
userlist.txt: |
10+
{{ .Values.synapse.postgres.user | quote }} {{ .Values.synapse.postgres.password | quote }}

charts/synapse/templates/pgbouncer-service.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ apiVersion: v1
33
kind: Service
44
metadata:
55
name: synapse-pgbouncer
6-
annotations:
7-
cloud.google.com/neg: '{"ingress":false}'
6+
metadata:
7+
labels:
8+
app: synapse-pgbouncer
89
spec:
910
selector:
1011
app: synapse-pgbouncer

charts/synapse/values.yaml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ synapse:
1313
# cfg --
1414
image:
1515
repository: "ghcr.io/code-tool/matrix-stack/synapse"
16-
# varsion with git+https://github.com/davefatkin/synapse-s3-storage-provider.git#egg=synapse-s3-storage-provider
16+
# this is patched version of mainstream synamse
17+
# please find patches by link: https://github.com/code-tool/matrix-stack/tree/main/build
18+
# also this ghcr contains synapse:v1.142.1-e2e-optimized with e2e_room_key query patches
1719
tag: "v1.142.1"
1820
pullPolicy: IfNotPresent
1921
autoscaling:
@@ -149,8 +151,8 @@ synapse:
149151
password: "NOT-CONFIGURED"
150152
pgbouncer:
151153
image:
152-
repository: "bitnamilegacy/pgbouncer"
153-
tag: "1.24.1-debian-12-r10"
154+
repository: "bghcr.io/icoretech/pgbouncer-docker"
155+
tag: "1.24.1"
154156
pullPolicy: IfNotPresent
155157
replicas: 2
156158
# set thish gt 0 if you want to enable serveice sessionAffinity by ClientIP
@@ -176,6 +178,23 @@ synapse:
176178
maxSurge: 25%
177179
priorityClassName: ''
178180
topologySpreadConstraints: []
181+
extraParameters: {}
182+
# pidfile: /tmp/pgbouncer.pid
183+
# client_tls_sslmode: disable
184+
# server_tls_sslmode: disable
185+
# ignore_startup_parameters: extra_float_digits
186+
# stats_period: 60
187+
# server_round_robin: 0
188+
# server_fast_close: 0
189+
# additional pgbouncer environment variables
190+
extraEnvs: []
191+
# - name: var1
192+
# value: val1
193+
# - name: var2
194+
# valueFrom:
195+
# secretKeyRef:
196+
# key: my-secret-key
197+
# name: my-secret
179198

180199
redis:
181200
enabled: true

0 commit comments

Comments
 (0)