Matrix Docker Ansible eploy
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 

291 rader
16 KiB

  1. # SPDX-FileCopyrightText: 2019 - 2024 Slavi Pantaleev
  2. # SPDX-FileCopyrightText: 2022 Nikita Chernyi
  3. # SPDX-FileCopyrightText: 2023 Alexis Yushin
  4. # SPDX-FileCopyrightText: 2024 Charles Wright
  5. # SPDX-FileCopyrightText: 2024 Suguru Hirahara
  6. #
  7. # SPDX-License-Identifier: AGPL-3.0-or-later
  8. ---
  9. matrix_synapse_client_api_url_endpoint_public: "{{ 'https' if matrix_playbook_ssl_enabled else 'http' }}://{{ matrix_server_fqn_matrix }}/_matrix/client/versions"
  10. matrix_synapse_federation_api_url_endpoint_public: "{{ 'https' if matrix_playbook_ssl_enabled else 'http' }}://{{ matrix_server_fqn_matrix }}:{{ matrix_federation_public_port }}/_matrix/federation/v1/version"
  11. matrix_synapse_media_store_directory_name: "{{ matrix_synapse_media_store_path | basename }}"
  12. # Optionally: `false` to fully disable tls on outbound smtp
  13. matrix_synapse_email_smtp_enable_tls: true
  14. # Room workers handle any URL that contains a room ID, either through the client-server API or the federation API
  15. # - see https://tcpipuk.github.io/synapse/deployment/nginx.html#locationsconf
  16. matrix_synapse_workers_room_worker_client_server_endpoints:
  17. - ^/_matrix/client/.*?!(?<room>[A-Za-z0-9._=\-\/]+):[A-Za-z0-9.\-]+
  18. matrix_synapse_workers_room_worker_federation_endpoints:
  19. - ^/_matrix/federation/v[12]/(?:state_ids|get_missing_events)/(?:%21|!)(?<room>[A-Za-z0-9._=\-\/]+)(:|%3A)[A-Za-z0-9.\-]+
  20. # Sync workers handle /sync and the (now deprecated) related endpoints
  21. matrix_synapse_workers_sync_worker_client_server_endpoints:
  22. - ^/_matrix/client/(api/v1|r0|v3|unstable)/(sync|events|initialSync|rooms/[^/]+/initialSync)$
  23. # Client reader workers handle generic client-server endpoints that don't contain a roomid or sync
  24. matrix_synapse_workers_client_reader_client_server_endpoints:
  25. - ^/_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)
  26. # Federation reader workers handle generic federation endpoints that don't contain a roomid
  27. matrix_synapse_workers_federation_reader_federation_endpoints:
  28. - ^/_matrix/(federation/(v1|v2)|key/v2)/
  29. # A Synapse generic worker can handle both federation and client-server API endpoints.
  30. # We wish to split these, as we normally serve federation separately and don't want them mixed up.
  31. #
  32. # This is some ugly Ansible/Jinja2 hack (seen here: https://stackoverflow.com/a/47831492),
  33. # which takes a list of various strings and removes the ones NOT containing `/_matrix/client` anywhere in them.
  34. #
  35. # We intentionally don't do a diff between everything possible (`matrix_synapse_workers_generic_worker_endpoints`) and `matrix_synapse_workers_generic_worker_federation_endpoints`,
  36. # because `matrix_synapse_workers_generic_worker_endpoints` also contains things like `/_synapse/client/`, etc.
  37. # While /_synapse/client/ endpoints are somewhat client-server API-related, they're:
  38. # - neither part of the client-server API spec (and are thus, different)
  39. # - nor always OK to forward to a worker (we're supposed to obey `matrix_synapse_companion_container_labels_client_synapse_client_api_enabled`)
  40. #
  41. # It's also not too many of these APIs (only `^/_synapse/client/password_reset/email/submit_token$` at the time of this writing / 2021-01-24),
  42. # so it's not that important whether we forward them or not.
  43. #
  44. # Basically, we aim to cover most things. Skipping `/_synapse/client` or a few other minor things doesn't matter too much.
  45. matrix_synapse_workers_generic_worker_client_server_endpoints: "{{ matrix_synapse_workers_generic_worker_endpoints | default([]) | map('regex_search', '.*/_matrix/client.*') | list | difference([none]) }}"
  46. # A Synapse generic worker can handle both federation and client-server API endpoints.
  47. # We wish to split these, as we normally serve federation separately and don't want them mixed up.
  48. #
  49. # This is some ugly Ansible/Jinja2 hack (seen here: https://stackoverflow.com/a/47831492),
  50. # which takes a list of various strings and removes the ones NOT containing `/_matrix/federation` or `/_matrix/key` anywhere in them.
  51. matrix_synapse_workers_generic_worker_federation_endpoints: "{{ matrix_synapse_workers_generic_worker_endpoints | default([]) | map('regex_search', matrix_synapse_workers_generic_worker_federation_endpoints_regex) | list | difference([none]) }}"
  52. # matrix_synapse_workers_generic_worker_federation_endpoints_regex contains the regex used in matrix_synapse_workers_generic_worker_federation_endpoints.
  53. # It's intentionally put in a separate variable, to avoid tripping ansible-lint's jinja[spacing] rule.
  54. matrix_synapse_workers_generic_worker_federation_endpoints_regex: '.*(/_matrix/federation|/_matrix/key).*'
  55. # matrix_synapse_workers_stream_writer_typing_stream_worker_client_server_endpoints contains the endpoints serviced by the `typing` stream writer.
  56. # See: https://matrix-org.github.io/synapse/latest/workers.html#the-typing-stream
  57. matrix_synapse_workers_stream_writer_typing_stream_worker_client_server_endpoints:
  58. - ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/typing
  59. # matrix_synapse_workers_stream_writer_to_device_stream_worker_client_server_endpoints contains the endpoints serviced by the `to_device` stream writer.
  60. # See: https://matrix-org.github.io/synapse/latest/workers.html#the-to_device-stream
  61. matrix_synapse_workers_stream_writer_to_device_stream_worker_client_server_endpoints:
  62. - ^/_matrix/client/(r0|v3|unstable)/sendToDevice/
  63. # matrix_synapse_workers_stream_writer_account_data_stream_worker_client_server_endpoints contains the endpoints serviced by the `account_data` stream writer.
  64. # See: https://matrix-org.github.io/synapse/latest/workers.html#the-account_data-stream
  65. matrix_synapse_workers_stream_writer_account_data_stream_worker_client_server_endpoints:
  66. - ^/_matrix/client/(r0|v3|unstable)/.*/tags
  67. - ^/_matrix/client/(r0|v3|unstable)/.*/account_data
  68. # matrix_synapse_workers_stream_writer_receipts_stream_worker_client_server_endpoints contains the endpoints serviced by the `recepts` stream writer.
  69. # See: https://matrix-org.github.io/synapse/latest/workers.html#the-receipts-stream
  70. matrix_synapse_workers_stream_writer_receipts_stream_worker_client_server_endpoints:
  71. - ^/_matrix/client/(r0|v3|unstable)/rooms/.*/receipt
  72. - ^/_matrix/client/(r0|v3|unstable)/rooms/.*/read_markers
  73. # matrix_synapse_workers_stream_writer_presence_stream_worker_client_server_endpoints contains the endpoints serviced by the `presence` stream writer.
  74. # See: https://matrix-org.github.io/synapse/latest/workers.html#the-presence-stream
  75. matrix_synapse_workers_stream_writer_presence_stream_worker_client_server_endpoints:
  76. - ^/_matrix/client/(api/v1|r0|v3|unstable)/presence/
  77. # matrix_synapse_workers_user_dir_worker_client_server_endpoints contains the endpoints serviced by the `type = user_dir` (`app = generic_worker`) worker.
  78. # See: https://matrix-org.github.io/synapse/latest/workers.html#updating-the-user-directory
  79. matrix_synapse_workers_user_dir_worker_client_server_endpoints:
  80. - ^/_matrix/client/(r0|v3|unstable)/user_directory/search$
  81. # matrix_synapse_workers_known_stream_writer_stream_types contains the list of stream writer stream types that the playbook recognizes.
  82. # This is used for validation purposes. If adding support for a new type, besides adding it to this list,
  83. # don't forget to actually configure it where appropriate (see worker.yaml.j2`, the nginx proxy configuration, etc).
  84. matrix_synapse_workers_known_stream_writer_stream_types: ['events', 'typing', 'to_device', 'account_data', 'receipts', 'presence']
  85. # matrix_synapse_workers_webserving_stream_writer_types contains a list of stream writer types that serve web (client) requests.
  86. # Not all stream writers serve web requests. Some just perform background tasks.
  87. matrix_synapse_workers_webserving_stream_writer_types: ['typing', 'to_device', 'account_data', 'receipts', 'presence']
  88. # matrix_synapse_workers_systemd_services_list contains a list of systemd services (one for each worker systemd service which serves web requests).
  89. # This list is built during runtime.
  90. # Not all workers serve web requests. Those that don't won't be injected here.
  91. matrix_synapse_webserving_workers_systemd_services_list: []
  92. # matrix_synapse_known_worker_types contains the list of known worker types.
  93. #
  94. # A worker type is different than a worker app (e.g. `generic_worker`).
  95. # For example, the `stream_writer` worker type is served by the `generic_worker` app, but is a separate type that we recognize.
  96. #
  97. # Some other types (`appservice` and `user_dir`) used to be Synapse worker apps, which got subsequently deprecated.
  98. # We still allow these types of workers and map them to the `generic_worker` app,
  99. # which is why we make sure they're part of the list below.
  100. # We use the `unique` filter because they're part of `matrix_synapse_workers_avail_list` too (for now; scheduled for removal).
  101. matrix_synapse_known_worker_types: |
  102. {{
  103. (
  104. matrix_synapse_workers_avail_list
  105. +
  106. ['stream_writer']
  107. +
  108. ['appservice']
  109. +
  110. ['user_dir']
  111. +
  112. ['background']
  113. ) | unique
  114. }}
  115. # matrix_synapse_known_instance_map_eligible_worker_types contains the list of worker types that are to be injected into `matrix_synapse_instance_map`.
  116. matrix_synapse_known_instance_map_eligible_worker_types:
  117. - stream_writer
  118. # The following section contains content that had previously been generated by a script (`workers-doc-to-yaml.awk`) processing https://github.com/element-hq/synapse/raw/master/docs/workers.md,
  119. # but is now maintained manually due to:
  120. # - the script being tripped up by the content and generating somewhat inaccurate definitions, which had to be fixed up manually.
  121. # - the script being complicated and unmaintainable
  122. ### workers:start
  123. matrix_synapse_workers_generic_worker_endpoints:
  124. # Sync requests
  125. - ^/_matrix/client/(r0|v3)/sync$
  126. - ^/_matrix/client/(api/v1|r0|v3)/events$
  127. - ^/_matrix/client/(api/v1|r0|v3)/initialSync$
  128. - ^/_matrix/client/(api/v1|r0|v3)/rooms/[^/]+/initialSync$
  129. # Federation requests
  130. - ^/_matrix/federation/v1/event/
  131. - ^/_matrix/federation/v1/state/
  132. - ^/_matrix/federation/v1/state_ids/
  133. - ^/_matrix/federation/v1/backfill/
  134. - ^/_matrix/federation/v1/get_missing_events/
  135. - ^/_matrix/federation/v1/publicRooms
  136. - ^/_matrix/federation/v1/query/
  137. - ^/_matrix/federation/v1/make_join/
  138. - ^/_matrix/federation/v1/make_leave/
  139. - ^/_matrix/federation/(v1|v2)/send_join/
  140. - ^/_matrix/federation/(v1|v2)/send_leave/
  141. - ^/_matrix/federation/(v1|v2)/invite/
  142. - ^/_matrix/federation/v1/event_auth/
  143. - ^/_matrix/federation/v1/timestamp_to_event/
  144. - ^/_matrix/federation/v1/exchange_third_party_invite/
  145. - ^/_matrix/federation/v1/user/devices/
  146. - ^/_matrix/key/v2/query
  147. - ^/_matrix/federation/v1/hierarchy/
  148. # Inbound federation transaction request
  149. - ^/_matrix/federation/v1/send/
  150. # Client API requests
  151. - ^/_matrix/client/(api/v1|r0|v3|unstable)/createRoom$
  152. - ^/_matrix/client/(api/v1|r0|v3|unstable)/publicRooms$
  153. - ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/joined_members$
  154. - ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/context/.*$
  155. - ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/members$
  156. - ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/state$
  157. - ^/_matrix/client/v1/rooms/.*/hierarchy$
  158. - ^/_matrix/client/(v1|unstable)/rooms/.*/relations/
  159. - ^/_matrix/client/v1/rooms/.*/threads$
  160. - ^/_matrix/client/unstable/im.nheko.summary/rooms/.*/summary$
  161. - ^/_matrix/client/(r0|v3|unstable)/account/3pid$
  162. - ^/_matrix/client/(r0|v3|unstable)/account/whoami$
  163. - ^/_matrix/client/(r0|v3|unstable)/devices$
  164. - ^/_matrix/client/versions$
  165. - ^/_matrix/client/(api/v1|r0|v3|unstable)/voip/turnServer$
  166. - ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/event/
  167. - ^/_matrix/client/(api/v1|r0|v3|unstable)/joined_rooms$
  168. - ^/_matrix/client/v1/rooms/.*/timestamp_to_event$
  169. - ^/_matrix/client/(api/v1|r0|v3|unstable/.*)/rooms/.*/aliases
  170. - ^/_matrix/client/(api/v1|r0|v3|unstable)/search$
  171. - ^/_matrix/client/(r0|v3|unstable)/user/.*/filter(/|$)
  172. - ^/_matrix/client/(api/v1|r0|v3|unstable)/directory/room/.*$
  173. - ^/_matrix/client/(r0|v3|unstable)/capabilities$
  174. - ^/_matrix/client/(r0|v3|unstable)/notifications$
  175. # Encryption requests
  176. - ^/_matrix/client/(r0|v3|unstable)/keys/query$
  177. - ^/_matrix/client/(r0|v3|unstable)/keys/changes$
  178. - ^/_matrix/client/(r0|v3|unstable)/keys/claim$
  179. - ^/_matrix/client/(r0|v3|unstable)/room_keys/
  180. - ^/_matrix/client/(r0|v3|unstable)/keys/upload$
  181. - ^/_matrix/client/(api/v1|r0|v3|unstable)/keys/device_signing/upload$
  182. - ^/_matrix/client/(api/v1|r0|v3|unstable)/keys/signatures/upload$
  183. # Registration/login requests
  184. - ^/_matrix/client/(api/v1|r0|v3|unstable)/login$
  185. - ^/_matrix/client/(r0|v3|unstable)/register$
  186. - ^/_matrix/client/(r0|v3|unstable)/register/available$
  187. - ^/_matrix/client/v1/register/m.login.registration_token/validity$
  188. - ^/_matrix/client/(r0|v3|unstable)/password_policy$
  189. # Event sending requests
  190. - ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/redact
  191. - ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/send
  192. - ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/state/
  193. - ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/(join|invite|leave|ban|unban|kick)$
  194. - ^/_matrix/client/(api/v1|r0|v3|unstable)/join/
  195. - ^/_matrix/client/(api/v1|r0|v3|unstable)/knock/
  196. - ^/_matrix/client/(api/v1|r0|v3|unstable)/profile/
  197. # Unstable MSC4140 support
  198. - ^/_matrix/client/unstable/org.matrix.msc4140/delayed_events(/.*/restart)?$
  199. # Admin API requests
  200. - ^/_synapse/admin/v2/users/[^/]+$
  201. # Start of intentionally-ignored-endpoints
  202. #
  203. # We ignore these below, because they're better sent to dedicated workers (various stream writers).
  204. # If a stream writer is enabled, the endpoint should be routed to the stream writer, not to a generic worker.
  205. # If a stream writer of a given type is not enabled, then a generic worker may process it.
  206. # Because it's difficult to handle these individually based on which stream writer is enabled and which isn't,
  207. # we just disable them here.
  208. #
  209. # # Account data requests
  210. # - ^/_matrix/client/(r0|v3|unstable)/.*/tags
  211. # - ^/_matrix/client/(r0|v3|unstable)/.*/account_data
  212. #
  213. # # Receipts requests
  214. # - ^/_matrix/client/(r0|v3|unstable)/rooms/.*/receipt
  215. # - ^/_matrix/client/(r0|v3|unstable)/rooms/.*/read_markers
  216. #
  217. # # Presence requests
  218. # - ^/_matrix/client/(api/v1|r0|v3|unstable)/presence/
  219. #
  220. # # User directory search requests
  221. # - ^/_matrix/client/(r0|v3|unstable)/user_directory/search$
  222. # End of intentionally-ignored-endpoints
  223. matrix_synapse_workers_media_repository_endpoints:
  224. # Handles the media repository. It can handle all endpoints starting with:
  225. - ^/_matrix/media/
  226. - ^/_matrix/client/v1/media/
  227. - ^/_matrix/federation/v1/media/
  228. # … and the following regular expressions matching media-specific administration APIs:
  229. - ^/_synapse/admin/v1/purge_media_cache$
  230. - ^/_synapse/admin/v1/room/.*/media.*$
  231. - ^/_synapse/admin/v1/user/.*/media.*$
  232. - ^/_synapse/admin/v1/media/.*$
  233. - ^/_synapse/admin/v1/quarantine_media/.*$
  234. - ^/_synapse/admin/v1/users/.*/media$
  235. matrix_synapse_workers_user_dir_endpoints:
  236. # Handles searches in the user directory. It can handle REST endpoints matching
  237. # the following regular expressions:
  238. - ^/_matrix/client/(r0|v3|unstable)/user_directory/search$
  239. matrix_synapse_workers_avail_list:
  240. - appservice
  241. - client_reader
  242. - federation_reader
  243. - federation_sender
  244. - generic_worker
  245. - media_repository
  246. - pusher
  247. - room_worker
  248. - sync_worker
  249. - user_dir
  250. ### workers:end