Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/matrix-stack/configs/synapse/path_map_file.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SPDX-License-Identifier: AGPL-3.0-only

{{ $enabledWorkerTypes := keys ((include "element-io.synapse.enabledWorkers" (dict "root" $root)) | fromJson) }}
{{- range $workerType := $enabledWorkerTypes | sortAlpha }}
{{- $workersPaths := (include "element-io.synapse.process.workerPaths" (dict "root" $root "context" (dict "workerType" $workerType "enabledWorkerTypes" $enabledWorkerTypes))) | fromJsonArray }}
{{- $workersPaths := (include "element-io.synapse.process.workerPaths" (dict "root" $root "context" $workerType)) | fromJsonArray }}
{{- if len $workersPaths }}
# {{ $workerType }}
{{- range $path := $workersPaths }}
Expand Down
64 changes: 19 additions & 45 deletions charts/matrix-stack/templates/synapse/_synapse_details.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,8 @@ SPDX-License-Identifier: AGPL-3.0-only
{{- define "element-io.synapse.process.hasHttp" -}}
{{- $root := .root -}}
{{- with required "element-io.synapse.process.hasHttp missing context" .context -}}
{{ $hasHttp := (list "main"
"account-data"
"client-reader"
"device-lists"
"encryption"
"event-creator"
"federation-inbound"
"federation-reader"
"initial-synchrotron"
"media-repository"
"presence-writer"
"push-rules"
"receipts"
"sliding-sync"
"sso-login"
"synchrotron"
"typing-persister"
"user-dir") }}
{{- if has . $hasHttp -}}
{{- /* initial-synchrotron routing is done in configs/synapse/partial-haproxy.cfg.tpl so that it can fallback -> synchrotron -> main */}}
{{- if or (has . (list "main" "initial-synchrotron")) (gt (len ((include "element-io.synapse.process.workerPaths" (dict "root" $root "context" .)) | fromJsonArray)) 0) -}}
hasHttp
{{- end -}}
{{- end -}}
Expand All @@ -34,16 +17,7 @@ hasHttp
{{- define "element-io.synapse.process.hasReplication" -}}
{{- $root := .root -}}
{{- with required "element-io.synapse.process.hasReplication missing context" .context -}}
{{- $hasReplication := (list "main"
"account-data"
"device-lists"
"encryption"
"event-persister"
"push-rules"
"presence-writer"
"receipts"
"typing-persister") }}
{{- if has . $hasReplication -}}
{{- if or (eq . "main") (gt (len ((include "element-io.synapse.process.streamWriters" (dict "root" $root "context" .)) | fromJsonArray)) 0) -}}
hasReplication
{{- end -}}
{{- end -}}
Expand Down Expand Up @@ -211,14 +185,14 @@ responsibleForMedia
{{- with required "element-io.synapse.process.workerPaths missing context" .context -}}
{{ $workerPaths := list }}

{{- if eq .workerType "account-data" }}
{{- if eq . "account-data" }}
{{ $workerPaths = concat $workerPaths (list
"^/_matrix/client/(r0|v3|unstable)/.*/tags"
"^/_matrix/client/(r0|v3|unstable)/.*/account_data"
) }}
{{- end }}

{{- if eq .workerType "client-reader" }}
{{- if eq . "client-reader" }}
{{- /* Client API requests (apart from createRoom which is eventCreator) */}}
{{ $workerPaths = concat $workerPaths (list
"^/_matrix/client/(api/v1|r0|v3|unstable)/publicRooms$"
Expand Down Expand Up @@ -280,7 +254,7 @@ responsibleForMedia
) }}
{{- end }}

{{- if eq .workerType "device-lists" }}
{{- if eq . "device-lists" }}
{{ $workerPaths = concat $workerPaths (list
"^/_matrix/client/(r0|v3)/delete_devices$"
"^/_matrix/client/(api/v1|r0|v3|unstable)/devices(/|$)"
Expand All @@ -290,13 +264,13 @@ responsibleForMedia
) }}
{{- end }}

