From 150153e65357a9de8d0b01c3d75b93b0e722c701 Mon Sep 17 00:00:00 2001 From: WrenIX Date: Tue, 20 Feb 2024 23:58:03 +0100 Subject: [PATCH] feat(mycloud-matrix): add sliding-sync support --- base-values/mycloud-matrix-sliding-sync.yaml | 18 +++++ .../templates/server/sliding-sync.yaml | 68 +++++++++++++++++++ mycloud-matrix/templates/server/synapse.yaml | 9 ++- mycloud-matrix/values.yaml | 17 ++++- 4 files changed, 109 insertions(+), 3 deletions(-) create mode 100644 base-values/mycloud-matrix-sliding-sync.yaml create mode 100644 mycloud-matrix/templates/server/sliding-sync.yaml diff --git a/base-values/mycloud-matrix-sliding-sync.yaml b/base-values/mycloud-matrix-sliding-sync.yaml new file mode 100644 index 0000000..af56424 --- /dev/null +++ b/base-values/mycloud-matrix-sliding-sync.yaml @@ -0,0 +1,18 @@ +## +# commons are from mycloud-core +## + +components: + mycloud-services: + # patch mycloud-core to get another database + values: + databases: + matrix-sliding-sync: + type: postgresql + + mycloud-matrix: + # patch mycloud-core to get another database + values: + server: + slidingSync: + enabled: true diff --git a/mycloud-matrix/templates/server/sliding-sync.yaml b/mycloud-matrix/templates/server/sliding-sync.yaml new file mode 100644 index 0000000..fab8ce9 --- /dev/null +++ b/mycloud-matrix/templates/server/sliding-sync.yaml @@ -0,0 +1,68 @@ +{{- if .Values.server.slidingSync.enabled }} +--- +apiVersion: helm.toolkit.fluxcd.io/v2beta2 +kind: HelmRelease +metadata: + name: "{{ .Release.Name }}-sliding-sync" +spec: + chart: + spec: + sourceRef: + kind: GitRepository + name: "wrenix-helm-charts" + namespace: "flux-system" + chart: "./matrix-sliding-sync" + reconcileStrategy: "Revision" + install: + {{- toYaml .Values.commons.helm.release.install | nindent 4 }} + test: + {{- toYaml .Values.commons.helm.release.test | nindent 4 }} + upgrade: + {{- toYaml .Values.commons.helm.release.upgrade | nindent 4 }} + driftDetection: + {{- toYaml .Values.commons.helm.release.driftDetection | nindent 4 }} + interval: 10m + values: + {{- $host := .Values.ingress.slidingSync.host | default (printf "sliding.matrix.%s" .Values.commons.ingress.domain) }} + config: + homeserver: http://{{ .Release.Name }}-synapse:8008 + logLevel: INFO + postgresql: + host: {{ .Values.databases.slidingSync.host | quote }} + username: {{ .Values.databases.slidingSync.username | quote }} + password: {{ .Values.databases.slidingSync.password | default (derivePassword 1 "long" .Values.commons.masterPassword "matrix-sliding-sync" "database_password" | b64enc) | quote }} + database: {{ .Values.databases.slidingSync.name | quote }} + + ingress: + enabled: true + annotations: + {{- with .Values.commons.ingress.annotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.ingress.annotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + includeServerName: false + hosts: + - host: "{{ $host }}" + paths: + - path: "/" + pathType: Prefix + {{- if .Values.commons.ingress.tls.enabled }} + tls: + {{- with .Values.commons.ingress.tls.override }} + {{- toYaml . | nindent 8 }} + {{- else }} + - secretName: "mycloud-matrix-sliding-sync-cert" + hosts: + - "{{ $host }}" + {{- end }} + {{- end }} + + + prometheus: + servicemonitor: + enabled: {{ (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1/ServiceMonitor") }} + labels: + {{- toYaml .Values.commons.prometheus.monitor.labels | nindent 10 }} +{{- end }}{{/* end-if .server.sldingSync.enabled */}} diff --git a/mycloud-matrix/templates/server/synapse.yaml b/mycloud-matrix/templates/server/synapse.yaml index 2869b7b..9853f61 100644 --- a/mycloud-matrix/templates/server/synapse.yaml +++ b/mycloud-matrix/templates/server/synapse.yaml @@ -154,6 +154,13 @@ spec: wellknown: enabled: true + client: + "m.homeserver": + base_url: "https://{{ $host }}/" + {{- if .Values.server.slidingSync.enabled }} + "org.matrix.msc3575.proxy": + url: "https://{{ .Values.ingress.slidingSync.host | default (printf "sliding.matrix.%s" .Values.commons.ingress.domain) }}/" + {{- end }} resources: requests: cpu: 0.1 @@ -191,7 +198,7 @@ spec: {{- with .Values.commons.ingress.tls.override }} {{- toYaml . | nindent 8 }} {{- else }} - - secretName: "mycloud-metrix-server-cert" + - secretName: "mycloud-matrix-server-cert" hosts: - "{{ .Values.commons.ingress.domain }}" - "{{ $host }}" diff --git a/mycloud-matrix/values.yaml b/mycloud-matrix/values.yaml index 89d8374..8c8f19d 100644 --- a/mycloud-matrix/values.yaml +++ b/mycloud-matrix/values.yaml @@ -62,6 +62,8 @@ server: host: software: "synapse" scaling: false + slidingSync: + enabled: false auth: # -- generated by .commons.masterPassword @@ -87,6 +89,10 @@ ingress: # -- default: matrix.(.commons.ingress.domain) host: annotations: + slidingSync: + # -- default: sliding.matrix.(.commons.ingress.domain) + host: + annotations: element: enabled: true # -- default: element.(.commons.ingress.domain) @@ -100,15 +106,22 @@ ingress: databases: server: - # -- default is from mysql-services + # -- default is from mycloud-services host: mycloud-services-postgresql name: matrix-synapse username: matrix-synapse # -- generated by .commons.masterPassword (equal to mycloud-services) password: + slidingSync: + # -- default is from mycloud-services + host: mycloud-services-postgresql + name: matrix-sliding-sync + username: matrix-sliding-sync + # -- generated by .commons.masterPassword (equal to mycloud-services) + password: bridge: signal: - # -- default is from mysql-services + # -- default is from mycloud-services host: mycloud-services-postgresql name: matrix-bridge-signal username: matrix-bridge-signal