feat(synapse): move synapse to stable

This commit is contained in:
kjeld Schouten-Lebbing
2022-01-31 22:05:36 +01:00
parent eb2e0274f2
commit 453868b0a4
15 changed files with 1 additions and 1 deletions
@@ -0,0 +1,153 @@
{{/* Define the configs */}}
{{- define "synapse.config" -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: synapse-config
labels:
{{ include "common.labels" . | nindent 4 }}
annotations:
rollme: {{ randAlphaNum 5 | quote }}
data:
homeserver.yaml: |
server_name: {{ .Values.matrix.serverName }}
pid_file: /data/homeserver.pid
public_baseurl: {{ include "matrix.baseUrl" . | quote }}
use_presence: {{ .Values.matrix.presence }}
allow_public_rooms_over_federation: {{ and .Values.matrix.federation.enabled .Values.matrix.federation.allowPublicRooms }}
block_non_admin_invites: {{ .Values.matrix.blockNonAdminInvites }}
enable_search: {{ .Values.matrix.search }}
{{- if .Values.matrix.federation.whitelist }}
federation_domain_whitelist:
{{- range .Values.matrix.federation.whitelist }}
- {{ . }}
{{- end }}
{{- end}}
federation_ip_range_blacklist:
{{- range .Values.matrix.federation.blacklist }}
- {{ . }}
{{- end }}
listeners:
- port: 8008
tls: false
type: http
x_forwarded: true
bind_addresses: ['0.0.0.0']
resources:
- names: [client, federation]
compress: false
{{- if .Values.synapse.metrics.enabled }}
- type: metrics
port: {{ .Values.synapse.metrics.port }}
bind_addresses: ['0.0.0.0']
resources:
- names: [metrics]
{{- end }}
admin_contact: 'mailto:{{ .Values.matrix.adminEmail }}'
hs_disabled: {{ .Values.matrix.disabled }}
hs_disabled_message: {{ .Values.matrix.disabledMessage }}
redaction_retention_period: {{ .Values.matrix.retentionPeriod }}
log_config: "/data/{{ .Values.matrix.serverName }}.log.config"
media_store_path: "/data/media_store"
uploads_path: "/data/uploads"
max_upload_size: {{ .Values.matrix.uploads.maxSize }}
max_image_pixels: {{ .Values.matrix.uploads.maxPixels }}
url_preview_enabled: {{ .Values.matrix.urlPreviews.enabled }}
{{- if .Values.coturn.enabled -}}
{{- if not (empty .Values.coturn.uris) }}
turn_uris:
{{- range .Values.coturn.uris }}
- {{ . }}
{{- end }}
{{- else }}
turn_uris:
- "turn:{{ include "matrix.hostname" . }}?transport=udp"
{{- end }}
turn_user_lifetime: 1h
turn_allow_guests: {{ .Values.coturn.allowGuests }}
{{- end }}
enable_registration: {{ .Values.matrix.registration.enabled }}
allow_guest_access: {{ .Values.matrix.registration.allowGuests }}
{{- if .Values.synapse.metrics.enabled }}
enable_metrics: true
{{- end }}
report_stats: false
{{- if .Values.synapse.appConfig }}
app_service_config_files:
{{- range .Values.synapse.appConfig }}
- {{ . }}
{{- end }}
{{- end }}
signing_key_path: "/data/keys/{{ .Values.matrix.serverName }}.signing.key"
{{- if .Values.matrix.security.trustedKeyServers }}
trusted_key_servers:
{{- range .Values.matrix.security.trustedKeyServers }}
- server_name: {{ .serverName }}
{{- if .verifyKeys }}
verify_keys:
{{- range .verifyKeys }}
{{ .id | quote }}: {{ .key | quote }}
{{- end }}
{{- end }}
{{- if .acceptKeysInsecurely }}
accept_keys_insecurely: {{ .acceptKeysInsecurely }}
{{- end }}
{{- end }}
{{- end }}
suppress_key_server_warning: {{ .Values.matrix.security.supressKeyServerWarning }}
{{- if not .Values.loadCustomConfig }}
custom.yaml: |
# PLACEHOLDER
{{- end }}
{{ .Values.matrix.serverName }}.log.config: |
version: 1
formatters:
precise:
format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s'
filters:
context:
(): synapse.util.logcontext.LoggingContextFilter
request: ""
handlers:
console:
class: logging.StreamHandler
formatter: precise
filters: [context]
loggers:
synapse:
level: {{ .Values.matrix.logging.synapseLogLevel }}
synapse.storage.SQL:
# beware: increasing this to DEBUG will make synapse log sensitive
# information such as access tokens.
level: {{ .Values.matrix.logging.sqlLogLevel }}
root:
level: {{ .Values.matrix.logging.rootLogLevel }}
handlers: [console]
{{- end }}
@@ -0,0 +1,20 @@
Synapse hostname, derived from either the Values.matrix.hostname override or the Ingress definition
*/}}
{{- define "matrix.hostname" -}}
{{- if .Values.matrix.hostname }}
{{- .Values.matrix.hostname -}}
{{- else }}
{{- .Values.ingress.hosts.synapse -}}
{{- end }}
{{- end }}
{{/*
Synapse hostname prepended with https:// to form a complete URL
*/}}
{{- define "matrix.baseUrl" -}}
{{- if .Values.matrix.hostname }}
{{- printf "https://%s" .Values.matrix.hostname -}}
{{- else }}
{{- printf "https://%s" .Values.ingress.hosts.synapse -}}
{{- end }}
{{- end }}
@@ -0,0 +1,63 @@
{{/* Define the configs */}}
{{- define "synapse.secret" -}}
{{- $previous := lookup "v1" "Secret" .Release.Namespace "synapse-secret-macaroon" }}
{{- $msk := randAlphaNum 50 }}
{{- if $previous }}
{{- $msk = ( index $previous.data "key" ) | b64dec }}
{{- end }}
---
apiVersion: v1
kind: Secret
metadata:
name: synapse-secret-macaroon
labels:
{{ include "common.labels" . | nindent 4 }}
annotations:
rollme: {{ randAlphaNum 5 | quote }}
data:
key: {{ $msk | b64enc }}
---
apiVersion: v1
kind: Secret
metadata:
name: synapse-secret
labels:
{{ include "common.labels" . | nindent 4 }}
annotations:
rollme: {{ randAlphaNum 5 | quote }}
stringData:
secret.yaml: |
{{- if .Values.mail.enabled }}
email:
enable_notifs: {{ .Values.mail.enabled }}
notif_from: {{ .Values.mail.from }}
smtp_host: {{ .Values.mail.external.host }}
smtp_port: {{ .Values.mail.external.port }}
smtp_user: {{ .Values.mail.external.username }}
smtp_pass: {{ .Values.mail.external.password }}
require_transport_security: {{ .Values.mail.external.requireTransportSecurity }}
{{- end }}
database:
name: "psycopg2"
args:
user: "{{ .Values.postgresql.postgresqlUsername }}"
password: {{ .Values.postgresql.postgresqlPassword }}
database: "{{ .Values.postgresql.postgresqlDatabase }}"
host: "{{ printf "%v-%v" .Release.Name "postgresql" }}"
port: "5432"
cp_min: 5
cp_max: 10
sslmode: "disable"
{{- if .Values.matrix.registration.sharedSecret }}
registration_shared_secret: {{ .Values.matrix.registration.sharedSecret }}
{{- end }}
macaroon_secret_key: {{ $msk }}
{{- if .Values.coturn.enabled -}}
turn_shared_secret: {{ include "matrix.coturn.sharedSecret" . }}
{{- end }}
{{- end }}
@@ -0,0 +1,14 @@
{{/* Make sure all variables are set properly */}}
{{- include "common.setup" . }}
{{/* Render configmap for synapse */}}
{{- include "synapse.config" . }}
{{/* Render secret for synapse */}}
{{- include "synapse.secret" . }}
{{- $newMiddlewares := list "tc-opencors-headers" }}
{{- $_ := set .Values.ingress.main "fixedMiddlewares" $newMiddlewares -}}
{{/* Render the templates */}}
{{ include "common.postSetup" . }}