{{- if eq .workerType "encryption" }}
{{- if eq . "encryption" }}
{{ $workerPaths = concat $workerPaths (list
"^/_matrix/client/(r0|v3|unstable)/sendToDevice/"
) }}
{{- end }}

{{- if eq .workerType "event-creator" }}
{{- if eq . "event-creator" }}
{{ $workerPaths = concat $workerPaths (list
"^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/redact"
"^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/send"
Expand All @@ -309,15 +283,15 @@ responsibleForMedia
) }}
{{- end }}

{{- if eq .workerType "federation-inbound" }}
{{- if eq . "federation-inbound" }}
{{- /* Inbound federation transaction request */}}
{{ $workerPaths = concat $workerPaths (list
"^/_matrix/federation/v1/send/"
)
}}
{{- end }}

{{- if eq .workerType "federation-reader" }}
{{- if eq . "federation-reader" }}
{{- /* All Federation REST requests for generic_worker */}}
{{ $workerPaths = concat $workerPaths (list
"^/_matrix/federation/v1/version$"
Expand Down Expand Up @@ -351,7 +325,7 @@ responsibleForMedia

{{- /* initial-synchrotron routing is done in configs/synapse/partial-haproxy.cfg.tpl so that it can fallback -> synchrotron -> main */}}

{{- if eq .workerType "media-repository" }}
{{- if eq . "media-repository" }}
{{ $workerPaths = concat $workerPaths (list
"^/_matrix/media/"
"^/_matrix/client/v1/media/"
Expand All @@ -365,32 +339,32 @@ responsibleForMedia
) }}
{{- end }}

{{- if eq .workerType "presence-writer" }}
{{- if eq . "presence-writer" }}
{{ $workerPaths = concat $workerPaths (list
"^/_matrix/client/(api/v1|r0|v3|unstable)/presence/"
) }}
{{- end }}

{{- if eq .workerType "push-rules" }}
{{- if eq . "push-rules" }}
{{ $workerPaths = concat $workerPaths (list
"^/_matrix/client/(api/v1|r0|v3|unstable)/pushrules/"
) }}
{{- end }}

{{- if eq .workerType "receipts" }}
{{- if eq . "receipts" }}
{{ $workerPaths = concat $workerPaths (list
"^/_matrix/client/(r0|v3|unstable)/rooms/.*/receipt"
"^/_matrix/client/(r0|v3|unstable)/rooms/.*/read_markers"
) }}
{{- end }}

{{- if eq .workerType "sliding-sync" }}
{{- if eq . "sliding-sync" }}
{{ $workerPaths = concat $workerPaths (list
"^/_matrix/client/unstable/org.matrix.simplified_msc3575/.*"
) }}
{{- end }}

{{- if eq .workerType "sso-login" }}
{{- if eq . "sso-login" }}
{{ $workerPaths = concat $workerPaths (list
"^/_matrix/client/(api/v1|r0|v3|unstable)/login/sso/redirect"
"^/_synapse/client/pick_idp$"
Expand All @@ -411,7 +385,7 @@ responsibleForMedia
{{- end }}
{{- end }}

{{- if eq .workerType "synchrotron" }}
{{- if eq . "synchrotron" }}
{{- /* Update the initial-synchrotron handling in the haproxy.cfg frontend when updating this */}}
{{ $workerPaths = concat $workerPaths (list
"^/_matrix/client/(r0|v3)/sync$"
Expand All @@ -421,13 +395,13 @@ responsibleForMedia
) }}
{{- end }}

{{- if eq .workerType "typing-persister" }}
{{- if eq . "typing-persister" }}
{{ $workerPaths = concat $workerPaths (list
"^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/typing"
) }}
{{- end }}

{{- if eq .workerType "user-dir" }}
{{- if eq . "user-dir" }}
{{ $workerPaths = concat $workerPaths (list
"^/_matrix/client/(r0|v3|unstable)/user_directory/search$"
) }}
Expand Down
1 change: 1 addition & 0 deletions newsfragments/645.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Source whether Synapse workers serve HTTP endpoints or have replication from other configuration to improve consistency of configuration.
Loading