Some client API endpoints (e.g. keys/upload) are backed by Synapse stream writers and should not rely on broad worker regexes or route-order fallthrough for correctness. When explicit per-stream routing is missing, requests may be captured by generic, room, or client_reader workers, instead of: - going to the configured stream writer - or to `main` when that stream writer is not enabled This refactors synapse-reverse-proxy-companion's routing so that web-facing stream-backed endpoint families are handled explicitly and early, with deterministic writer-or-main fallback. Add first-class support for the missing `device_lists` stream writer, generalize the same routing model to `push_rules`, and remove stale broad-route ownership for device-list-sensitive endpoints.master
| @@ -934,6 +934,8 @@ matrix_synapse_workers_presets: | |||||
| stream_writer_account_data_stream_workers_count: 0 | stream_writer_account_data_stream_workers_count: 0 | ||||
| stream_writer_receipts_stream_workers_count: 0 | stream_writer_receipts_stream_workers_count: 0 | ||||
| stream_writer_presence_stream_workers_count: 0 | stream_writer_presence_stream_workers_count: 0 | ||||
| stream_writer_push_rules_stream_workers_count: 0 | |||||
| stream_writer_device_lists_stream_workers_count: 0 | |||||
| one-of-each: | one-of-each: | ||||
| room_workers_count: 0 | room_workers_count: 0 | ||||
| sync_workers_count: 0 | sync_workers_count: 0 | ||||
| @@ -952,6 +954,8 @@ matrix_synapse_workers_presets: | |||||
| stream_writer_account_data_stream_workers_count: 1 | stream_writer_account_data_stream_workers_count: 1 | ||||
| stream_writer_receipts_stream_workers_count: 1 | stream_writer_receipts_stream_workers_count: 1 | ||||
| stream_writer_presence_stream_workers_count: 1 | stream_writer_presence_stream_workers_count: 1 | ||||
| stream_writer_push_rules_stream_workers_count: 0 | |||||
| stream_writer_device_lists_stream_workers_count: 0 | |||||
| specialized-workers: | specialized-workers: | ||||
| room_workers_count: 1 | room_workers_count: 1 | ||||
| sync_workers_count: 1 | sync_workers_count: 1 | ||||
| @@ -970,6 +974,8 @@ matrix_synapse_workers_presets: | |||||
| stream_writer_account_data_stream_workers_count: 1 | stream_writer_account_data_stream_workers_count: 1 | ||||
| stream_writer_receipts_stream_workers_count: 1 | stream_writer_receipts_stream_workers_count: 1 | ||||
| stream_writer_presence_stream_workers_count: 1 | stream_writer_presence_stream_workers_count: 1 | ||||
| stream_writer_push_rules_stream_workers_count: 0 | |||||
| stream_writer_device_lists_stream_workers_count: 0 | |||||
| # Controls whether the matrix-synapse container exposes the various worker ports | # Controls whether the matrix-synapse container exposes the various worker ports | ||||
| # (see `port` and `metrics_port` in `matrix_synapse_workers_enabled_list`) outside of the container. | # (see `port` and `metrics_port` in `matrix_synapse_workers_enabled_list`) outside of the container. | ||||
| @@ -1064,6 +1070,14 @@ matrix_synapse_workers_stream_writer_receipts_stream_workers_count: "{{ matrix_s | |||||
| # The count of these workers can only be 0 or 1. | # The count of these workers can only be 0 or 1. | ||||
| matrix_synapse_workers_stream_writer_presence_stream_workers_count: "{{ matrix_synapse_workers_presets[matrix_synapse_workers_preset]['stream_writer_presence_stream_workers_count'] }}" | matrix_synapse_workers_stream_writer_presence_stream_workers_count: "{{ matrix_synapse_workers_presets[matrix_synapse_workers_preset]['stream_writer_presence_stream_workers_count'] }}" | ||||
| # matrix_synapse_workers_stream_writer_push_rules_stream_workers_count controls how many stream writers that handle the `push_rules` stream to spawn. | |||||
| # The count of these workers can only be 0 or 1. | |||||
| matrix_synapse_workers_stream_writer_push_rules_stream_workers_count: "{{ matrix_synapse_workers_presets[matrix_synapse_workers_preset]['stream_writer_push_rules_stream_workers_count'] }}" | |||||
| # matrix_synapse_workers_stream_writer_device_lists_stream_workers_count controls how many stream writers that handle the `device_lists` stream to spawn. | |||||
| # More than 1 worker is also supported of this type. | |||||
| matrix_synapse_workers_stream_writer_device_lists_stream_workers_count: "{{ matrix_synapse_workers_presets[matrix_synapse_workers_preset]['stream_writer_device_lists_stream_workers_count'] }}" | |||||
| # A list of stream writer workers to enable. This list is built automatically based on other variables. | # A list of stream writer workers to enable. This list is built automatically based on other variables. | ||||
| # You're encouraged to enable/disable stream writer workers by setting `matrix_synapse_workers_stream_writer_*_stream_workers_count` variables, instead of adjusting this list manually. | # You're encouraged to enable/disable stream writer workers by setting `matrix_synapse_workers_stream_writer_*_stream_workers_count` variables, instead of adjusting this list manually. | ||||
| matrix_synapse_workers_stream_writers: | | matrix_synapse_workers_stream_writers: | | ||||
| @@ -1081,6 +1095,10 @@ matrix_synapse_workers_stream_writers: | | |||||
| ([{'stream': 'receipts'}] * matrix_synapse_workers_stream_writer_receipts_stream_workers_count | int) | ([{'stream': 'receipts'}] * matrix_synapse_workers_stream_writer_receipts_stream_workers_count | int) | ||||
| + | + | ||||
| ([{'stream': 'presence'}] * matrix_synapse_workers_stream_writer_presence_stream_workers_count | int) | ([{'stream': 'presence'}] * matrix_synapse_workers_stream_writer_presence_stream_workers_count | int) | ||||
| + | |||||
| ([{'stream': 'push_rules'}] * matrix_synapse_workers_stream_writer_push_rules_stream_workers_count | int) | |||||
| + | |||||
| ([{'stream': 'device_lists'}] * matrix_synapse_workers_stream_writer_device_lists_stream_workers_count | int) | |||||
| }} | }} | ||||
| matrix_synapse_workers_stream_writers_container_arguments: [] | matrix_synapse_workers_stream_writers_container_arguments: [] | ||||
| @@ -1998,9 +2016,11 @@ matrix_synapse_reverse_proxy_companion_synapse_stream_writer_to_device_stream_wo | |||||
| matrix_synapse_reverse_proxy_companion_synapse_stream_writer_account_data_stream_worker_client_server_locations: "{{ matrix_synapse_workers_stream_writer_account_data_stream_worker_client_server_endpoints }}" | matrix_synapse_reverse_proxy_companion_synapse_stream_writer_account_data_stream_worker_client_server_locations: "{{ matrix_synapse_workers_stream_writer_account_data_stream_worker_client_server_endpoints }}" | ||||
| matrix_synapse_reverse_proxy_companion_synapse_stream_writer_receipts_stream_worker_client_server_locations: "{{ matrix_synapse_workers_stream_writer_receipts_stream_worker_client_server_endpoints }}" | matrix_synapse_reverse_proxy_companion_synapse_stream_writer_receipts_stream_worker_client_server_locations: "{{ matrix_synapse_workers_stream_writer_receipts_stream_worker_client_server_endpoints }}" | ||||
| matrix_synapse_reverse_proxy_companion_synapse_stream_writer_presence_stream_worker_client_server_locations: "{{ matrix_synapse_workers_stream_writer_presence_stream_worker_client_server_endpoints }}" | matrix_synapse_reverse_proxy_companion_synapse_stream_writer_presence_stream_worker_client_server_locations: "{{ matrix_synapse_workers_stream_writer_presence_stream_worker_client_server_endpoints }}" | ||||
| matrix_synapse_reverse_proxy_companion_synapse_stream_writer_push_rules_stream_worker_client_server_locations: "{{ matrix_synapse_workers_stream_writer_push_rules_stream_worker_client_server_endpoints }}" | |||||
| matrix_synapse_reverse_proxy_companion_synapse_stream_writer_device_lists_stream_worker_client_server_locations: "{{ matrix_synapse_workers_stream_writer_device_lists_stream_worker_client_server_endpoints }}" | |||||
| matrix_synapse_reverse_proxy_companion_synapse_media_repository_locations: "{{ matrix_synapse_workers_media_repository_endpoints | default([]) }}" | matrix_synapse_reverse_proxy_companion_synapse_media_repository_locations: "{{ matrix_synapse_workers_media_repository_endpoints | default([]) }}" | ||||
| matrix_synapse_reverse_proxy_companion_synapse_user_dir_locations: "{{ matrix_synapse_workers_user_dir_worker_client_server_endpoints | default([]) }}" | matrix_synapse_reverse_proxy_companion_synapse_user_dir_locations: "{{ matrix_synapse_workers_user_dir_worker_client_server_endpoints | default([]) }}" | ||||
| matrix_synapse_reverse_proxy_companion_client_server_main_override_locations_regex: ^/_matrix/client/(api/v1|r0|v3|unstable)/(account/3pid/|directory/list/room/|pushrules/|rooms/[^/]+/(forget|upgrade|report)|login/sso/redirect/|register) | |||||
| matrix_synapse_reverse_proxy_companion_client_server_main_override_locations_regex: ^/_matrix/client/(api/v1|r0|v3|unstable)/(account/3pid/|directory/list/room/|rooms/[^/]+/(forget|upgrade|report)|login/sso/redirect/|register) | |||||
| matrix_synapse_reverse_proxy_companion_client_server_sso_override_locations_regex: ^(/_matrix/client/(api/v1|r0|v3|unstable)/login/sso/redirect|/_synapse/client/(pick_username|(new_user_consent|oidc/callback|pick_idp|sso_register)$)) | matrix_synapse_reverse_proxy_companion_client_server_sso_override_locations_regex: ^(/_matrix/client/(api/v1|r0|v3|unstable)/login/sso/redirect|/_synapse/client/(pick_username|(new_user_consent|oidc/callback|pick_idp|sso_register)$)) | ||||
| # Related to MSC4108 (https://github.com/matrix-org/matrix-spec-proposals/pull/4108) | # Related to MSC4108 (https://github.com/matrix-org/matrix-spec-proposals/pull/4108) | ||||
| matrix_synapse_reverse_proxy_companion_client_server_qr_code_login_locations_regex: ^(/_matrix/client/(unstable|v1)/org.matrix.msc4108/rendezvous|/_synapse/client/rendezvous)$ | matrix_synapse_reverse_proxy_companion_client_server_qr_code_login_locations_regex: ^(/_matrix/client/(unstable|v1)/org.matrix.msc4108/rendezvous|/_synapse/client/rendezvous)$ | ||||
| @@ -149,6 +149,7 @@ | |||||
| - "matrix_synapse_workers_stream_writer_account_data_stream_workers_count" | - "matrix_synapse_workers_stream_writer_account_data_stream_workers_count" | ||||
| - "matrix_synapse_workers_stream_writer_receipts_stream_workers_count" | - "matrix_synapse_workers_stream_writer_receipts_stream_workers_count" | ||||
| - "matrix_synapse_workers_stream_writer_presence_stream_workers_count" | - "matrix_synapse_workers_stream_writer_presence_stream_workers_count" | ||||
| - "matrix_synapse_workers_stream_writer_push_rules_stream_workers_count" | |||||
| - name: Fail when mixing generic workers with new specialized workers | - name: Fail when mixing generic workers with new specialized workers | ||||
| ansible.builtin.fail: | ansible.builtin.fail: | ||||
| @@ -10,8 +10,54 @@ | |||||
| {% set stream_writer_account_data_stream_workers = matrix_synapse_reverse_proxy_companion_synapse_workers_list | selectattr('type', 'equalto', 'stream_writer') | selectattr('stream_writer_stream', 'equalto', 'account_data') | list %} | {% set stream_writer_account_data_stream_workers = matrix_synapse_reverse_proxy_companion_synapse_workers_list | selectattr('type', 'equalto', 'stream_writer') | selectattr('stream_writer_stream', 'equalto', 'account_data') | list %} | ||||
| {% set stream_writer_receipts_stream_workers = matrix_synapse_reverse_proxy_companion_synapse_workers_list | selectattr('type', 'equalto', 'stream_writer') | selectattr('stream_writer_stream', 'equalto', 'receipts') | list %} | {% set stream_writer_receipts_stream_workers = matrix_synapse_reverse_proxy_companion_synapse_workers_list | selectattr('type', 'equalto', 'stream_writer') | selectattr('stream_writer_stream', 'equalto', 'receipts') | list %} | ||||
| {% set stream_writer_presence_stream_workers = matrix_synapse_reverse_proxy_companion_synapse_workers_list | selectattr('type', 'equalto', 'stream_writer') | selectattr('stream_writer_stream', 'equalto', 'presence') | list %} | {% set stream_writer_presence_stream_workers = matrix_synapse_reverse_proxy_companion_synapse_workers_list | selectattr('type', 'equalto', 'stream_writer') | selectattr('stream_writer_stream', 'equalto', 'presence') | list %} | ||||
| {% set stream_writer_push_rules_stream_workers = matrix_synapse_reverse_proxy_companion_synapse_workers_list | selectattr('type', 'equalto', 'stream_writer') | selectattr('stream_writer_stream', 'equalto', 'push_rules') | list %} | |||||
| {% set stream_writer_device_lists_stream_workers = matrix_synapse_reverse_proxy_companion_synapse_workers_list | selectattr('type', 'equalto', 'stream_writer') | selectattr('stream_writer_stream', 'equalto', 'device_lists') | list %} | |||||
| {% set media_repository_workers = matrix_synapse_reverse_proxy_companion_synapse_workers_list | selectattr('type', 'equalto', 'media_repository') | list %} | {% set media_repository_workers = matrix_synapse_reverse_proxy_companion_synapse_workers_list | selectattr('type', 'equalto', 'media_repository') | list %} | ||||
| {% set user_dir_workers = matrix_synapse_reverse_proxy_companion_synapse_workers_list | selectattr('type', 'equalto', 'user_dir') | list %} | {% set user_dir_workers = matrix_synapse_reverse_proxy_companion_synapse_workers_list | selectattr('type', 'equalto', 'user_dir') | list %} | ||||
| {% set stream_writer_client_server_routes = [ | |||||
| { | |||||
| 'doc_url': 'https://matrix-org.github.io/synapse/latest/workers.html#the-typing-stream', | |||||
| 'workers': stream_writer_typing_stream_workers, | |||||
| 'locations': matrix_synapse_reverse_proxy_companion_synapse_stream_writer_typing_stream_worker_client_server_locations, | |||||
| 'upstream': 'stream_writer_typing_stream_workers_upstream', | |||||
| }, | |||||
| { | |||||
| 'doc_url': 'https://matrix-org.github.io/synapse/latest/workers.html#the-to_device-stream', | |||||
| 'workers': stream_writer_to_device_stream_workers, | |||||
| 'locations': matrix_synapse_reverse_proxy_companion_synapse_stream_writer_to_device_stream_worker_client_server_locations, | |||||
| 'upstream': 'stream_writer_to_device_stream_workers_upstream', | |||||
| }, | |||||
| { | |||||
| 'doc_url': 'https://matrix-org.github.io/synapse/latest/workers.html#the-account_data-stream', | |||||
| 'workers': stream_writer_account_data_stream_workers, | |||||
| 'locations': matrix_synapse_reverse_proxy_companion_synapse_stream_writer_account_data_stream_worker_client_server_locations, | |||||
| 'upstream': 'stream_writer_account_data_stream_workers_upstream', | |||||
| }, | |||||
| { | |||||
| 'doc_url': 'https://matrix-org.github.io/synapse/latest/workers.html#the-receipts-stream', | |||||
| 'workers': stream_writer_receipts_stream_workers, | |||||
| 'locations': matrix_synapse_reverse_proxy_companion_synapse_stream_writer_receipts_stream_worker_client_server_locations, | |||||
| 'upstream': 'stream_writer_receipts_stream_workers_upstream', | |||||
| }, | |||||
| { | |||||
| 'doc_url': 'https://matrix-org.github.io/synapse/latest/workers.html#the-presence-stream', | |||||
| 'workers': stream_writer_presence_stream_workers, | |||||
| 'locations': matrix_synapse_reverse_proxy_companion_synapse_stream_writer_presence_stream_worker_client_server_locations, | |||||
| 'upstream': 'stream_writer_presence_stream_workers_upstream', | |||||
| }, | |||||
| { | |||||
| 'doc_url': 'https://matrix-org.github.io/synapse/latest/workers.html#the-push_rules-stream', | |||||
| 'workers': stream_writer_push_rules_stream_workers, | |||||
| 'locations': matrix_synapse_reverse_proxy_companion_synapse_stream_writer_push_rules_stream_worker_client_server_locations, | |||||
| 'upstream': 'stream_writer_push_rules_stream_workers_upstream', | |||||
| }, | |||||
| { | |||||
| 'doc_url': 'https://matrix-org.github.io/synapse/latest/workers.html#the-device_lists-stream', | |||||
| 'workers': stream_writer_device_lists_stream_workers, | |||||
| 'locations': matrix_synapse_reverse_proxy_companion_synapse_stream_writer_device_lists_stream_worker_client_server_locations, | |||||
| 'upstream': 'stream_writer_device_lists_stream_workers_upstream', | |||||
| }, | |||||
| ] %} | |||||
| {% macro render_worker_upstream(name, workers, load_balance) %} | {% macro render_worker_upstream(name, workers, load_balance) %} | ||||
| upstream {{ name }} { | upstream {{ name }} { | ||||
| @@ -41,6 +87,23 @@ | |||||
| {% endfor %} | {% endfor %} | ||||
| {% endmacro %} | {% endmacro %} | ||||
| {% macro render_locations_to_upstream_or_main(locations, workers, upstream_name) %} | |||||
| {% for location in locations %} | |||||
| location ~ {{ location }} { | |||||
| {% if workers | length > 0 %} | |||||
| proxy_pass http://{{ upstream_name }}$request_uri; | |||||
| proxy_http_version 1.1; | |||||
| proxy_set_header Connection ""; | |||||
| {% else %} | |||||
| {# Use the embedded DNS resolver in Docker containers to discover the service #} | |||||
| resolver {{ matrix_synapse_reverse_proxy_companion_http_level_resolver }} valid=5s; | |||||
| set $backend "{{ matrix_synapse_reverse_proxy_companion_client_api_addr }}"; | |||||
| proxy_pass http://$backend; | |||||
| {% endif %} | |||||
| } | |||||
| {% endfor %} | |||||
| {% endmacro %} | |||||
| {% macro render_locations_to_upstream_with_whoami_sync_worker_router(locations, upstream_name) %} | {% macro render_locations_to_upstream_with_whoami_sync_worker_router(locations, upstream_name) %} | ||||
| {% for location in locations %} | {% for location in locations %} | ||||
| location ~ {{ location }} { | location ~ {{ location }} { | ||||
| @@ -100,25 +163,11 @@ map $request_uri $room_name { | |||||
| {{- render_worker_upstream('generic_workers_upstream', generic_workers, 'hash $http_x_forwarded_for;') }} | {{- render_worker_upstream('generic_workers_upstream', generic_workers, 'hash $http_x_forwarded_for;') }} | ||||
| {% endif %} | {% endif %} | ||||
| {% if stream_writer_typing_stream_workers | length > 0 %} | |||||
| {{- render_worker_upstream('stream_writer_typing_stream_workers_upstream', stream_writer_typing_stream_workers, '') }} | |||||
| {% endif %} | |||||
| {% if stream_writer_to_device_stream_workers | length > 0 %} | |||||
| {{- render_worker_upstream('stream_writer_to_device_stream_workers_upstream', stream_writer_to_device_stream_workers, '') }} | |||||
| {% endif %} | |||||
| {% if stream_writer_account_data_stream_workers | length > 0 %} | |||||
| {{- render_worker_upstream('stream_writer_account_data_stream_workers_upstream', stream_writer_account_data_stream_workers, '') }} | |||||
| {% endif %} | |||||
| {% if stream_writer_receipts_stream_workers | length > 0 %} | |||||
| {{- render_worker_upstream('stream_writer_receipts_stream_workers_upstream', stream_writer_receipts_stream_workers, '') }} | |||||
| {% endif %} | |||||
| {% if stream_writer_presence_stream_workers | length > 0 %} | |||||
| {{- render_worker_upstream('stream_writer_presence_stream_workers_upstream', stream_writer_presence_stream_workers, '') }} | |||||
| {% for stream_writer_client_server_route in stream_writer_client_server_routes %} | |||||
| {% if stream_writer_client_server_route.workers | length > 0 %} | |||||
| {{- render_worker_upstream(stream_writer_client_server_route.upstream, stream_writer_client_server_route.workers, '') }} | |||||
| {% endif %} | {% endif %} | ||||
| {% endfor %} | |||||
| {% if media_repository_workers | length > 0 %} | {% if media_repository_workers | length > 0 %} | ||||
| {{- render_worker_upstream('media_repository_workers_upstream', media_repository_workers, 'least_conn;') }} | {{- render_worker_upstream('media_repository_workers_upstream', media_repository_workers, 'least_conn;') }} | ||||
| @@ -186,36 +235,16 @@ server { | |||||
| {# Workers redirects BEGIN #} | {# Workers redirects BEGIN #} | ||||
| {% for stream_writer_client_server_route in stream_writer_client_server_routes %} | |||||
| # {{ stream_writer_client_server_route.doc_url }} | |||||
| {{ render_locations_to_upstream_or_main(stream_writer_client_server_route.locations, stream_writer_client_server_route.workers, stream_writer_client_server_route.upstream) }} | |||||
| {% endfor %} | |||||
| {% if generic_workers | length > 0 %} | {% if generic_workers | length > 0 %} | ||||
| # https://matrix-org.github.io/synapse/latest/workers.html#synapseappgeneric_worker | # https://matrix-org.github.io/synapse/latest/workers.html#synapseappgeneric_worker | ||||
| {{ render_locations_to_upstream(matrix_synapse_reverse_proxy_companion_synapse_generic_worker_client_server_locations, 'generic_workers_upstream') }} | {{ render_locations_to_upstream(matrix_synapse_reverse_proxy_companion_synapse_generic_worker_client_server_locations, 'generic_workers_upstream') }} | ||||
| {% endif %} | {% endif %} | ||||
| {% if stream_writer_typing_stream_workers | length > 0 %} | |||||
| # https://matrix-org.github.io/synapse/latest/workers.html#the-typing-stream | |||||
| {{ render_locations_to_upstream(matrix_synapse_reverse_proxy_companion_synapse_stream_writer_typing_stream_worker_client_server_locations, 'stream_writer_typing_stream_workers_upstream') }} | |||||
| {% endif %} | |||||
| {% if stream_writer_to_device_stream_workers | length > 0 %} | |||||
| # https://matrix-org.github.io/synapse/latest/workers.html#the-to_device-stream | |||||
| {{ render_locations_to_upstream(matrix_synapse_reverse_proxy_companion_synapse_stream_writer_to_device_stream_worker_client_server_locations, 'stream_writer_to_device_stream_workers_upstream') }} | |||||
| {% endif %} | |||||
| {% if stream_writer_account_data_stream_workers | length > 0 %} | |||||
| # https://matrix-org.github.io/synapse/latest/workers.html#the-account_data-stream | |||||
| {{ render_locations_to_upstream(matrix_synapse_reverse_proxy_companion_synapse_stream_writer_account_data_stream_worker_client_server_locations, 'stream_writer_account_data_stream_workers_upstream') }} | |||||
| {% endif %} | |||||
| {% if stream_writer_receipts_stream_workers | length > 0 %} | |||||
| # https://matrix-org.github.io/synapse/latest/workers.html#the-receipts-stream | |||||
| {{ render_locations_to_upstream(matrix_synapse_reverse_proxy_companion_synapse_stream_writer_receipts_stream_worker_client_server_locations, 'stream_writer_receipts_stream_workers_upstream') }} | |||||
| {% endif %} | |||||
| {% if stream_writer_presence_stream_workers | length > 0 %} | |||||
| # https://matrix-org.github.io/synapse/latest/workers.html#the-presence-stream | |||||
| {{ render_locations_to_upstream(matrix_synapse_reverse_proxy_companion_synapse_stream_writer_presence_stream_worker_client_server_locations, 'stream_writer_presence_stream_workers_upstream') }} | |||||
| {% endif %} | |||||
| {% if room_workers | length > 0 %} | {% if room_workers | length > 0 %} | ||||
| # room workers | # room workers | ||||
| # https://tcpipuk.github.io/synapse/deployment/workers.html | # https://tcpipuk.github.io/synapse/deployment/workers.html | ||||
| @@ -31,7 +31,7 @@ matrix_synapse_workers_sync_worker_client_server_endpoints: | |||||
| # Client reader workers handle generic client-server endpoints that don't contain a roomid or sync | # Client reader workers handle generic client-server endpoints that don't contain a roomid or sync | ||||
| matrix_synapse_workers_client_reader_client_server_endpoints: | matrix_synapse_workers_client_reader_client_server_endpoints: | ||||
| - ^/_matrix/client/(api/v1|r0|v3|unstable)/(room_keys/|keys/(query|changes|claim|upload/|room_keys/)|login|register(/available|/m.login.registration_token/validity|)|password_policy|profile|rooms/.*/(joined_members|context/.*|members|state|hierarchy|relations/|event/|aliases|timestamp_to_event|redact|send|state/|(join|invite|leave|ban|unban|kick))|createRoom|publicRooms|account/(3pid|whoami|devices)|versions|voip/turnServer|joined_rooms|search|user/.*/filter(/|$)|directory/room/.*|capabilities) | |||||
| - ^/_matrix/client/(api/v1|r0|v3|unstable)/(room_keys/|keys/(query|changes|claim|room_keys/)|login|register(/available|/m.login.registration_token/validity|)|password_policy|profile|rooms/.*/(joined_members|context/.*|members|state|hierarchy|relations/|event/|aliases|timestamp_to_event|redact|send|state/|(join|invite|leave|ban|unban|kick))|createRoom|publicRooms|account/(3pid|whoami|devices)|versions|voip/turnServer|joined_rooms|search|user/.*/filter(/|$)|directory/room/.*|capabilities) | |||||
| # Federation reader workers handle generic federation endpoints that don't contain a roomid | # Federation reader workers handle generic federation endpoints that don't contain a roomid | ||||
| matrix_synapse_workers_federation_reader_federation_endpoints: | matrix_synapse_workers_federation_reader_federation_endpoints: | ||||
| @@ -93,6 +93,20 @@ matrix_synapse_workers_stream_writer_receipts_stream_worker_client_server_endpoi | |||||
| matrix_synapse_workers_stream_writer_presence_stream_worker_client_server_endpoints: | matrix_synapse_workers_stream_writer_presence_stream_worker_client_server_endpoints: | ||||
| - ^/_matrix/client/(api/v1|r0|v3|unstable)/presence/ | - ^/_matrix/client/(api/v1|r0|v3|unstable)/presence/ | ||||
| # matrix_synapse_workers_stream_writer_push_rules_stream_worker_client_server_endpoints contains the endpoints serviced by the `push_rules` stream writer. | |||||
| # See: https://matrix-org.github.io/synapse/latest/workers.html#the-push_rules-stream | |||||
| matrix_synapse_workers_stream_writer_push_rules_stream_worker_client_server_endpoints: | |||||
| - ^/_matrix/client/(api/v1|r0|v3|unstable)/pushrules/ | |||||
| # matrix_synapse_workers_stream_writer_device_lists_stream_worker_client_server_endpoints contains the endpoints serviced by the `device_lists` stream writer. | |||||
| # See: https://matrix-org.github.io/synapse/latest/workers.html#the-device_lists-stream | |||||
| matrix_synapse_workers_stream_writer_device_lists_stream_worker_client_server_endpoints: | |||||
| - ^/_matrix/client/(r0|v3)/delete_devices$ | |||||
| - ^/_matrix/client/(api/v1|r0|v3|unstable)/devices(/|$) | |||||
| - ^/_matrix/client/(r0|v3|unstable)/keys/upload(/|$) | |||||
| - ^/_matrix/client/(api/v1|r0|v3|unstable)/keys/device_signing/upload$ | |||||
| - ^/_matrix/client/(api/v1|r0|v3|unstable)/keys/signatures/upload$ | |||||
| # matrix_synapse_workers_user_dir_worker_client_server_endpoints contains the endpoints serviced by the `type = user_dir` (`app = generic_worker`) worker. | # matrix_synapse_workers_user_dir_worker_client_server_endpoints contains the endpoints serviced by the `type = user_dir` (`app = generic_worker`) worker. | ||||
| # See: https://matrix-org.github.io/synapse/latest/workers.html#updating-the-user-directory | # See: https://matrix-org.github.io/synapse/latest/workers.html#updating-the-user-directory | ||||
| matrix_synapse_workers_user_dir_worker_client_server_endpoints: | matrix_synapse_workers_user_dir_worker_client_server_endpoints: | ||||
| @@ -101,11 +115,11 @@ matrix_synapse_workers_user_dir_worker_client_server_endpoints: | |||||
| # matrix_synapse_workers_known_stream_writer_stream_types contains the list of stream writer stream types that the playbook recognizes. | # matrix_synapse_workers_known_stream_writer_stream_types contains the list of stream writer stream types that the playbook recognizes. | ||||
| # This is used for validation purposes. If adding support for a new type, besides adding it to this list, | # This is used for validation purposes. If adding support for a new type, besides adding it to this list, | ||||
| # don't forget to actually configure it where appropriate (see worker.yaml.j2`, the nginx proxy configuration, etc). | # don't forget to actually configure it where appropriate (see worker.yaml.j2`, the nginx proxy configuration, etc). | ||||
| matrix_synapse_workers_known_stream_writer_stream_types: ['events', 'typing', 'to_device', 'account_data', 'receipts', 'presence'] | |||||
| matrix_synapse_workers_known_stream_writer_stream_types: ['events', 'typing', 'to_device', 'account_data', 'receipts', 'presence', 'push_rules', 'device_lists'] | |||||
| # matrix_synapse_workers_webserving_stream_writer_types contains a list of stream writer types that serve web (client) requests. | # matrix_synapse_workers_webserving_stream_writer_types contains a list of stream writer types that serve web (client) requests. | ||||
| # Not all stream writers serve web requests. Some just perform background tasks. | # Not all stream writers serve web requests. Some just perform background tasks. | ||||
| matrix_synapse_workers_webserving_stream_writer_types: ['typing', 'to_device', 'account_data', 'receipts', 'presence'] | |||||
| matrix_synapse_workers_webserving_stream_writer_types: ['typing', 'to_device', 'account_data', 'receipts', 'presence', 'push_rules', 'device_lists'] | |||||
| # matrix_synapse_workers_systemd_services_list contains a list of systemd services (one for each worker systemd service which serves web requests). | # matrix_synapse_workers_systemd_services_list contains a list of systemd services (one for each worker systemd service which serves web requests). | ||||
| # This list is built during runtime. | # This list is built during runtime. | ||||
| @@ -190,7 +204,6 @@ matrix_synapse_workers_generic_worker_endpoints: | |||||
| - ^/_matrix/client/unstable/im.nheko.summary/rooms/.*/summary$ | - ^/_matrix/client/unstable/im.nheko.summary/rooms/.*/summary$ | ||||
| - ^/_matrix/client/(r0|v3|unstable)/account/3pid$ | - ^/_matrix/client/(r0|v3|unstable)/account/3pid$ | ||||
| - ^/_matrix/client/(r0|v3|unstable)/account/whoami$ | - ^/_matrix/client/(r0|v3|unstable)/account/whoami$ | ||||
| - ^/_matrix/client/(r0|v3|unstable)/devices$ | |||||
| - ^/_matrix/client/versions$ | - ^/_matrix/client/versions$ | ||||
| - ^/_matrix/client/(api/v1|r0|v3|unstable)/voip/turnServer$ | - ^/_matrix/client/(api/v1|r0|v3|unstable)/voip/turnServer$ | ||||
| - ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/event/ | - ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/event/ | ||||
| @@ -208,9 +221,6 @@ matrix_synapse_workers_generic_worker_endpoints: | |||||
| - ^/_matrix/client/(r0|v3|unstable)/keys/changes$ | - ^/_matrix/client/(r0|v3|unstable)/keys/changes$ | ||||
| - ^/_matrix/client/(r0|v3|unstable)/keys/claim$ | - ^/_matrix/client/(r0|v3|unstable)/keys/claim$ | ||||
| - ^/_matrix/client/(r0|v3|unstable)/room_keys/ | - ^/_matrix/client/(r0|v3|unstable)/room_keys/ | ||||
| - ^/_matrix/client/(r0|v3|unstable)/keys/upload$ | |||||
| - ^/_matrix/client/(api/v1|r0|v3|unstable)/keys/device_signing/upload$ | |||||
| - ^/_matrix/client/(api/v1|r0|v3|unstable)/keys/signatures/upload$ | |||||
| # Registration/login requests | # Registration/login requests | ||||
| - ^/_matrix/client/(api/v1|r0|v3|unstable)/login$ | - ^/_matrix/client/(api/v1|r0|v3|unstable)/login$ | ||||
| @@ -236,11 +246,14 @@ matrix_synapse_workers_generic_worker_endpoints: | |||||
| # Start of intentionally-ignored-endpoints | # Start of intentionally-ignored-endpoints | ||||
| # | # | ||||
| # We ignore these below, because they're better sent to dedicated workers (various stream writers). | |||||
| # If a stream writer is enabled, the endpoint should be routed to the stream writer, not to a generic worker. | |||||
| # If a stream writer of a given type is not enabled, then a generic worker may process it. | |||||
| # Because it's difficult to handle these individually based on which stream writer is enabled and which isn't, | |||||
| # we just disable them here. | |||||
| # We ignore these below, because they are now supposed to be owned by explicit | |||||
| # early stream-backed routing in the reverse proxy. | |||||
| # | |||||
| # The intended behavior is: | |||||
| # - if a stream writer is enabled, route to that stream writer | |||||
| # - otherwise, route to Synapse `main` | |||||
| # | |||||
| # Broad generic-worker routing must not decide fallback behavior for these. | |||||
| # | # | ||||
| # # Account data requests | # # Account data requests | ||||
| # - ^/_matrix/client/(r0|v3|unstable)/.*/tags | # - ^/_matrix/client/(r0|v3|unstable)/.*/tags | ||||
| @@ -253,6 +266,16 @@ matrix_synapse_workers_generic_worker_endpoints: | |||||
| # # Presence requests | # # Presence requests | ||||
| # - ^/_matrix/client/(api/v1|r0|v3|unstable)/presence/ | # - ^/_matrix/client/(api/v1|r0|v3|unstable)/presence/ | ||||
| # | # | ||||
| # # Push rules requests | |||||
| # - ^/_matrix/client/(api/v1|r0|v3|unstable)/pushrules/ | |||||
| # | |||||
| # # Device lists requests | |||||
| # - ^/_matrix/client/(r0|v3)/delete_devices$ | |||||
| # - ^/_matrix/client/(api/v1|r0|v3|unstable)/devices(/|$) | |||||
| # - ^/_matrix/client/(r0|v3|unstable)/keys/upload(/|$) | |||||
| # - ^/_matrix/client/(api/v1|r0|v3|unstable)/keys/device_signing/upload$ | |||||
| # - ^/_matrix/client/(api/v1|r0|v3|unstable)/keys/signatures/upload$ | |||||
| # | |||||
| # # User directory search requests | # # User directory search requests | ||||
| # - ^/_matrix/client/(r0|v3|unstable)/user_directory/search$ | # - ^/_matrix/client/(r0|v3|unstable)/user_directory/search$ | ||||
| # End of intentionally-ignored-endpoints | # End of intentionally-ignored-endpoints | ||||