Matrix Docker Ansible eploy
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

166 lines
11 KiB

  1. ---
  2. # matrix-synapse-reverse-proxy companion is a role which brings up a containerized nginx webserver which helps with reverse-proxying to Synapse.
  3. #
  4. # When Synapse is NOT running in worker-mode, reverse-proxying is relatively simple (everything goes to `matrix-synapse:XXXX`).
  5. #
  6. # When Synapse workers are enabled, however, the reverse-proxying configuration is much more complicated.
  7. # Certain requests need to go to certain workers, etc.
  8. # In the past, the main reverse proxy (`matrix-synapse-reverse-proxy-companion`) was handling request routing to the appropriate workers,
  9. # but that only worked well for external requests (from outside of the Matrix server itself).
  10. #
  11. # Without the help of `matrix-synapse-reverse-proxy-companion`, internal services (like Dimension) that would like to talk to Synapse over the container network
  12. # did not have an endpoint for Synapse that they could be pointed to and have it just work.
  13. # If `matrix-synapse-reverse-proxy-companion` was enabled, Dimension could be pointed to its vhost handling Synapse and routing to the appropriate workers,
  14. # but when `matrix-synapse-reverse-proxy-companion` was disabled, this helpful functionality was not available and the best we could do
  15. # is point Dimension to the main Synapse process at `matrix-synapse:XXXX` itself.
  16. # Doing that breaks requests that need to go to specific workers.
  17. # See: https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/2090
  18. #
  19. # What this role does is, it extracts all the Synapse request routing out of the `matrix-synapse-reverse-proxy-companion` role here,
  20. # and makes the `matrix-synapse-reverse-proxy-companion` container service represent Synapse and route appropriately,
  21. # regardless of whether workers are enabled or disabled.
  22. # All other playbook services can then forget about `matrix-synapse` or `matrix-synapse-whatever-worker`, etc.,
  23. # and just use `matrix-synapse-reverse-proxy-companion` as their request destination.
  24. matrix_synapse_reverse_proxy_companion_enabled: true
  25. # renovate: datasource=docker depName=nginx
  26. matrix_synapse_reverse_proxy_companion_version: 1.25.2-alpine
  27. matrix_synapse_reverse_proxy_companion_base_path: "{{ matrix_synapse_base_path }}/reverse-proxy-companion"
  28. matrix_synapse_reverse_proxy_companion_confd_path: "{{ matrix_synapse_reverse_proxy_companion_base_path }}/conf.d"
  29. # List of systemd services that matrix-synapse-reverse-proxy-companion.service depends on
  30. matrix_synapse_reverse_proxy_companion_systemd_required_services_list: ['docker.service']
  31. # List of systemd services that matrix-synapse-reverse-proxy-companion.service wants
  32. matrix_synapse_reverse_proxy_companion_systemd_wanted_services_list: ['matrix-synapse.service']
  33. # We use an official nginx image, which we fix-up to run unprivileged.
  34. # An alternative would be an `nginxinc/nginx-unprivileged` image, but
  35. # that is frequently out of date.
  36. matrix_synapse_reverse_proxy_companion_container_image: "{{ matrix_container_global_registry_prefix }}nginx:{{ matrix_synapse_reverse_proxy_companion_version }}"
  37. matrix_synapse_reverse_proxy_companion_container_image_force_pull: "{{ matrix_synapse_reverse_proxy_companion_container_image.endswith(':latest') }}"
  38. matrix_synapse_reverse_proxy_companion_container_network: "{{ matrix_docker_network }}"
  39. # A list of additional container networks that matrix-synapse-reverse-proxy-companion would be connected to.
  40. # The playbook does not create these networks, so make sure they already exist.
  41. #
  42. # Use this to expose matrix-synapse-reverse-proxy-companion to another reverse proxy, which runs in a different container network,
  43. # without exposing all other Matrix services to that other reverse-proxy.
  44. #
  45. # For background, see: https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1498
  46. matrix_synapse_reverse_proxy_companion_container_additional_networks: []
  47. # Controls whether the matrix-synapse-reverse-proxy-companion container exposes its HTTP Client-Server API port (tcp/8008 in the container).
  48. #
  49. # Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:8008"), or empty string to not expose.
  50. matrix_synapse_reverse_proxy_companion_container_client_api_host_bind_port: ''
  51. # Controls whether the matrix-synapse-reverse-proxy-companion container exposes its HTTP Federation (Server-Server) API port (tcp/8048 in the container).
  52. #
  53. # Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:8048"), or empty string to not expose.
  54. matrix_synapse_reverse_proxy_companion_container_federation_api_host_bind_port: ''
  55. # The amount of worker processes and connections
  56. # Consider increasing these when you are expecting high amounts of traffic
  57. # http://nginx.org/en/docs/ngx_core_module.html#worker_connections
  58. matrix_synapse_reverse_proxy_companion_worker_processes: auto
  59. matrix_synapse_reverse_proxy_companion_worker_connections: 1024
  60. # Option to disable the access log
  61. matrix_synapse_reverse_proxy_companion_access_log_enabled: true
  62. # The tmpfs at /tmp needs to be large enough to handle multiple concurrent file uploads.
  63. matrix_synapse_reverse_proxy_companion_tmp_directory_size_mb: "{{ (matrix_synapse_reverse_proxy_companion_federation_api_client_max_body_size_mb | int) * 50 }}"
  64. matrix_synapse_reverse_proxy_companion_tmp_cache_directory_size_mb: "{{ (matrix_synapse_reverse_proxy_companion_synapse_cache_max_size_mb | int) * 2 }}"
  65. # A list of strings containing additional configuration blocks to add to the nginx server configuration (nginx.conf).
  66. # for big matrixservers to enlarge the number of open files to prevent timeouts
  67. # matrix_synapse_reverse_proxy_companion_additional_configuration_blocks:
  68. # - 'worker_rlimit_nofile 30000;'
  69. matrix_synapse_reverse_proxy_companion_additional_configuration_blocks: []
  70. # A list of strings containing additional configuration blocks to add to the nginx event server configuration (nginx.conf).
  71. matrix_synapse_reverse_proxy_companion_event_additional_configuration_blocks: []
  72. # A list of strings containing additional configuration blocks to add to the nginx http's server configuration (nginx-http.conf).
  73. matrix_synapse_reverse_proxy_companion_http_additional_server_configuration_blocks: []
  74. # To increase request timeout in NGINX using proxy_read_timeout, proxy_connect_timeout, proxy_send_timeout, send_timeout directives
  75. # Nginx Default: proxy_connect_timeout 60s; #Defines a timeout for establishing a connection with a proxied server
  76. # Nginx Default: proxy_send_timeout 60s; #Sets a timeout for transmitting a request to the proxied server.
  77. # Nginx Default: proxy_read_timeout 60s; #Defines a timeout for reading a response from the proxied server.
  78. # Nginx Default: send_timeout 60s; #Sets a timeout for transmitting a response to the client.
  79. #
  80. # For more information visit:
  81. # http://nginx.org/en/docs/http/ngx_http_proxy_module.html
  82. # http://nginx.org/en/docs/http/ngx_http_core_module.html#send_timeout
  83. # https://www.nginx.com/resources/wiki/start/topics/examples/fullexample2/
  84. #
  85. # Here we are sticking with nginx default values change this value carefully.
  86. matrix_synapse_reverse_proxy_companion_proxy_connect_timeout: 60
  87. matrix_synapse_reverse_proxy_companion_proxy_send_timeout: 60
  88. matrix_synapse_reverse_proxy_companion_proxy_read_timeout: 60
  89. matrix_synapse_reverse_proxy_companion_send_timeout: 60
  90. # For OCSP purposes, we need to define a resolver at the `server{}` level or `http{}` level (we do the latter).
  91. #
  92. # Otherwise, we get warnings like this:
  93. # > [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"
  94. #
  95. # We point it to the internal Docker resolver, which likely delegates to nameservers defined in `/etc/resolv.conf`.
  96. matrix_synapse_reverse_proxy_companion_http_level_resolver: 127.0.0.11
  97. matrix_synapse_reverse_proxy_companion_hostname: "matrix-synapse-reverse-proxy-companion"
  98. # matrix_synapse_reverse_proxy_companion_client_api_addr specifies the address where the Client-Server API is
  99. matrix_synapse_reverse_proxy_companion_client_api_addr: 'matrix-synapse:{{ matrix_synapse_container_client_api_port }}'
  100. # This needs to be equal or higher than the maximum upload size accepted by Synapse.
  101. matrix_synapse_reverse_proxy_companion_client_api_client_max_body_size_mb: 50
  102. # matrix_synapse_reverse_proxy_companion_federation_api_enabled specifies whether reverse proxying for the Federation (Server-Server) API should be done
  103. matrix_synapse_reverse_proxy_companion_federation_api_enabled: true
  104. # matrix_synapse_reverse_proxy_companion_federation_api_addr specifies the address where the Federation (Server-Server) API is
  105. matrix_synapse_reverse_proxy_companion_federation_api_addr: 'matrix-synapse:{{ matrix_synapse_container_federation_api_plain_port }}'
  106. matrix_synapse_reverse_proxy_companion_federation_api_client_max_body_size_mb: "{{ (matrix_synapse_reverse_proxy_companion_client_api_client_max_body_size_mb | int) * 3 }}"
  107. # A list of strings containing additional configuration blocks to add to the nginx vhost handling the Synapse Client-Server API
  108. matrix_synapse_reverse_proxy_companion_synapse_client_api_additional_server_configuration_blocks: []
  109. # A list of strings containing additional configuration blocks to add to the nginx vhost handling the Synapse Federation (Server-Server) API
  110. matrix_synapse_reverse_proxy_companion_synapse_federation_api_additional_server_configuration_blocks: []
  111. # synapse worker activation and endpoint mappings
  112. matrix_synapse_reverse_proxy_companion_synapse_workers_enabled: false
  113. matrix_synapse_reverse_proxy_companion_synapse_workers_list: []
  114. matrix_synapse_reverse_proxy_companion_synapse_generic_worker_client_server_locations: []
  115. matrix_synapse_reverse_proxy_companion_synapse_generic_worker_federation_locations: []
  116. matrix_synapse_reverse_proxy_companion_synapse_stream_writer_typing_stream_worker_client_server_locations: []
  117. matrix_synapse_reverse_proxy_companion_synapse_stream_writer_to_device_stream_worker_client_server_locations: []
  118. matrix_synapse_reverse_proxy_companion_synapse_stream_writer_account_data_stream_worker_client_server_locations: []
  119. matrix_synapse_reverse_proxy_companion_synapse_stream_writer_receipts_stream_worker_client_server_locations: []
  120. matrix_synapse_reverse_proxy_companion_synapse_stream_writer_presence_stream_worker_client_server_locations: []
  121. matrix_synapse_reverse_proxy_companion_synapse_media_repository_locations: []
  122. matrix_synapse_reverse_proxy_companion_synapse_user_dir_locations: []
  123. # synapse content caching
  124. matrix_synapse_reverse_proxy_companion_synapse_cache_enabled: false
  125. matrix_synapse_reverse_proxy_companion_synapse_cache_path: /tmp/synapse-cache
  126. matrix_synapse_reverse_proxy_companion_synapse_cache_keys_zone_name: "STATIC"
  127. matrix_synapse_reverse_proxy_companion_synapse_cache_keys_zone_size: "10m"
  128. matrix_synapse_reverse_proxy_companion_synapse_cache_inactive_time: "48h"
  129. matrix_synapse_reverse_proxy_companion_synapse_cache_max_size_mb: 1024
  130. matrix_synapse_reverse_proxy_companion_synapse_cache_proxy_cache_valid_time: "24h"
  131. # Controls whether matrix-synapse-reverse-proxy-companion trusts an upstream server's X-Forwarded-Proto header.
  132. # The `matrix-synapse-reverse-proxy-companion` does not terminate SSL and always expects to be fronted by another reverse-proxy server (`matrix-nginx-proxy`, etc.).
  133. # As such, it trusts the protocol scheme forwarded by the upstream proxy.
  134. matrix_synapse_reverse_proxy_companion_trust_forwarded_proto: true
  135. matrix_synapse_reverse_proxy_companion_x_forwarded_proto_value: "{{ '$http_x_forwarded_proto' if matrix_synapse_reverse_proxy_companion_trust_forwarded_proto else '$scheme' }}"