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.
 
 

364 rader
30 KiB

  1. # SPDX-FileCopyrightText: 2022 - 2024 Slavi Pantaleev
  2. # SPDX-FileCopyrightText: 2023 - 2024 Nikita Chernyi
  3. # SPDX-FileCopyrightText: 2023 Dan Arnfield
  4. # SPDX-FileCopyrightText: 2023 Samuel Meenzen
  5. # SPDX-FileCopyrightText: 2024 Charles Wright
  6. # SPDX-FileCopyrightText: 2024 David Mehren
  7. # SPDX-FileCopyrightText: 2024 Michael Hollister
  8. # SPDX-FileCopyrightText: 2024 - 2025 Catalan Lover <catalanlover@protonmail.com>
  9. #
  10. # SPDX-License-Identifier: AGPL-3.0-or-later
  11. ---
  12. # matrix-synapse-reverse-proxy-companion is a role which brings up a containerized nginx webserver which helps with reverse-proxying to Synapse when workers are enabled.
  13. #
  14. # When Synapse is NOT running in worker-mode, reverse-proxying is relatively simple (everything goes to `matrix-synapse:XXXX`).
  15. # In such cases, using this reverse-proxy companion is possible, but unnecessary - it's one more service in the stack, which also impacts performance a bit.
  16. #
  17. # When Synapse workers are enabled, however, the reverse-proxying configuration is much more complicated - certain requests need to go to certain workers, etc.
  18. # matrix-synapse-reverse-proxy-companion is the central place services that need to reach Synapse could be pointed to.
  19. #
  20. # Project source code URL: https://github.com/nginx/nginx
  21. matrix_synapse_reverse_proxy_companion_enabled: true
  22. # renovate: datasource=docker depName=nginx
  23. matrix_synapse_reverse_proxy_companion_version: 1.29.4-alpine
  24. matrix_synapse_reverse_proxy_companion_base_path: "{{ matrix_synapse_base_path }}/reverse-proxy-companion"
  25. matrix_synapse_reverse_proxy_companion_confd_path: "{{ matrix_synapse_reverse_proxy_companion_base_path }}/conf.d"
  26. matrix_synapse_reverse_proxy_companion_njs_path: "{{ matrix_synapse_reverse_proxy_companion_base_path }}/njs"
  27. # List of systemd services that matrix-synapse-reverse-proxy-companion.service depends on
  28. matrix_synapse_reverse_proxy_companion_systemd_required_services_list: "{{ matrix_synapse_reverse_proxy_companion_systemd_required_services_list_default + matrix_synapse_reverse_proxy_companion_systemd_required_services_list_auto + matrix_synapse_reverse_proxy_companion_systemd_required_services_list_custom }}"
  29. matrix_synapse_reverse_proxy_companion_systemd_required_services_list_default: "{{ [devture_systemd_docker_base_docker_service_name] if devture_systemd_docker_base_docker_service_name else [] }}"
  30. matrix_synapse_reverse_proxy_companion_systemd_required_services_list_auto: []
  31. matrix_synapse_reverse_proxy_companion_systemd_required_services_list_custom: []
  32. # List of systemd services that matrix-synapse-reverse-proxy-companion.service wants
  33. matrix_synapse_reverse_proxy_companion_systemd_wanted_services_list: ['matrix-synapse.service']
  34. # We use an official nginx image, which we fix-up to run unprivileged.
  35. # An alternative would be an `nginxinc/nginx-unprivileged` image, but
  36. # that is frequently out of date.
  37. matrix_synapse_reverse_proxy_companion_container_image: "{{ matrix_synapse_reverse_proxy_companion_container_image_registry_prefix }}nginx:{{ matrix_synapse_reverse_proxy_companion_container_image_tag }}"
  38. matrix_synapse_reverse_proxy_companion_container_image_registry_prefix: "{{ matrix_synapse_reverse_proxy_companion_container_image_registry_prefix_upstream }}"
  39. matrix_synapse_reverse_proxy_companion_container_image_registry_prefix_upstream: "{{ matrix_synapse_reverse_proxy_companion_container_image_registry_prefix_upstream_default }}"
  40. matrix_synapse_reverse_proxy_companion_container_image_registry_prefix_upstream_default: "docker.io/"
  41. matrix_synapse_reverse_proxy_companion_container_image_tag: "{{ matrix_synapse_reverse_proxy_companion_version }}"
  42. matrix_synapse_reverse_proxy_companion_container_image_force_pull: "{{ matrix_synapse_reverse_proxy_companion_container_image.endswith(':latest') }}"
  43. matrix_synapse_reverse_proxy_companion_container_network: ""
  44. # A list of additional container networks that matrix-synapse-reverse-proxy-companion would be connected to.
  45. # The playbook does not create these networks, so make sure they already exist.
  46. matrix_synapse_reverse_proxy_companion_container_additional_networks: "{{ matrix_synapse_reverse_proxy_companion_container_additional_networks_auto + matrix_synapse_reverse_proxy_companion_container_additional_networks_custom }}"
  47. matrix_synapse_reverse_proxy_companion_container_additional_networks_auto: []
  48. matrix_synapse_reverse_proxy_companion_container_additional_networks_custom: []
  49. # Controls whether the matrix-synapse-reverse-proxy-companion container exposes its HTTP Client-Server API port (tcp/8008 in the container).
  50. #
  51. # Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:8008"), or empty string to not expose.
  52. matrix_synapse_reverse_proxy_companion_container_client_api_host_bind_port: ''
  53. # Controls whether the matrix-synapse-reverse-proxy-companion container exposes its HTTP Federation (Server-Server) API port (tcp/8048 in the container).
  54. #
  55. # Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:8048"), or empty string to not expose.
  56. matrix_synapse_reverse_proxy_companion_container_federation_api_host_bind_port: ''
  57. # matrix_synapse_reverse_proxy_companion_container_labels_traefik_enabled controls whether labels to assist a Traefik reverse-proxy will be attached to the container.
  58. # See `../templates/labels.j2` for details.
  59. #
  60. # To inject your own other container labels, see `matrix_synapse_reverse_proxy_companion_container_labels_additional_labels`.
  61. matrix_synapse_reverse_proxy_companion_container_labels_traefik_enabled: true
  62. matrix_synapse_reverse_proxy_companion_container_labels_traefik_docker_network: "{{ matrix_synapse_reverse_proxy_companion_container_network }}"
  63. matrix_synapse_reverse_proxy_companion_container_labels_traefik_entrypoints: web-secure
  64. matrix_synapse_reverse_proxy_companion_container_labels_traefik_tls_certResolver: default # noqa var-naming
  65. matrix_synapse_reverse_proxy_companion_container_labels_traefik_hostname: ''
  66. # Controls whether a compression middleware will be injected into the middlewares list.
  67. # This compression middleware is supposed to be defined elsewhere (using labels or a File provider, etc.) and is merely referenced by this router.
  68. matrix_synapse_reverse_proxy_companion_container_labels_traefik_compression_middleware_enabled: false
  69. matrix_synapse_reverse_proxy_companion_container_labels_traefik_compression_middleware_name: ""
  70. # Controls whether labels will be added that expose the Client-Server API on a public Traefik entrypoint.
  71. matrix_synapse_reverse_proxy_companion_container_labels_public_client_api_enabled: true
  72. matrix_synapse_reverse_proxy_companion_container_labels_public_client_api_traefik_hostname: "{{ matrix_synapse_reverse_proxy_companion_container_labels_traefik_hostname }}"
  73. matrix_synapse_reverse_proxy_companion_container_labels_public_client_api_traefik_path_prefix: /_matrix
  74. matrix_synapse_reverse_proxy_companion_container_labels_public_client_api_traefik_rule: "Host(`{{ matrix_synapse_reverse_proxy_companion_container_labels_public_client_api_traefik_hostname }}`) && PathPrefix(`{{ matrix_synapse_reverse_proxy_companion_container_labels_public_client_api_traefik_path_prefix }}`)"
  75. matrix_synapse_reverse_proxy_companion_container_labels_public_client_api_traefik_priority: 0
  76. matrix_synapse_reverse_proxy_companion_container_labels_public_client_api_traefik_entrypoints: "{{ matrix_synapse_reverse_proxy_companion_container_labels_traefik_entrypoints }}"
  77. matrix_synapse_reverse_proxy_companion_container_labels_public_client_api_traefik_tls: "{{ matrix_synapse_reverse_proxy_companion_container_labels_public_client_api_traefik_entrypoints != 'web' }}"
  78. matrix_synapse_reverse_proxy_companion_container_labels_public_client_api_traefik_tls_certResolver: "{{ matrix_synapse_reverse_proxy_companion_container_labels_traefik_tls_certResolver }}" # noqa var-naming
  79. # Controls whether labels will be added that expose the Client-Server API on the internal Traefik entrypoint.
  80. # This is similar to `matrix_synapse_container_labels_public_client_api_enabled`, but the entrypoint and intent is different.
  81. matrix_synapse_reverse_proxy_companion_container_labels_internal_client_api_enabled: false
  82. matrix_synapse_reverse_proxy_companion_container_labels_internal_client_api_traefik_path_prefix: "{{ matrix_synapse_container_labels_public_client_api_traefik_path_prefix }}"
  83. matrix_synapse_reverse_proxy_companion_container_labels_internal_client_api_traefik_rule: "PathPrefix(`{{ matrix_synapse_reverse_proxy_companion_container_labels_internal_client_api_traefik_path_prefix }}`)"
  84. matrix_synapse_reverse_proxy_companion_container_labels_internal_client_api_traefik_priority: "{{ matrix_synapse_reverse_proxy_companion_container_labels_public_client_api_traefik_priority }}"
  85. matrix_synapse_reverse_proxy_companion_container_labels_internal_client_api_traefik_entrypoints: ""
  86. # Controls whether labels will be added that expose the /_synapse/client paths
  87. matrix_synapse_reverse_proxy_companion_container_labels_public_client_synapse_client_api_enabled: true
  88. matrix_synapse_reverse_proxy_companion_container_labels_public_client_synapse_client_api_traefik_hostname: "{{ matrix_synapse_reverse_proxy_companion_container_labels_traefik_hostname }}"
  89. matrix_synapse_reverse_proxy_companion_container_labels_public_client_synapse_client_api_traefik_path_prefix: /_synapse/client
  90. matrix_synapse_reverse_proxy_companion_container_labels_public_client_synapse_client_api_traefik_rule: "Host(`{{ matrix_synapse_reverse_proxy_companion_container_labels_public_client_synapse_client_api_traefik_hostname }}`) && PathPrefix(`{{ matrix_synapse_reverse_proxy_companion_container_labels_public_client_synapse_client_api_traefik_path_prefix }}`)"
  91. matrix_synapse_reverse_proxy_companion_container_labels_public_client_synapse_client_api_traefik_priority: 0
  92. matrix_synapse_reverse_proxy_companion_container_labels_public_client_synapse_client_api_traefik_entrypoints: "{{ matrix_synapse_reverse_proxy_companion_container_labels_traefik_entrypoints }}"
  93. matrix_synapse_reverse_proxy_companion_container_labels_public_client_synapse_client_api_traefik_tls: "{{ matrix_synapse_reverse_proxy_companion_container_labels_public_client_synapse_client_api_traefik_entrypoints != 'web' }}"
  94. matrix_synapse_reverse_proxy_companion_container_labels_public_client_synapse_client_api_traefik_tls_certResolver: "{{ matrix_synapse_reverse_proxy_companion_container_labels_traefik_tls_certResolver }}" # noqa var-naming
  95. # Controls whether labels will be added that expose the /_synapse/admin paths
  96. # Following these recommendations (https://github.com/element-hq/synapse/blob/master/docs/reverse_proxy.md), by default, we don't.
  97. matrix_synapse_reverse_proxy_companion_container_labels_public_client_synapse_admin_api_enabled: false
  98. matrix_synapse_reverse_proxy_companion_container_labels_public_client_synapse_admin_api_traefik_hostname: "{{ matrix_synapse_reverse_proxy_companion_container_labels_traefik_hostname }}"
  99. matrix_synapse_reverse_proxy_companion_container_labels_public_client_synapse_admin_api_traefik_path_prefix: /_synapse/admin
  100. matrix_synapse_reverse_proxy_companion_container_labels_public_client_synapse_admin_api_traefik_rule: "Host(`{{ matrix_synapse_reverse_proxy_companion_container_labels_public_client_synapse_admin_api_traefik_hostname }}`) && PathPrefix(`{{ matrix_synapse_reverse_proxy_companion_container_labels_public_client_synapse_admin_api_traefik_path_prefix }}`)"
  101. matrix_synapse_reverse_proxy_companion_container_labels_public_client_synapse_admin_api_traefik_priority: 0
  102. matrix_synapse_reverse_proxy_companion_container_labels_public_client_synapse_admin_api_traefik_entrypoints: "{{ matrix_synapse_reverse_proxy_companion_container_labels_traefik_entrypoints }}"
  103. matrix_synapse_reverse_proxy_companion_container_labels_public_client_synapse_admin_api_traefik_tls: "{{ matrix_synapse_reverse_proxy_companion_container_labels_public_client_synapse_admin_api_traefik_entrypoints != 'web' }}"
  104. matrix_synapse_reverse_proxy_companion_container_labels_public_client_synapse_admin_api_traefik_tls_certResolver: "{{ matrix_synapse_reverse_proxy_companion_container_labels_traefik_tls_certResolver }}" # noqa var-naming
  105. # Controls whether labels will be added that expose the /_synapse/admin paths on the internal Traefik entrypoint.
  106. # This is similar to `matrix_synapse_container_labels_public_client_api_enabled`, but the entrypoint and intent is different.
  107. matrix_synapse_reverse_proxy_companion_container_labels_internal_client_synapse_admin_api_enabled: false
  108. matrix_synapse_reverse_proxy_companion_container_labels_internal_client_synapse_admin_api_traefik_path_prefix: "{{ matrix_synapse_container_labels_internal_client_synapse_admin_api_traefik_path_prefix }}"
  109. matrix_synapse_reverse_proxy_companion_container_labels_internal_client_synapse_admin_api_traefik_rule: "PathPrefix(`{{ matrix_synapse_reverse_proxy_companion_container_labels_internal_client_synapse_admin_api_traefik_path_prefix }}`)"
  110. matrix_synapse_reverse_proxy_companion_container_labels_internal_client_synapse_admin_api_traefik_priority: 0
  111. matrix_synapse_reverse_proxy_companion_container_labels_internal_client_synapse_admin_api_traefik_entrypoints: ""
  112. # Controls whether labels will be added that expose the Server-Server API (Federation API).
  113. matrix_synapse_reverse_proxy_companion_container_labels_public_federation_api_enabled: "{{ matrix_synapse_reverse_proxy_companion_federation_api_enabled }}"
  114. matrix_synapse_reverse_proxy_companion_container_labels_public_federation_api_traefik_hostname: "{{ matrix_synapse_reverse_proxy_companion_container_labels_traefik_hostname }}"
  115. matrix_synapse_reverse_proxy_companion_container_labels_public_federation_api_traefik_path_prefix: /_matrix
  116. matrix_synapse_reverse_proxy_companion_container_labels_public_federation_api_traefik_rule: "Host(`{{ matrix_synapse_reverse_proxy_companion_container_labels_public_federation_api_traefik_hostname }}`) && PathPrefix(`{{ matrix_synapse_reverse_proxy_companion_container_labels_public_federation_api_traefik_path_prefix }}`)"
  117. matrix_synapse_reverse_proxy_companion_container_labels_public_federation_api_traefik_priority: 0
  118. matrix_synapse_reverse_proxy_companion_container_labels_public_federation_api_traefik_entrypoints: ''
  119. # TLS is force-enabled here, because the spec (https://spec.matrix.org/v1.9/server-server-api/#tls) says that the federation API must use HTTPS.
  120. matrix_synapse_reverse_proxy_companion_container_labels_public_federation_api_traefik_tls: true
  121. matrix_synapse_reverse_proxy_companion_container_labels_public_federation_api_traefik_tls_certResolver: "{{ matrix_synapse_reverse_proxy_companion_container_labels_traefik_tls_certResolver }}" # noqa var-naming
  122. # matrix_synapse_reverse_proxy_companion_container_labels_additional_labels contains a multiline string with additional labels to add to the container label file.
  123. # See `../templates/labels.j2` for details.
  124. #
  125. # Example:
  126. # matrix_synapse_reverse_proxy_companion_container_labels_additional_labels: |
  127. # my.label=1
  128. # another.label="here"
  129. matrix_synapse_reverse_proxy_companion_container_labels_additional_labels: ''
  130. # A list of extra arguments to pass to the container
  131. # Also see `matrix_synapse_reverse_proxy_companion_container_arguments`
  132. matrix_synapse_reverse_proxy_companion_container_extra_arguments: []
  133. # matrix_synapse_reverse_proxy_companion_container_extra_arguments_auto is a list of extra arguments to pass to the container.
  134. # This list is managed by the playbook. You're not meant to override this variable.
  135. # If you'd like to inject your own arguments, see `matrix_synapse_reverse_proxy_companion_container_extra_arguments`.
  136. matrix_synapse_reverse_proxy_companion_container_extra_arguments_auto: []
  137. # matrix_synapse_reverse_proxy_companion_container_arguments holds the final list of extra arguments to pass to the container.
  138. # You're not meant to override this variable.
  139. # If you'd like to inject your own arguments, see `matrix_synapse_reverse_proxy_companion_container_extra_arguments`.
  140. matrix_synapse_reverse_proxy_companion_container_arguments: "{{ matrix_synapse_reverse_proxy_companion_container_extra_arguments + matrix_synapse_reverse_proxy_companion_container_extra_arguments_auto }}"
  141. # The amount of worker processes and connections
  142. # Consider increasing these when you are expecting high amounts of traffic
  143. # http://nginx.org/en/docs/ngx_core_module.html#worker_connections
  144. matrix_synapse_reverse_proxy_companion_worker_processes: auto
  145. matrix_synapse_reverse_proxy_companion_worker_connections: 1024
  146. # Option to disable the access log
  147. matrix_synapse_reverse_proxy_companion_access_log_enabled: true
  148. # Controls whether to send access logs to a remote syslog-compatible server
  149. matrix_synapse_reverse_proxy_companion_access_log_syslog_integration_enabled: false
  150. matrix_synapse_reverse_proxy_companion_access_log_syslog_integration_server_port: ''
  151. # This is intentionally different. The maximum allowed length is 32 characters and dashes are not allowed.
  152. matrix_synapse_reverse_proxy_companion_access_log_syslog_integration_tag: matrix_synapse_rev_proxy_comp
  153. # The tmpfs at /tmp needs to be large enough to handle multiple concurrent file uploads.
  154. matrix_synapse_reverse_proxy_companion_tmp_directory_size_mb: "{{ (matrix_synapse_reverse_proxy_companion_federation_api_client_max_body_size_mb | int) * 50 }}"
  155. matrix_synapse_reverse_proxy_companion_tmp_cache_directory_size_mb: "{{ (matrix_synapse_reverse_proxy_companion_synapse_cache_max_size_mb | int) * 2 }}"
  156. # A list of strings containing additional configuration blocks to add to the nginx server configuration (nginx.conf).
  157. # for big matrixservers to enlarge the number of open files to prevent timeouts
  158. # matrix_synapse_reverse_proxy_companion_additional_configuration_blocks:
  159. # - 'worker_rlimit_nofile 30000;'
  160. matrix_synapse_reverse_proxy_companion_additional_configuration_blocks: []
  161. # A list of strings containing additional configuration blocks to add to the nginx event server configuration (nginx.conf).
  162. matrix_synapse_reverse_proxy_companion_event_additional_configuration_blocks: []
  163. # A list of strings containing additional configuration blocks to add to the nginx http's server configuration (nginx-http.conf).
  164. matrix_synapse_reverse_proxy_companion_http_additional_server_configuration_blocks: []
  165. # To increase request timeout in NGINX using proxy_read_timeout, proxy_connect_timeout, proxy_send_timeout, send_timeout directives
  166. # Nginx Default: proxy_connect_timeout 60s; #Defines a timeout for establishing a connection with a proxied server
  167. # Nginx Default: proxy_send_timeout 60s; #Sets a timeout for transmitting a request to the proxied server.
  168. # Nginx Default: proxy_read_timeout 60s; #Defines a timeout for reading a response from the proxied server.
  169. # Nginx Default: send_timeout 60s; #Sets a timeout for transmitting a response to the client.
  170. #
  171. # For more information visit:
  172. # http://nginx.org/en/docs/http/ngx_http_proxy_module.html
  173. # http://nginx.org/en/docs/http/ngx_http_core_module.html#send_timeout
  174. # https://www.nginx.com/resources/wiki/start/topics/examples/fullexample2/
  175. #
  176. # Here we are sticking with nginx default values change this value carefully.
  177. matrix_synapse_reverse_proxy_companion_proxy_connect_timeout: 60
  178. matrix_synapse_reverse_proxy_companion_proxy_send_timeout: 60
  179. matrix_synapse_reverse_proxy_companion_proxy_read_timeout: 60
  180. matrix_synapse_reverse_proxy_companion_send_timeout: 60
  181. # For OCSP purposes, we need to define a resolver at the `server{}` level or `http{}` level (we do the latter).
  182. #
  183. # Otherwise, we get warnings like this:
  184. # > [warn] 22#22: no resolver defined to resolve r3.o.lencr.org while requesting certificate status, responder: r3.o.lencr.org, certificate: "/matrix/ssl/config/live/…/fullchain.pem"
  185. #
  186. # We point it to the internal Docker resolver, which likely delegates to nameservers defined in `/etc/resolv.conf`.
  187. matrix_synapse_reverse_proxy_companion_http_level_resolver: 127.0.0.11
  188. matrix_synapse_reverse_proxy_companion_hostname: "matrix-synapse-reverse-proxy-companion"
  189. # matrix_synapse_reverse_proxy_companion_client_api_addr specifies the address where the Client-Server API is
  190. matrix_synapse_reverse_proxy_companion_client_api_addr: 'matrix-synapse:{{ matrix_synapse_container_client_api_port }}'
  191. # The maximum body size for client requests to any of the endpoints on the Client-Server API.
  192. # This needs to be equal or higher than the maximum upload size accepted by Synapse.
  193. matrix_synapse_reverse_proxy_companion_client_api_client_max_body_size_mb: 100
  194. # The buffer size for client requests to any of the endpoints on the Client-Server API.
  195. matrix_synapse_reverse_proxy_companion_client_api_client_body_buffer_size_mb: "{{ matrix_synapse_reverse_proxy_companion_client_api_client_max_body_size_mb }}"
  196. # matrix_synapse_reverse_proxy_companion_federation_api_enabled specifies whether reverse proxying for the Federation (Server-Server) API should be done
  197. matrix_synapse_reverse_proxy_companion_federation_api_enabled: true
  198. # matrix_synapse_reverse_proxy_companion_federation_api_addr specifies the address where the Federation (Server-Server) API is
  199. matrix_synapse_reverse_proxy_companion_federation_api_addr: 'matrix-synapse:{{ matrix_synapse_container_federation_api_plain_port }}'
  200. # The maximum body size for client requests to any of the endpoints on the Federation API.
  201. # We auto-calculate this based on the Client-Server API's maximum body size, but use a minimum value to ensure we don't go to low.
  202. matrix_synapse_reverse_proxy_companion_federation_api_client_max_body_size_mb: "{{ [matrix_synapse_reverse_proxy_companion_federation_api_client_max_body_size_mb_minimum, (matrix_synapse_reverse_proxy_companion_client_api_client_max_body_size_mb | int) * 3] | max }}"
  203. matrix_synapse_reverse_proxy_companion_federation_api_client_max_body_size_mb_minimum: 100
  204. # The buffer size for client requests to any of the endpoints on the Federation API.
  205. matrix_synapse_reverse_proxy_companion_federation_api_client_body_buffer_size_mb: "{{ matrix_synapse_reverse_proxy_companion_federation_api_client_max_body_size_mb }}"
  206. # A list of strings containing additional configuration blocks to add to the nginx vhost handling the Synapse Client-Server API
  207. matrix_synapse_reverse_proxy_companion_synapse_client_api_additional_server_configuration_blocks: []
  208. # A list of strings containing additional configuration blocks to add to the nginx vhost handling the Synapse Federation (Server-Server) API
  209. matrix_synapse_reverse_proxy_companion_synapse_federation_api_additional_server_configuration_blocks: []
  210. # synapse worker activation and endpoint mappings.
  211. # These are all populated via Ansible group variables.
  212. matrix_synapse_reverse_proxy_companion_synapse_workers_enabled: false
  213. matrix_synapse_reverse_proxy_companion_synapse_workers_list: []
  214. matrix_synapse_reverse_proxy_companion_synapse_room_worker_client_server_locations: []
  215. matrix_synapse_reverse_proxy_companion_synapse_room_worker_federation_locations: []
  216. matrix_synapse_reverse_proxy_companion_synapse_sync_worker_client_server_locations: []
  217. matrix_synapse_reverse_proxy_companion_synapse_client_reader_client_server_locations: []
  218. matrix_synapse_reverse_proxy_companion_synapse_federation_reader_federation_locations: []
  219. matrix_synapse_reverse_proxy_companion_synapse_generic_worker_client_server_locations: []
  220. matrix_synapse_reverse_proxy_companion_synapse_generic_worker_federation_locations: []
  221. matrix_synapse_reverse_proxy_companion_synapse_stream_writer_typing_stream_worker_client_server_locations: []
  222. matrix_synapse_reverse_proxy_companion_synapse_stream_writer_to_device_stream_worker_client_server_locations: []
  223. matrix_synapse_reverse_proxy_companion_synapse_stream_writer_account_data_stream_worker_client_server_locations: []
  224. matrix_synapse_reverse_proxy_companion_synapse_stream_writer_receipts_stream_worker_client_server_locations: []
  225. matrix_synapse_reverse_proxy_companion_synapse_stream_writer_presence_stream_worker_client_server_locations: []
  226. matrix_synapse_reverse_proxy_companion_synapse_media_repository_locations: []
  227. matrix_synapse_reverse_proxy_companion_synapse_user_dir_locations: []
  228. 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)
  229. 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)$))
  230. # Related to MSC4108 (https://github.com/matrix-org/matrix-spec-proposals/pull/4108)
  231. matrix_synapse_reverse_proxy_companion_client_server_qr_code_login_locations_regex: ^(/_matrix/client/(unstable|v1)/org.matrix.msc4108/rendezvous|/_synapse/client/rendezvous)$
  232. matrix_synapse_reverse_proxy_companion_federation_override_locations_regex: ^/_matrix/federation/v1/openid/userinfo$
  233. # synapse content caching
  234. matrix_synapse_reverse_proxy_companion_synapse_cache_enabled: false
  235. matrix_synapse_reverse_proxy_companion_synapse_cache_path: /tmp/synapse-cache
  236. matrix_synapse_reverse_proxy_companion_synapse_cache_keys_zone_name: "STATIC"
  237. matrix_synapse_reverse_proxy_companion_synapse_cache_keys_zone_size: "10m"
  238. matrix_synapse_reverse_proxy_companion_synapse_cache_inactive_time: "48h"
  239. matrix_synapse_reverse_proxy_companion_synapse_cache_max_size_mb: 1024
  240. matrix_synapse_reverse_proxy_companion_synapse_cache_proxy_cache_valid_time: "24h"
  241. # Controls whether matrix-synapse-reverse-proxy-companion trusts an upstream server's X-Forwarded-Proto header.
  242. # The `matrix-synapse-reverse-proxy-companion` does not terminate SSL and always expects to be fronted by another reverse-proxy server.
  243. # As such, it trusts the protocol scheme forwarded by the upstream proxy.
  244. matrix_synapse_reverse_proxy_companion_trust_forwarded_proto: true
  245. matrix_synapse_reverse_proxy_companion_x_forwarded_proto_value: "{{ '$http_x_forwarded_proto' if matrix_synapse_reverse_proxy_companion_trust_forwarded_proto else '$scheme' }}"
  246. ########################################################################################
  247. # #
  248. # njs module #
  249. # #
  250. ########################################################################################
  251. # Controls whether the njs module is loaded.
  252. matrix_synapse_reverse_proxy_companion_njs_enabled: "{{ matrix_synapse_reverse_proxy_companion_whoami_sync_worker_router_enabled }}"
  253. ########################################################################################
  254. # #
  255. # /njs module #
  256. # #
  257. ########################################################################################
  258. ########################################################################################
  259. # #
  260. # Whoami-based sync worker routing #
  261. # #
  262. ########################################################################################
  263. # Controls whether the whoami-based sync worker router is enabled.
  264. # When enabled, the reverse proxy will call Synapse's /_matrix/client/v3/account/whoami endpoint
  265. # to resolve access tokens to usernames, allowing consistent routing of requests from the same user
  266. # to the same sync worker regardless of which device or token they use.
  267. #
  268. # This works with any authentication system (native Synapse auth, MAS, etc.) because Synapse
  269. # handles the token validation internally.
  270. #
  271. # Enabled by default when there are sync workers, because sync workers benefit from user-level
  272. # stickiness due to their per-user in-memory caches.
  273. matrix_synapse_reverse_proxy_companion_whoami_sync_worker_router_enabled: "{{ matrix_synapse_reverse_proxy_companion_synapse_workers_list | selectattr('type', 'equalto', 'sync_worker') | list | length > 0 }}"
  274. # The whoami endpoint path (Matrix spec endpoint).
  275. matrix_synapse_reverse_proxy_companion_whoami_sync_worker_router_endpoint: /_matrix/client/v3/account/whoami
  276. # The full URL to the whoami endpoint.
  277. matrix_synapse_reverse_proxy_companion_whoami_sync_worker_router_url: "http://{{ matrix_synapse_reverse_proxy_companion_client_api_addr }}{{ matrix_synapse_reverse_proxy_companion_whoami_sync_worker_router_endpoint }}"
  278. # Cache duration (in seconds) for whoami lookup results.
  279. # Token -> username mappings are cached to avoid repeated whoami calls.
  280. # A longer TTL reduces load on Synapse but means username changes take longer to take effect.
  281. matrix_synapse_reverse_proxy_companion_whoami_sync_worker_router_cache_ttl_seconds: 3600
  282. # Size of the shared memory zone for caching whoami results (in megabytes).
  283. # Each cached entry is approximately 100-200 bytes.
  284. matrix_synapse_reverse_proxy_companion_whoami_sync_worker_router_cache_size_mb: 1
  285. # Controls whether verbose logging is enabled for the whoami sync worker router.
  286. # When enabled, logs cache hits/misses and routing decisions.
  287. # Useful for debugging, but should be disabled in production.
  288. matrix_synapse_reverse_proxy_companion_whoami_sync_worker_router_logging_enabled: false
  289. # The length of the access token to show in logs when logging is enabled.
  290. # Keeping this short is a good idea from a security perspective.
  291. matrix_synapse_reverse_proxy_companion_whoami_sync_worker_router_logging_token_length: 12
  292. # Controls whether debug response headers are added to sync requests.
  293. # When enabled, adds X-Sync-Worker-Router-User-Identifier and X-Sync-Worker-Router-Upstream headers.
  294. # Useful for debugging routing behavior, but should be disabled in production.
  295. matrix_synapse_reverse_proxy_companion_whoami_sync_worker_router_debug_headers_enabled: false
  296. ########################################################################################
  297. # #
  298. # /Whoami-based sync worker routing #
  299. # #
  300. ########################################################################################