matrix-synapse: Add support for extra postgresql args

Allows passing extra arguments to the pqlib library upon connection, for
instance to set keepalive settings, as documented in:
https://github.com/matrix-org/synapse/blob/develop/docs/postgres.md#synapse-config
This commit is contained in:
Nicolas Bonneval 2021-07-26 18:29:17 +02:00
parent c7aa912f0c
commit 53c2003cc5
4 changed files with 52 additions and 1 deletions

View file

@ -6,7 +6,7 @@ icon: https://matrix.org/images/matrix-logo.svg
appVersion: 1.38.1
type: application
version: 2.1.4
version: 2.1.5
maintainers:
- name: Alexander Olofsson
email: ace@haxalot.com

View file

@ -197,6 +197,25 @@ Set postgresql sslmode
{{- end -}}
{{- end -}}
{{/*
Set postgresql extra args
Refer to https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS
for a list of options that can be passed.
*/}}
{{- define "matrix-synapse.postgresql.extraArgs" -}}
{{- if .Values.postgresql.enabled -}}
{{- with .Values.postgresql.extraArgs }}
{{- . | toYaml }}
{{- end }}
{{- else -}}
{{- with .Values.externalPostgresql.extraArgs }}
{{- . | toYaml }}
{{- end }}
{{- end -}}
{{- end -}}
{{/*
Set redis host
*/}}

View file

@ -36,6 +36,7 @@ stringData:
{{- $postgresPort := include "matrix-synapse.postgresql.port" . }}
{{- $postgresPass := include "matrix-synapse.postgresql.password" . }}
{{- $postgresSSLMode := include "matrix-synapse.postgresql.sslmode" . }}
{{- $postgresExtraArgs := include "matrix-synapse.postgresql.extraArgs" . }}
## Database configuration ##
@ -54,6 +55,7 @@ stringData:
sslmode: {{ $postgresSSLMode | quote }}
cp_min: 5
cp_max: 10
{{- $postgresExtraArgs | nindent 8 }}
{{- $redisHost := include "matrix-synapse.redis.host" . }}
{{- $redisPort := include "matrix-synapse.redis.port" . }}

View file

@ -597,6 +597,21 @@ postgresql:
# storageClass: "-"
size: 16Gi
## Extra arguments for the database connection
## ref: https://github.com/matrix-org/synapse/blob/develop/docs/postgres.md#synapse-config
##
extraArgs: {}
# # seconds of inactivity after which TCP should send a keepalive message to the server
# keepalives_idle: 10
#
# # the number of seconds after which a TCP keepalive message that is not
# # acknowledged by the server should be retransmitted
# keepalives_interval: 10
#
# # the number of TCP keepalives that can be lost before the client's connection
# # to the server is considered dead
# keepalives_count: 3
## An externally configured Postgres server to use for Synapse's database, note
## that the database needs to have both COLLATE and CTYPE set to "C".
##
@ -608,6 +623,21 @@ externalPostgresql:
database: synapse
# sslmode: prefer
## Extra arguments for the database connection
## ref: https://github.com/matrix-org/synapse/blob/develop/docs/postgres.md#synapse-config
##
extraArgs: {}
# # seconds of inactivity after which TCP should send a keepalive message to the server
# keepalives_idle: 10
#
# # the number of seconds after which a TCP keepalive message that is not
# # acknowledged by the server should be retransmitted
# keepalives_interval: 10
#
# # the number of TCP keepalives that can be lost before the client's connection
# # to the server is considered dead
# keepalives_count: 3
## This configuration is for the internal Redis that's deployed for use with
## workers/sharding, for an external Redis server you want to set enabled to
## false and configure the externalRedis block.