Matrix Docker Ansible eploy
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 

180 строки
11 KiB

  1. ---
  2. # matrix-homeserver-proxy is a role which brings up a containerized nginx webserver which helps with reverse-proxying to the Matrix homeserver (Synapse, etc.).
  3. #
  4. # Certain services (like matrix-media-repo, matrix-corporal, identity servers, etc.) may need to capture some requests destined for the homeserver
  5. # and handle them instead of it.
  6. #
  7. # This role helps other services (bots, bridges, etc.) reach the homeserver in a way that:
  8. # - is not very direct, so as to allow for some routes (media repo, etc.) to actually go elsewhere
  9. # - is not via the public network and/or via HTTPS, which introduces major performance penalties
  10. #
  11. # Performance-wise, benchmarks show that:
  12. # - each local (container) nginx hop adds about a 200 rps penalty
  13. # - SSL termination (on the Traefik side) adds a 350 rps penalty
  14. # - going over the public network adds another 70 rps penalty
  15. #
  16. # It's something like this for an existing flow (which will be gone soon):
  17. # 1. public network, Traefik + SSL: 70 rps
  18. # 2. `matrix-nginx-proxy:8008`: 600 rps
  19. # 3. `matrix-nginx-proxy:12080` 850 rps
  20. # 4. `matrix-synapse-reverse-proxy-companion:8008`: 1000 rps
  21. # 5. `matrix-synapse:8008`: 1200 rps
  22. #
  23. # Traefik was additionally benchmarked to see where the slowness comes from. Results are like this:
  24. # 1. public network, Traefik + SSL: 70 rps
  25. # 2. local (container) network, Traefik + SSL: 150 rps
  26. # 3. local (container) network, Traefik without SSL: 500 rps
  27. # 4. `matrix-nginx-proxy:8008`: 600 rps
  28. #
  29. # It's obvious that minimizing the number of hops helps a lot and that not using SSL and/or the public network is important.
  30. matrix_homeserver_proxy_enabled: true
  31. matrix_homeserver_proxy_ident: matrix-homeserver-proxy
  32. # renovate: datasource=docker depName=nginx
  33. matrix_homeserver_proxy_version: 1.25.3-alpine
  34. matrix_homeserver_proxy_base_path: "{{ matrix_base_data_path }}/homeserver-proxy"
  35. matrix_homeserver_proxy_confd_path: "{{ matrix_homeserver_proxy_base_path }}/conf.d"
  36. # List of systemd services that matrix-homeserver-proxy.service depends on
  37. matrix_homeserver_proxy_systemd_required_services_list: ['docker.service']
  38. # List of systemd services that matrix-homeserver-proxy.service wants
  39. matrix_homeserver_proxy_systemd_wanted_services_list: "{{ matrix_homeserver_proxy_systemd_wanted_services_list_auto + matrix_homeserver_proxy_systemd_wanted_services_list_custom }}"
  40. matrix_homeserver_proxy_systemd_wanted_services_list_auto: []
  41. matrix_homeserver_proxy_systemd_wanted_services_list_custom: []
  42. # We use an official nginx image, which we fix-up to run unprivileged.
  43. # An alternative would be an `nginxinc/nginx-unprivileged` image, but that is frequently out of date.
  44. matrix_homeserver_proxy_container_image: "{{ matrix_container_global_registry_prefix }}nginx:{{ matrix_homeserver_proxy_version }}"
  45. matrix_homeserver_proxy_container_image_force_pull: "{{ matrix_homeserver_proxy_container_image.endswith(':latest') }}"
  46. matrix_homeserver_proxy_container_network: matrix-homeserver-proxy
  47. # A list of additional container networks that matrix-homeserver-proxy would be connected to.
  48. # The playbook does not create these networks, so make sure they already exist.
  49. matrix_homeserver_proxy_container_additional_networks: []
  50. # Controls whether the matrix-homeserver-proxy container exposes its HTTP Client-Server API port (tcp/8008 in the container).
  51. #
  52. # Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:8008"), or empty string to not expose.
  53. matrix_homeserver_proxy_container_client_api_host_bind_port: ''
  54. # Controls whether the matrix-homeserver-proxy container exposes its HTTP Federation (Server-Server) API port (tcp/8048 in the container).
  55. #
  56. # Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:8048"), or empty string to not expose.
  57. matrix_homeserver_proxy_container_federation_api_host_bind_port: ''
  58. # Option to disable the access log
  59. matrix_homeserver_proxy_access_log_enabled: true
  60. # The tmpfs at /tmp needs to be large enough to handle multiple concurrent file uploads.
  61. matrix_homeserver_proxy_tmp_directory_size_mb: "{{ (matrix_homeserver_proxy_federation_api_client_max_body_size_mb | int) * 50 }}"
  62. matrix_homeserver_proxy_tmp_cache_directory_size_mb: "{{ (matrix_homeserver_proxy_cache_max_size_mb | int) * 2 }}"
  63. # A list of strings containing additional configuration blocks to add to the nginx server configuration (nginx.conf).
  64. # for big matrixservers to enlarge the number of open files to prevent timeouts
  65. # matrix_homeserver_proxy_additional_configuration_blocks:
  66. # - 'worker_rlimit_nofile 30000;'
  67. matrix_homeserver_proxy_additional_configuration_blocks: []
  68. # A list of strings containing additional configuration blocks to add to the nginx event server configuration (nginx.conf).
  69. matrix_homeserver_proxy_event_additional_configuration_blocks: []
  70. # A list of strings containing additional configuration blocks to add to the nginx http's server configuration (nginx-http.conf).
  71. matrix_homeserver_proxy_http_additional_server_configuration_blocks: []
  72. # To increase request timeout in NGINX using proxy_read_timeout, proxy_connect_timeout, proxy_send_timeout, send_timeout directives
  73. # Nginx Default: proxy_connect_timeout 60s; #Defines a timeout for establishing a connection with a proxied server
  74. # Nginx Default: proxy_send_timeout 60s; #Sets a timeout for transmitting a request to the proxied server.
  75. # Nginx Default: proxy_read_timeout 60s; #Defines a timeout for reading a response from the proxied server.
  76. # Nginx Default: send_timeout 60s; #Sets a timeout for transmitting a response to the client.
  77. #
  78. # For more information visit:
  79. # http://nginx.org/en/docs/http/ngx_http_proxy_module.html
  80. # http://nginx.org/en/docs/http/ngx_http_core_module.html#send_timeout
  81. # https://www.nginx.com/resources/wiki/start/topics/examples/fullexample2/
  82. #
  83. # Here we are sticking with nginx default values change this value carefully.
  84. matrix_homeserver_proxy_proxy_connect_timeout: 60
  85. matrix_homeserver_proxy_proxy_send_timeout: 60
  86. matrix_homeserver_proxy_proxy_read_timeout: 60
  87. matrix_homeserver_proxy_send_timeout: 60
  88. # For OCSP purposes, we need to define a resolver at the `server{}` level or `http{}` level (we do the latter).
  89. #
  90. # Otherwise, we get warnings like this:
  91. # > [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"
  92. #
  93. # We point it to the internal Docker resolver, which likely delegates to nameservers defined in `/etc/resolv.conf`.
  94. matrix_homeserver_proxy_http_level_resolver: 127.0.0.11
  95. matrix_homeserver_proxy_hostname: "{{ matrix_homeserver_proxy_ident }}"
  96. # matrix_homeserver_proxy_client_api_addr specifies the address where the Client-Server API is
  97. matrix_homeserver_proxy_client_api_addr: ''
  98. # This needs to be equal or higher than the maximum upload size accepted by the homeserver.
  99. matrix_homeserver_proxy_client_api_client_max_body_size_mb: 50
  100. # Tells whether `/_synapse/client` is forwarded to the Matrix Client API server.
  101. matrix_homeserver_proxy_client_api_forwarded_location_synapse_client_api_enabled: true
  102. # Tells whether `/_synapse/oidc` is forwarded to the Matrix Client API server.
  103. # Enable this if you need OpenID Connect authentication support.
  104. matrix_homeserver_proxy_client_api_forwarded_location_synapse_oidc_api_enabled: false
  105. # Tells whether `/_synapse/admin` is forwarded to the Matrix Client API server.
  106. # Following these recommendations (https://github.com/matrix-org/synapse/blob/master/docs/reverse_proxy.md), by default, we don't.
  107. matrix_homeserver_proxy_client_api_forwarded_location_synapse_admin_api_enabled: false
  108. # `matrix_homeserver_proxy_client_api_forwarded_location_prefix_regexes` holds
  109. # the location prefixes that get forwarded to the Matrix Client API server.
  110. # These locations get combined into a regex like this `^(/_matrix|/_synapse/client)`.
  111. matrix_homeserver_proxy_client_api_forwarded_location_prefix_regexes: |
  112. {{
  113. (['/_matrix'])
  114. +
  115. (['/_synapse/client'] if matrix_homeserver_proxy_client_api_forwarded_location_synapse_client_api_enabled else [])
  116. +
  117. (['/_synapse/oidc'] if matrix_homeserver_proxy_client_api_forwarded_location_synapse_oidc_api_enabled else [])
  118. +
  119. (['/_synapse/admin'] if matrix_homeserver_proxy_client_api_forwarded_location_synapse_admin_api_enabled else [])
  120. }}
  121. # Specifies where requests for the root URI (`/`) on the `matrix.` domain should be redirected.
  122. # If this has an empty value, they're just passed to the homeserver, which serves a static page.
  123. # If you'd like to make `https://matrix.DOMAIN` redirect to `https://element.DOMAIN` (or something of that sort), specify the domain name here.
  124. # Example value: `element.DOMAIN` (or `{{ matrix_server_fqn_element }}`).
  125. matrix_homeserver_proxy_client_redirect_root_uri_to_domain: ""
  126. # A list of strings containing additional configuration blocks to add to the nginx vhost handling the Client-Server API
  127. matrix_homeserver_proxy_client_api_additional_server_configuration_blocks: "{{ matrix_homeserver_proxy_client_api_additional_server_configuration_blocks_auto + matrix_homeserver_proxy_client_api_additional_server_configuration_blocks_custom }}"
  128. matrix_homeserver_proxy_client_api_additional_server_configuration_blocks_auto: []
  129. matrix_homeserver_proxy_client_api_additional_server_configuration_blocks_custom: []
  130. # matrix_homeserver_proxy_federation_api_enabled specifies whether reverse proxying for the Federation (Server-Server) API should be done
  131. matrix_homeserver_proxy_federation_api_enabled: true
  132. # matrix_homeserver_proxy_federation_api_addr specifies the address where the Federation (Server-Server) API is
  133. matrix_homeserver_proxy_federation_api_addr: ''
  134. matrix_homeserver_proxy_federation_api_client_max_body_size_mb: "{{ (matrix_homeserver_proxy_client_api_client_max_body_size_mb | int) * 3 }}"
  135. # A list of strings containing additional configuration blocks to add to the nginx vhost handling the Federation (Server-Server) API
  136. matrix_homeserver_proxy_federation_api_additional_server_configuration_blocks: "{{ matrix_homeserver_proxy_federation_api_additional_server_configuration_blocks_auto + matrix_homeserver_proxy_federation_api_additional_server_configuration_blocks_custom }}"
  137. matrix_homeserver_proxy_federation_api_additional_server_configuration_blocks_auto: []
  138. matrix_homeserver_proxy_federation_api_additional_server_configuration_blocks_custom: []
  139. # Controls whether matrix-homeserver-proxy trusts an upstream server's X-Forwarded-Proto header.
  140. # The `matrix-homeserver-proxy` does not terminate SSL and always expects to be fronted by another reverse-proxy server.
  141. # As such, it trusts the protocol scheme forwarded by the upstream proxy.
  142. matrix_homeserver_proxy_trust_forwarded_proto: true
  143. matrix_homeserver_proxy_x_forwarded_proto_value: "{{ '$http_x_forwarded_proto' if matrix_homeserver_proxy_trust_forwarded_proto else '$scheme' }}"
  144. # The amount of worker processes and connections
  145. # Consider increasing these when you are expecting high amounts of traffic
  146. # http://nginx.org/en/docs/ngx_core_module.html#worker_connections
  147. matrix_homeserver_proxy_worker_processes: auto
  148. matrix_homeserver_proxy_worker_connections: 1024