Move roles/matrix* to roles/custom/matrix*
This paves the way for installing other roles into `roles/galaxy` using `ansible-galaxy`, similar to how it's done in: - https://github.com/spantaleev/gitea-docker-ansible-deploy - https://github.com/spantaleev/nextcloud-docker-ansible-deploy In the near future, we'll be removing a lot of the shared role code from here and using upstream roles for it. Some of the core `matrix-*` roles have already been extracted out into other reusable roles: - https://github.com/devture/com.devture.ansible.role.postgres - https://github.com/devture/com.devture.ansible.role.systemd_docker_base - https://github.com/devture/com.devture.ansible.role.timesync - https://github.com/devture/com.devture.ansible.role.vars_preserver - https://github.com/devture/com.devture.ansible.role.playbook_runtime_messages - https://github.com/devture/com.devture.ansible.role.playbook_help We just need to migrate to those.
This commit is contained in:
933
roles/custom/matrix-synapse/defaults/main.yml
Normal file
933
roles/custom/matrix-synapse/defaults/main.yml
Normal file
@ -0,0 +1,933 @@
|
||||
---
|
||||
# Synapse is a Matrix homeserver
|
||||
# Project source code URL: https://github.com/matrix-org/synapse
|
||||
|
||||
matrix_synapse_enabled: true
|
||||
|
||||
matrix_synapse_container_image_self_build: false
|
||||
matrix_synapse_container_image_self_build_repo: "https://github.com/matrix-org/synapse.git"
|
||||
|
||||
# matrix_synapse_container_image_customizations_enabled controls whether a customized Synapse image will be built.
|
||||
#
|
||||
# We toggle this variable to `true` when certain features which require a custom build are enabled.
|
||||
# Feel free to toggle this to `true` yourself and specify build steps in `matrix_synapse_container_image_customizations_dockerfile_body_custom`.
|
||||
#
|
||||
# See:
|
||||
# - `roles/custom/matrix-synapse/templates/synapse/customizations/Dockerfile.j2`
|
||||
# - `matrix_synapse_container_image_customizations_dockerfile_body_custom`
|
||||
# - `matrix_synapse_docker_image_customized`
|
||||
# - `matrix_synapse_docker_image_final`
|
||||
matrix_synapse_container_image_customizations_enabled: "{{ matrix_synapse_ext_synapse_s3_storage_provider_enabled }}"
|
||||
|
||||
# Controls whether custom build steps will be added to the Dockerfile for installing s3-storage-provider.
|
||||
# The version that will be installed is specified in `matrix_synapse_ext_synapse_s3_storage_provider_version`.
|
||||
matrix_synapse_container_image_customizations_s3_storage_provider_installation_enabled: "{{ matrix_synapse_ext_synapse_s3_storage_provider_enabled }}"
|
||||
|
||||
# matrix_synapse_container_image_customizations_dockerfile_body contains your custom Dockerfile steps
|
||||
# for building your customized Synapse image based on the original (upstream) image (`matrix_synapse_docker_image`).
|
||||
# A `FROM ...` clause is included automatically so you don't have to.
|
||||
#
|
||||
# Example:
|
||||
# matrix_synapse_container_image_customizations_dockerfile_body_custom: |
|
||||
# RUN echo 'This is a custom step for building the customized Docker image for Synapse.'
|
||||
# RUN echo 'You can override matrix_synapse_container_image_customizations_dockerfile_body_custom to add your own steps.'
|
||||
# RUN echo 'You do NOT need to include a FROM clause yourself.'
|
||||
matrix_synapse_container_image_customizations_dockerfile_body_custom: ''
|
||||
|
||||
matrix_synapse_docker_image: "{{ matrix_synapse_docker_image_name_prefix }}matrixdotorg/synapse:{{ matrix_synapse_docker_image_tag }}"
|
||||
matrix_synapse_docker_image_name_prefix: "{{ 'localhost/' if matrix_synapse_container_image_self_build else matrix_container_global_registry_prefix }}"
|
||||
matrix_synapse_version: v1.70.1
|
||||
matrix_synapse_docker_image_tag: "{{ matrix_synapse_version }}"
|
||||
matrix_synapse_docker_image_force_pull: "{{ matrix_synapse_docker_image.endswith(':latest') }}"
|
||||
|
||||
# matrix_synapse_docker_image_customized is the name of the locally built Synapse image
|
||||
# which adds various customizations on top of the original (upstream) Synapse image.
|
||||
# This image will be based on the upstream `matrix_synapse_docker_image` image, only if `matrix_synapse_container_image_customizations_enabled: true`.
|
||||
matrix_synapse_docker_image_customized: "localhost/matrixdotorg/synapse:{{ matrix_synapse_docker_image_tag }}-customized"
|
||||
|
||||
# matrix_synapse_docker_image_final holds the name of the Synapse image to run depending on whether or not customizations are enabled.
|
||||
matrix_synapse_docker_image_final: "{{ matrix_synapse_docker_image_customized if matrix_synapse_container_image_customizations_enabled else matrix_synapse_docker_image }} "
|
||||
|
||||
matrix_synapse_base_path: "{{ matrix_base_data_path }}/synapse"
|
||||
matrix_synapse_docker_src_files_path: "{{ matrix_synapse_base_path }}/docker-src"
|
||||
matrix_synapse_customized_docker_src_files_path: "{{ matrix_synapse_base_path }}/customized-docker-src"
|
||||
matrix_synapse_config_dir_path: "{{ matrix_synapse_base_path }}/config"
|
||||
matrix_synapse_storage_path: "{{ matrix_synapse_base_path }}/storage"
|
||||
matrix_synapse_media_store_path: "{{ matrix_synapse_storage_path }}/media-store"
|
||||
matrix_synapse_ext_path: "{{ matrix_synapse_base_path }}/ext"
|
||||
matrix_synapse_ext_s3_storage_provider_path: "{{ matrix_synapse_base_path }}/ext/s3-storage-provider"
|
||||
|
||||
matrix_synapse_container_client_api_port: 8008
|
||||
|
||||
matrix_synapse_container_federation_api_tls_port: 8448
|
||||
|
||||
matrix_synapse_container_federation_api_plain_port: 8048
|
||||
|
||||
# Controls whether the matrix-synapse container exposes the Client/Server API port (tcp/{{ matrix_synapse_container_client_api_port }} in the container).
|
||||
#
|
||||
# Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:8008"), or empty string to not expose.
|
||||
matrix_synapse_container_client_api_host_bind_port: ''
|
||||
|
||||
# Controls whether the matrix-synapse container exposes the plain (unencrypted) Server/Server (Federation) API port (tcp/8048 in the container).
|
||||
#
|
||||
# Takes effect only if federation is enabled (matrix_synapse_federation_enabled).
|
||||
#
|
||||
# Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:8048"), or empty string to not expose.
|
||||
matrix_synapse_container_federation_api_plain_host_bind_port: ''
|
||||
|
||||
# Controls whether the matrix-synapse container exposes the tls (encrypted) Server/Server (Federation) API port (tcp/8448 in the container).
|
||||
#
|
||||
# Takes effect only if federation is enabled (matrix_synapse_federation_enabled)
|
||||
# and TLS support is enabled (matrix_synapse_tls_federation_listener_enabled).
|
||||
#
|
||||
# Takes an "<ip>:<port>" or "<port>" value (e.g. "8448"), or empty string to not expose.
|
||||
matrix_synapse_container_federation_api_tls_host_bind_port: ''
|
||||
|
||||
# Controls whether the matrix-synapse container exposes the metrics port (tcp/9100 in the container).
|
||||
#
|
||||
# Takes effect only if metrics are enabled (matrix_synapse_metrics_enabled).
|
||||
#
|
||||
# Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:9100"), or empty string to not expose.
|
||||
matrix_synapse_container_metrics_api_host_bind_port: ''
|
||||
|
||||
# Controls whether the matrix-synapse container exposes the manhole port (tcp/9000 in the container).
|
||||
#
|
||||
# Takes effect only if the manhole is enabled (matrix_synapse_manhole_enabled).
|
||||
#
|
||||
# Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:9100"), or empty string to not expose.
|
||||
matrix_synapse_container_manhole_api_host_bind_port: ''
|
||||
|
||||
# A list of extra arguments to pass to the container
|
||||
# Also see `matrix_synapse_container_arguments`
|
||||
matrix_synapse_container_extra_arguments: []
|
||||
|
||||
# matrix_synapse_container_runtime_injected_arguments is a list of extra arguments to pass to the container.
|
||||
# This list is built during runtime. You're not meant to override this variable.
|
||||
# If you'd like to inject your own arguments, see `matrix_synapse_container_extra_arguments`.
|
||||
matrix_synapse_container_runtime_injected_arguments: []
|
||||
|
||||
# matrix_synapse_container_arguments holds the final list of extra arguments to pass to the container.
|
||||
# You're not meant to override this variable.
|
||||
# If you'd like to inject your own arguments, see `matrix_synapse_container_extra_arguments`.
|
||||
matrix_synapse_container_arguments: "{{ matrix_synapse_container_extra_arguments + matrix_synapse_container_runtime_injected_arguments }}"
|
||||
|
||||
# List of systemd services that matrix-synapse.service depends on
|
||||
matrix_synapse_systemd_required_services_list: ['docker.service']
|
||||
|
||||
# List of systemd services that matrix-synapse.service wants
|
||||
matrix_synapse_systemd_wanted_services_list: []
|
||||
|
||||
matrix_synapse_in_container_python_packages_path: "/usr/local/lib/python3.9/site-packages"
|
||||
|
||||
# Specifies which template files to use when configuring Synapse.
|
||||
# If you'd like to have your own different configuration, feel free to copy and paste
|
||||
# the original files into your inventory (e.g. in `inventory/host_vars/<host>/`)
|
||||
# and then change the specific host's `vars.yml` file like this:
|
||||
# matrix_synapse_template_synapse_homeserver: "{{ playbook_dir }}/inventory/host_vars/<host>/homeserver.yaml.j2"
|
||||
matrix_synapse_template_synapse_homeserver: "{{ role_path }}/templates/synapse/homeserver.yaml.j2"
|
||||
matrix_synapse_template_synapse_log: "{{ role_path }}/templates/synapse/synapse.log.config.j2"
|
||||
|
||||
matrix_synapse_macaroon_secret_key: ""
|
||||
matrix_synapse_registration_shared_secret: "{{ matrix_synapse_macaroon_secret_key }}"
|
||||
matrix_synapse_allow_guest_access: false
|
||||
matrix_synapse_form_secret: "{{ matrix_synapse_macaroon_secret_key }}"
|
||||
|
||||
matrix_synapse_max_upload_size_mb: 50
|
||||
|
||||
# Controls whether local media should be removed under certain conditions, typically for the purpose of saving space.
|
||||
# should be empty to disable
|
||||
matrix_synapse_media_retention_local_media_lifetime:
|
||||
# Controls whether remote media cache (media that is downloaded from other homeservers)
|
||||
# should be removed under certain conditions, typically for the purpose of saving space.
|
||||
# should be empty to disable
|
||||
matrix_synapse_media_retention_remote_media_lifetime:
|
||||
|
||||
# The tmpfs at /tmp needs to be large enough to handle multiple concurrent file uploads.
|
||||
matrix_synapse_tmp_directory_size_mb: "{{ matrix_synapse_max_upload_size_mb * 50 }}"
|
||||
|
||||
# Log levels
|
||||
# Possible options are defined here https://docs.python.org/3/library/logging.html#logging-levels
|
||||
# warning: setting log level to DEBUG will make synapse log sensitive information such
|
||||
# as access tokens.
|
||||
#
|
||||
# Increasing verbosity may lead to an excessive amount of log messages being generated,
|
||||
# some of which may get dropped by systemd-journald on certain distributions (like CentOS 7).
|
||||
# You can work around it by adding `RateLimitInterval=0` and `RateLimitBurst=0` under `[Storage]` in
|
||||
# `/etc/systemd/journald.conf` and restarting the logging service (`systemctl restart systemd-journald`).
|
||||
matrix_synapse_log_level: "WARNING"
|
||||
matrix_synapse_storage_sql_log_level: "WARNING"
|
||||
matrix_synapse_root_log_level: "WARNING"
|
||||
|
||||
# Rate limits
|
||||
matrix_synapse_rc_message:
|
||||
per_second: 0.2
|
||||
burst_count: 10
|
||||
|
||||
matrix_synapse_rc_registration:
|
||||
per_second: 0.17
|
||||
burst_count: 3
|
||||
|
||||
matrix_synapse_rc_login:
|
||||
address:
|
||||
per_second: 0.17
|
||||
burst_count: 3
|
||||
account:
|
||||
per_second: 0.17
|
||||
burst_count: 3
|
||||
failed_attempts:
|
||||
per_second: 0.17
|
||||
burst_count: 3
|
||||
|
||||
matrix_synapse_rc_admin_redaction:
|
||||
per_second: 1
|
||||
burst_count: 50
|
||||
|
||||
matrix_synapse_rc_joins:
|
||||
local:
|
||||
per_second: 0.1
|
||||
burst_count: 10
|
||||
remote:
|
||||
per_second: 0.01
|
||||
burst_count: 10
|
||||
|
||||
|
||||
matrix_synapse_rc_invites:
|
||||
per_room:
|
||||
per_second: 0.3
|
||||
burst_count: 10
|
||||
per_user:
|
||||
per_second: 0.003
|
||||
burst_count: 5
|
||||
per_issuer:
|
||||
per_second: 0.3
|
||||
burst_count: 10
|
||||
|
||||
|
||||
matrix_synapse_rc_federation:
|
||||
window_size: 1000
|
||||
sleep_limit: 10
|
||||
sleep_delay: 500
|
||||
reject_limit: 50
|
||||
concurrent: 3
|
||||
|
||||
matrix_synapse_federation_rr_transactions_per_room_per_second: 50
|
||||
|
||||
# Controls whether the TLS federation listener is enabled (tcp/8448).
|
||||
# Only makes sense if federation is enabled (`matrix_synapse_federation_enabled`).
|
||||
# Note that federation may potentially be enabled as non-TLS on `matrix_synapse_container_federation_api_plain_port` as well.
|
||||
# If you're serving Synapse behind an HTTPS-capable reverse-proxy,
|
||||
# you can disable the TLS listener (`matrix_synapse_tls_federation_listener_enabled: false`).
|
||||
matrix_synapse_tls_federation_listener_enabled: true
|
||||
matrix_synapse_tls_certificate_path: "/data/{{ matrix_server_fqn_matrix }}.tls.crt"
|
||||
matrix_synapse_tls_private_key_path: "/data/{{ matrix_server_fqn_matrix }}.tls.key"
|
||||
|
||||
# Resource names used by the unsecure HTTP listener. Here only the Client API
|
||||
# is defined, see the homeserver config for a full list of valid resource
|
||||
# names.
|
||||
matrix_synapse_http_listener_resource_names: ["client"]
|
||||
|
||||
# Resources served on Synapse's federation port.
|
||||
# When disabling federation, we may wish to serve the `openid` resource here,
|
||||
# so that services like Dimension and ma1sd can work.
|
||||
matrix_synapse_federation_listener_resource_names: "{{ ['federation'] if matrix_synapse_federation_enabled else (['openid'] if matrix_synapse_federation_port_openid_resource_required else []) }}"
|
||||
|
||||
# Enable this to allow Synapse to report utilization statistics about your server to matrix.org
|
||||
# (things like number of users, number of messages sent, uptime, load, etc.)
|
||||
matrix_synapse_report_stats: false
|
||||
|
||||
# Controls whether the Matrix server will track presence status (online, offline, unavailable) for users.
|
||||
# If users participate in large rooms with many other servers,
|
||||
# disabling this will decrease server load significantly.
|
||||
matrix_synapse_presence_enabled: true
|
||||
|
||||
# Controls whether accessing the server's public rooms directory can be done without authentication.
|
||||
# For private servers, you most likely wish to require authentication,
|
||||
# unless you know what list of rooms you're publishing to the world and explicitly want to do it.
|
||||
matrix_synapse_allow_public_rooms_without_auth: false
|
||||
|
||||
# Controls whether remote servers can fetch this server's public rooms directory via federation.
|
||||
# For private servers, you most likely wish to forbid it.
|
||||
matrix_synapse_allow_public_rooms_over_federation: false
|
||||
|
||||
# Whether to require authentication to retrieve profile data (avatars,
|
||||
# display names) of other users through the client API. Defaults to
|
||||
# 'false'. Note that profile data is also available via the federation
|
||||
# API, so this setting is of limited value if federation is enabled on
|
||||
# the server.
|
||||
matrix_synapse_require_auth_for_profile_requests: false
|
||||
|
||||
# Set to true to require a user to share a room with another user in order
|
||||
# to retrieve their profile information. Only checked on Client-Server
|
||||
# requests. Profile requests from other servers should be checked by the
|
||||
# requesting server. Defaults to 'false'.
|
||||
matrix_synapse_limit_profile_requests_to_users_who_share_rooms: false
|
||||
|
||||
# Set to false to prevent a user's profile data from being retrieved and
|
||||
# displayed in a room until they have joined it. By default, a user's
|
||||
# profile data is included in an invite event, regardless of the values
|
||||
# of the above two settings, and whether or not the users share a server.
|
||||
# Defaults to 'true'.
|
||||
matrix_synapse_include_profile_data_on_invite: true
|
||||
|
||||
# Controls whether people with access to the homeserver can register by themselves.
|
||||
matrix_synapse_enable_registration: false
|
||||
# Controls whether people with access to the homeserver can register by themselves without verification (email/msisdn/token)
|
||||
matrix_synapse_enable_registration_without_verification: false
|
||||
|
||||
# reCAPTCHA API for validating registration attempts
|
||||
matrix_synapse_enable_registration_captcha: false
|
||||
matrix_synapse_recaptcha_public_key: ''
|
||||
matrix_synapse_recaptcha_private_key: ''
|
||||
|
||||
# Requires an MSC3231 token for registration. Note that `matrix_synapse_enable_registration` must be set to `true`.
|
||||
# Tokens can be created via the API or through synapse-admin.
|
||||
# Disabling this option will not delete any tokens previously generated.
|
||||
matrix_synapse_registration_requires_token: false
|
||||
|
||||
# A list of 3PID types which users must supply when registering (possible values: email, msisdn).
|
||||
matrix_synapse_registrations_require_3pid: []
|
||||
|
||||
# A list of patterns 3pids must match in order to permit registration, e.g.:
|
||||
# - medium: email
|
||||
# pattern: '.*@example\.com'
|
||||
# - medium: msisdn
|
||||
# pattern: '\+44'
|
||||
matrix_synapse_allowed_local_3pids: []
|
||||
|
||||
# The server to use for phone number threepid validation. When empty, validation cannot happen, as Synapse doesn't support it.
|
||||
# To make it work, this should be pointed to an identity server.
|
||||
matrix_synapse_account_threepid_delegates_msisdn: ''
|
||||
|
||||
# Users who register on this homeserver will automatically be joined to these rooms.
|
||||
# Rooms are to be specified using addresses (e.g. `#address:example.com`)
|
||||
matrix_synapse_auto_join_rooms: []
|
||||
|
||||
# Controls whether auto-join rooms (`matrix_synapse_auto_join_rooms`) are to be created
|
||||
# automatically if they don't already exist.
|
||||
matrix_synapse_autocreate_auto_join_rooms: true
|
||||
|
||||
# Controls password-peppering for Synapse. Not to be changed after initial setup.
|
||||
matrix_synapse_password_config_pepper: ""
|
||||
|
||||
# Controls if Synapse allows people to authenticate against its local database.
|
||||
# It may be useful to disable this if you've configured additional password providers
|
||||
# and only wish authentication to happen through them.
|
||||
matrix_synapse_password_config_localdb_enabled: true
|
||||
|
||||
# Controls the number of events that Synapse caches in memory.
|
||||
matrix_synapse_event_cache_size: "100K"
|
||||
|
||||
# Controls cache sizes for Synapse.
|
||||
# Raise this to increase cache sizes or lower it to potentially lower memory use.
|
||||
# To learn more, see:
|
||||
# - https://github.com/matrix-org/synapse#help-synapse-eats-all-my-ram
|
||||
# - https://github.com/matrix-org/synapse/issues/3939
|
||||
matrix_synapse_caches_global_factor: 0.5
|
||||
|
||||
# Controls whether Synapse will federate at all.
|
||||
# Disable this to completely isolate your server from the rest of the Matrix network.
|
||||
#
|
||||
# Disabling this still keeps the federation port exposed, because it may be used for other services (`openid`).
|
||||
#
|
||||
# Also see:
|
||||
# - `matrix_synapse_tls_federation_listener_enabled` if you wish to keep federation enabled,
|
||||
# but want to stop the TLS listener (port 8448).
|
||||
# - `matrix_synapse_federation_port_enabled` to avoid exposing the federation ports
|
||||
matrix_synapse_federation_enabled: true
|
||||
|
||||
# Controls whether the federation ports are used at all.
|
||||
# One may wish to disable federation (`matrix_synapse_federation_enabled: true`),
|
||||
# but still run other resources (like `openid`) on the federation port
|
||||
# by enabling them in `matrix_synapse_federation_listener_resource_names`.
|
||||
matrix_synapse_federation_port_enabled: "{{ matrix_synapse_federation_enabled or matrix_synapse_federation_port_openid_resource_required }}"
|
||||
|
||||
# Controls whether an `openid` listener is to be enabled. Useful when disabling federation,
|
||||
# but needing the `openid` APIs for Dimension or an identity server like ma1sd.
|
||||
matrix_synapse_federation_port_openid_resource_required: false
|
||||
|
||||
# A list of domain names that are allowed to federate with the given Synapse server.
|
||||
# An empty list value (`[]`) will also effectively stop federation, but if that's the desired
|
||||
# result, it's better to accomplish it by changing `matrix_synapse_federation_enabled`.
|
||||
matrix_synapse_federation_domain_whitelist: ~
|
||||
|
||||
# A list of additional "volumes" to mount in the container.
|
||||
# This list gets populated dynamically based on Synapse extensions that have been enabled.
|
||||
# Contains definition objects like this: `{"src": "/outside", "dst": "/inside", "options": "rw|ro|slave|.."}
|
||||
#
|
||||
# Note: internally, this uses the `-v` flag for mounting the specified volumes.
|
||||
# It's better (safer) to use the `--mount` flag for mounting volumes.
|
||||
# To use `--mount`, specify it in `matrix_synapse_container_extra_arguments`.
|
||||
# Example: `matrix_synapse_container_extra_arguments: ['--mount type=bind,src=/outside,dst=/inside,ro']
|
||||
matrix_synapse_container_additional_volumes: []
|
||||
|
||||
# A list of additional loggers to register in synapse.log.config.
|
||||
# This list gets populated dynamically based on Synapse extensions that have been enabled.
|
||||
# Contains definition objects like this: `{"name": "..", "level": "DEBUG"}
|
||||
matrix_synapse_additional_loggers: []
|
||||
|
||||
# A list of appservice config files (in-container filesystem paths).
|
||||
# This list gets populated dynamically based on Synapse extensions that have been enabled.
|
||||
# You may wish to use this together with `matrix_synapse_container_additional_volumes` or `matrix_synapse_container_extra_arguments`.
|
||||
# Also see `matrix_synapse_app_service_config_files_final`
|
||||
matrix_synapse_app_service_config_files: []
|
||||
|
||||
# matrix_synapse_app_service_runtime_injected_config_files is a list of appservice config files.
|
||||
# This list is built during runtime. You're not meant to override this variable.
|
||||
# If you'd like to inject your own arguments, see `matrix_synapse_app_service_config_files`.
|
||||
matrix_synapse_app_service_runtime_injected_config_files: []
|
||||
|
||||
# matrix_synapse_app_service_config_files_final holds the final list of config files to pass to the container.
|
||||
# You're not meant to override this variable.
|
||||
# If you'd like to inject your own arguments, see `matrix_synapse_app_service_config_files`.
|
||||
matrix_synapse_app_service_config_files_final: "{{ matrix_synapse_app_service_config_files + matrix_synapse_app_service_runtime_injected_config_files }}"
|
||||
|
||||
# This is set dynamically during execution depending on whether
|
||||
# any password providers have been enabled or not.
|
||||
matrix_synapse_password_providers_enabled: false
|
||||
|
||||
# Whether clients can request to include message content in push notifications
|
||||
# sent through third party servers. Setting this to false requires mobile clients
|
||||
# to load message content directly from the homeserver.
|
||||
matrix_synapse_push_include_content: true
|
||||
|
||||
# If url previews should be generated. This will cause a request from Synapse to
|
||||
# URLs shared by users.
|
||||
matrix_synapse_url_preview_enabled: true
|
||||
|
||||
# A list of values for the Accept-Language HTTP header used when downloading webpages during URL preview generation
|
||||
matrix_url_preview_accept_language: ['en-US', 'en']
|
||||
|
||||
# Enable exposure of metrics to Prometheus
|
||||
# See https://github.com/matrix-org/synapse/blob/master/docs/metrics-howto.md
|
||||
matrix_synapse_metrics_enabled: false
|
||||
matrix_synapse_metrics_port: 9100
|
||||
|
||||
# matrix_synapse_grafana_dashboard_urls contains a list of URLs with Grafana dashboard definitions.
|
||||
# If the Grafana role is enabled, these dashboards will be downloaded.
|
||||
matrix_synapse_grafana_dashboard_urls:
|
||||
- https://raw.githubusercontent.com/matrix-org/synapse/master/contrib/grafana/synapse.json
|
||||
|
||||
# Controls whether Synapse metrics should be proxied (exposed) on:
|
||||
# - `matrix.DOMAIN/metrics/synapse/main-process` for the main process
|
||||
# - `matrix.DOMAIN/metrics/synapse/worker/{type}-{id}` for each worker process
|
||||
#
|
||||
# This will only work take effect if `matrix_nginx_proxy_proxy_matrix_metrics_enabled: true`.
|
||||
# See the `matrix-nginx-proxy` role for details about enabling `matrix_nginx_proxy_proxy_matrix_metrics_enabled`.
|
||||
matrix_synapse_metrics_proxying_enabled: false
|
||||
|
||||
# Enable the Synapse manhole
|
||||
# See https://github.com/matrix-org/synapse/blob/master/docs/manhole.md
|
||||
matrix_synapse_manhole_enabled: false
|
||||
|
||||
# Enable support for Synapse workers
|
||||
matrix_synapse_workers_enabled: false
|
||||
|
||||
# Specifies worker configuration that should be used when workers are enabled.
|
||||
#
|
||||
# The posible values (as seen in `matrix_synapse_workers_presets`) are:
|
||||
# - "little-federation-helper" - a very minimal worker configuration to improve federation performance
|
||||
# - "one-of-each" - one worker of each supported type
|
||||
#
|
||||
# You can override `matrix_synapse_workers_presets` to define your own presets, which is ill-advised, because it's fragile.
|
||||
# To use a more custom configuration, start with one of these presets as a base and configure `matrix_synapse_workers_*_count` variables manually, to suit your liking.
|
||||
matrix_synapse_workers_preset: one-of-each
|
||||
|
||||
matrix_synapse_workers_presets:
|
||||
little-federation-helper:
|
||||
generic_workers_count: 0
|
||||
pusher_workers_count: 0
|
||||
federation_sender_workers_count: 1
|
||||
media_repository_workers_count: 0
|
||||
appservice_workers_count: 0
|
||||
user_dir_workers_count: 0
|
||||
background_workers_count: 0
|
||||
stream_writer_events_stream_workers_count: 0
|
||||
stream_writer_typing_stream_workers_count: 0
|
||||
stream_writer_to_device_stream_workers_count: 0
|
||||
stream_writer_account_data_stream_workers_count: 0
|
||||
stream_writer_receipts_stream_workers_count: 0
|
||||
stream_writer_presence_stream_workers_count: 0
|
||||
one-of-each:
|
||||
generic_workers_count: 1
|
||||
pusher_workers_count: 1
|
||||
federation_sender_workers_count: 1
|
||||
media_repository_workers_count: 1
|
||||
appservice_workers_count: 1
|
||||
user_dir_workers_count: 1
|
||||
background_workers_count: 1
|
||||
stream_writer_events_stream_workers_count: 1
|
||||
stream_writer_typing_stream_workers_count: 1
|
||||
stream_writer_to_device_stream_workers_count: 1
|
||||
stream_writer_account_data_stream_workers_count: 1
|
||||
stream_writer_receipts_stream_workers_count: 1
|
||||
stream_writer_presence_stream_workers_count: 1
|
||||
|
||||
# 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.
|
||||
#
|
||||
# Takes an "<ip>" value (e.g. "127.0.0.1", "0.0.0.0", etc), or empty string to not expose.
|
||||
# It takes "*" to signify "bind on all interfaces" ("0.0.0.0" is IPv4-only).
|
||||
matrix_synapse_workers_container_host_bind_address: ''
|
||||
|
||||
matrix_synapse_workers_generic_workers_count: "{{ matrix_synapse_workers_presets[matrix_synapse_workers_preset]['generic_workers_count'] }}"
|
||||
matrix_synapse_workers_generic_workers_port_range_start: 18111
|
||||
matrix_synapse_workers_generic_workers_metrics_range_start: 19111
|
||||
|
||||
# matrix_synapse_workers_stream_writer_events_stream_workers_count controls how many stream writers that handle the `events` stream to spawn.
|
||||
# More than 1 worker is also supported of this type.
|
||||
matrix_synapse_workers_stream_writer_events_stream_workers_count: "{{ matrix_synapse_workers_presets[matrix_synapse_workers_preset]['stream_writer_events_stream_workers_count'] }}"
|
||||
|
||||
# matrix_synapse_workers_stream_writer_typing_stream_workers_count controls how many stream writers that handle the `typing` stream to spawn.
|
||||
# The count of these workers can only be 0 or 1.
|
||||
matrix_synapse_workers_stream_writer_typing_stream_workers_count: "{{ matrix_synapse_workers_presets[matrix_synapse_workers_preset]['stream_writer_typing_stream_workers_count'] }}"
|
||||
|
||||
# matrix_synapse_workers_stream_writer_to_device_stream_workers_count controls how many stream writers that handle the `to_device` stream to spawn.
|
||||
# The count of these workers can only be 0 or 1.
|
||||
matrix_synapse_workers_stream_writer_to_device_stream_workers_count: "{{ matrix_synapse_workers_presets[matrix_synapse_workers_preset]['stream_writer_to_device_stream_workers_count'] }}"
|
||||
|
||||
# matrix_synapse_workers_stream_writer_account_data_stream_workers_count controls how many stream writers that handle the `account_data` stream to spawn.
|
||||
# The count of these workers can only be 0 or 1.
|
||||
matrix_synapse_workers_stream_writer_account_data_stream_workers_count: "{{ matrix_synapse_workers_presets[matrix_synapse_workers_preset]['stream_writer_account_data_stream_workers_count'] }}"
|
||||
|
||||
# matrix_synapse_workers_stream_writer_receipts_stream_workers_count controls how many stream writers that handle the `receipts` stream to spawn.
|
||||
# The count of these workers can only be 0 or 1.
|
||||
matrix_synapse_workers_stream_writer_receipts_stream_workers_count: "{{ matrix_synapse_workers_presets[matrix_synapse_workers_preset]['stream_writer_receipts_stream_workers_count'] }}"
|
||||
|
||||
# matrix_synapse_workers_stream_writer_presence_stream_workers_count controls how many stream writers that handle the `presence` stream to spawn.
|
||||
# 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'] }}"
|
||||
|
||||
# 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.
|
||||
matrix_synapse_workers_stream_writers: |
|
||||
{{
|
||||
[]
|
||||
+
|
||||
([{'stream': 'events'}] * matrix_synapse_workers_stream_writer_events_stream_workers_count | int)
|
||||
+
|
||||
([{'stream': 'typing'}] * matrix_synapse_workers_stream_writer_typing_stream_workers_count | int)
|
||||
+
|
||||
([{'stream': 'to_device'}] * matrix_synapse_workers_stream_writer_to_device_stream_workers_count | int)
|
||||
+
|
||||
([{'stream': 'account_data'}] * matrix_synapse_workers_stream_writer_account_data_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)
|
||||
}}
|
||||
|
||||
# matrix_synapse_stream_writers populates the `stream_writers` Synapse configuration used when Synapse workers are in use (`matrix_synapse_workers_enabled`).
|
||||
# What you see below is an initial default value which will be adjusted at runtime based on the value of `matrix_synapse_workers_stream_writers`.
|
||||
# Adjusting this value manually is generally not necessary.
|
||||
#
|
||||
# It's tempting to initialize this like this:
|
||||
# matrix_synapse_stream_writers:
|
||||
# - typing: []
|
||||
# - events: []
|
||||
# - to_device: []
|
||||
# - account_data: []
|
||||
# - receipts: []
|
||||
# - presence: []
|
||||
# .. but Synapse does not like empty lists (see https://github.com/matrix-org/synapse/issues/13804)
|
||||
matrix_synapse_stream_writers: {}
|
||||
|
||||
# `matrix_synapse_workers_stream_writer_workers_` variables control the port numbers of various stream writer workers
|
||||
# defined in `matrix_synapse_workers_stream_writers`.
|
||||
# It should be noted that not all of the background worker types will need to expose HTTP services, etc.
|
||||
matrix_synapse_workers_stream_writer_workers_http_port_range_start: 20011
|
||||
matrix_synapse_workers_stream_writer_workers_replication_port_range_start: 25011
|
||||
matrix_synapse_workers_stream_writer_workers_metrics_range_start: 19211
|
||||
|
||||
# matrix_synapse_workers_pusher_workers_count controls the number of pusher workers (workers who push out notifications) to spawn.
|
||||
# See https://matrix-org.github.io/synapse/latest/workers.html#synapseapppusher
|
||||
matrix_synapse_workers_pusher_workers_count: "{{ matrix_synapse_workers_presets[matrix_synapse_workers_preset]['pusher_workers_count'] }}"
|
||||
matrix_synapse_workers_pusher_workers_metrics_range_start: 19200
|
||||
|
||||
# matrix_synapse_federation_pusher_instances populates the `pusher_instances` Synapse configuration used when Synapse workers are in use (`matrix_synapse_workers_enabled`).
|
||||
# What you see below is an initial default value which will be adjusted at runtime based on the value of `matrix_synapse_workers_pusher_workers_count` or `matrix_synapse_workers_enabled_list`.
|
||||
# Adjusting this value manually is generally not necessary.
|
||||
matrix_synapse_federation_pusher_instances: []
|
||||
|
||||
# matrix_synapse_start_pushers controls if the main Synapse process should push out notifications or if it should be left to pusher workers (see `matrix_synapse_federation_pusher_instances`).
|
||||
# This is enabled if workers are disabled, or if they are enabled, but there are no pusher workers.
|
||||
# Adjusting this value manually is generally not necessary.
|
||||
matrix_synapse_start_pushers: "{{ not matrix_synapse_workers_enabled or (matrix_synapse_workers_enabled_list | selectattr('type', 'equalto', 'pusher') | list | length == 0) }}"
|
||||
|
||||
# matrix_synapse_workers_federation_sender_workers_count controls the number of federation sender workers to spawn.
|
||||
# See https://matrix-org.github.io/synapse/latest/workers.html#synapseappfederation_sender
|
||||
matrix_synapse_workers_federation_sender_workers_count: "{{ matrix_synapse_workers_presets[matrix_synapse_workers_preset]['federation_sender_workers_count'] }}"
|
||||
matrix_synapse_workers_federation_sender_workers_metrics_range_start: 19400
|
||||
|
||||
# matrix_synapse_federation_sender_instances populates the `federation_sender_instances` Synapse configuration used when Synapse workers are in use (`matrix_synapse_workers_enabled`).
|
||||
# What you see below is an initial default value which will be adjusted at runtime based on the value of `matrix_synapse_workers_federation_sender_workers_count` or `matrix_synapse_workers_enabled_list`.
|
||||
# Adjusting this value manually is generally not necessary.
|
||||
matrix_synapse_federation_sender_instances: []
|
||||
|
||||
# matrix_synapse_send_federation controls if the main Synapse process should send federation traffic or if it should be left to federation_sender workers (see `matrix_synapse_federation_sender_instances`).
|
||||
# This is allowed if workers are disabled, or they are enabled, but there are no federation sender workers.
|
||||
# Adjusting this value manually is generally not necessary.
|
||||
matrix_synapse_send_federation: "{{ not matrix_synapse_workers_enabled or (matrix_synapse_workers_enabled_list | selectattr('type', 'equalto', 'federation_sender') | list | length == 0) }}"
|
||||
|
||||
matrix_synapse_workers_media_repository_workers_count: "{{ matrix_synapse_workers_presets[matrix_synapse_workers_preset]['media_repository_workers_count'] }}"
|
||||
matrix_synapse_workers_media_repository_workers_port_range_start: 18551
|
||||
matrix_synapse_workers_media_repository_workers_metrics_range_start: 19551
|
||||
|
||||
# matrix_synapse_enable_media_repo controls if the main Synapse process should serve media repository endpoints or if it should be left to media_repository workers (see `matrix_synapse_workers_media_repository_workers_count`).
|
||||
# This is enabled if workers are disabled, or if they are enabled, but there are no media repository workers.
|
||||
# Adjusting this value manually is generally not necessary.
|
||||
matrix_synapse_enable_media_repo: "{{ not matrix_synapse_workers_enabled or (matrix_synapse_workers_enabled_list | selectattr('type', 'equalto', 'media_repository') | list | length == 0) }}"
|
||||
|
||||
# matrix_synapse_media_instance_running_background_jobs populates the `media_instance_running_background_jobs` Synapse configuration used when Synapse workers are in use (`matrix_synapse_workers_enabled`).
|
||||
# `media_instance_running_background_jobs` is meant to point to a single media-repository worker, which is dedicated to running background tasks that maintain the media repository.
|
||||
# Multiple `media_repository` workers may be enabled. We always pick the first one as the background tasks worker.
|
||||
matrix_synapse_media_instance_running_background_jobs: "{{ (matrix_synapse_workers_enabled_list | selectattr('type', 'equalto', 'media_repository') | list)[0].name if (matrix_synapse_workers_enabled and matrix_synapse_workers_enabled_list | selectattr('type', 'equalto', 'media_repository') | list | length > 0) else '' }}"
|
||||
|
||||
# matrix_synapse_workers_appservice_workers_count can only be 0 or 1. More instances are not supported.
|
||||
# appservice workers were deprecated since Synapse v1.59 (see: https://github.com/matrix-org/synapse/blob/v1.59.0/docs/upgrade.md#deprecation-of-the-synapseappappservice-and-synapseappuser_dir-worker-application-types).
|
||||
# Our implementation uses generic worker services and assigns them to perform appservice work using the `notify_appservices_from_worker` Synapse option.
|
||||
matrix_synapse_workers_appservice_workers_count: "{{ matrix_synapse_workers_presets[matrix_synapse_workers_preset]['appservice_workers_count'] }}"
|
||||
matrix_synapse_workers_appservice_workers_metrics_range_start: 19300
|
||||
|
||||
# matrix_synapse_notify_appservices_from_worker populates the `notify_appservices_from_worker` Synapse configuration used when Synapse workers are in use (`matrix_synapse_workers_enabled`).
|
||||
# `notify_appservices_from_worker` is meant to point to a worker, which is dedicated to sending output traffic to Application Services.
|
||||
matrix_synapse_notify_appservices_from_worker: "{{ (matrix_synapse_workers_enabled_list | selectattr('type', 'equalto', 'appservice') | list)[0].name if (matrix_synapse_workers_enabled and matrix_synapse_workers_enabled_list | selectattr('type', 'equalto', 'appservice') | list | length > 0) else '' }}"
|
||||
|
||||
# matrix_synapse_workers_user_dir_workers_count can only be 0 or 1. More instances are not supported.
|
||||
# user_dir workers were deprecated since Synapse v1.59 (see: https://github.com/matrix-org/synapse/blob/v1.59.0/docs/upgrade.md#deprecation-of-the-synapseappappservice-and-synapseappuser_dir-worker-application-types).
|
||||
# Our implementation uses generic worker services and assigns them to perform appservice work using the `update_user_directory_from_worker` Synapse option.
|
||||
matrix_synapse_workers_user_dir_workers_count: "{{ matrix_synapse_workers_presets[matrix_synapse_workers_preset]['user_dir_workers_count'] }}"
|
||||
matrix_synapse_workers_user_dir_workers_port_range_start: 18661
|
||||
matrix_synapse_workers_user_dir_workers_metrics_range_start: 19661
|
||||
|
||||
# matrix_synapse_update_user_directory_from_worker populates the `update_user_directory_from_worker` Synapse configuration used when Synapse workers are in use (`matrix_synapse_workers_enabled`).
|
||||
# `update_user_directory_from_worker` is meant to point to a worker, which is dedicated to updating the user directory and servicing some user directory URL endpoints (`matrix_synapse_workers_user_dir_worker_client_server_endpoints`).
|
||||
matrix_synapse_update_user_directory_from_worker: "{{ (matrix_synapse_workers_enabled_list | selectattr('type', 'equalto', 'user_dir') | list)[0].name if (matrix_synapse_workers_enabled and matrix_synapse_workers_enabled_list | selectattr('type', 'equalto', 'user_dir') | list | length > 0) else '' }}"
|
||||
|
||||
# matrix_synapse_workers_background_workers_count can only be 0 or 1. More instances are not supported.
|
||||
# Our implementation uses a generic worker and assigns Synapse to perform background work on this worker using the `run_background_tasks_on` Synapse option.
|
||||
matrix_synapse_workers_background_workers_count: "{{ matrix_synapse_workers_presets[matrix_synapse_workers_preset]['background_workers_count'] }}"
|
||||
matrix_synapse_workers_background_workers_metrics_range_start: 19700
|
||||
|
||||
# matrix_synapse_run_background_tasks_on populates the `run_background_tasks_on` Synapse configuration used when Synapse workers are in use (`matrix_synapse_workers_enabled`).
|
||||
# `run_background_tasks_on` is meant to point to a worker, which is dedicated to processing background tasks.
|
||||
matrix_synapse_run_background_tasks_on: "{{ (matrix_synapse_workers_enabled_list | selectattr('type', 'equalto', 'background') | list)[0].name if (matrix_synapse_workers_enabled and matrix_synapse_workers_enabled_list | selectattr('type', 'equalto', 'background') | list | length > 0) else '' }}"
|
||||
|
||||
# Default list of workers to spawn.
|
||||
#
|
||||
# Unless you populate this manually, this list is dynamically generated
|
||||
# based on other variables above:
|
||||
# - `matrix_synapse_workers_*_workers_count`
|
||||
# - `matrix_synapse_workers_*_workers_port_range_start`
|
||||
# - `matrix_synapse_workers_*_workers_port_metrics_range_start`
|
||||
#
|
||||
# We advise that you use those variables and let this list be populated dynamically.
|
||||
# Doing that is simpler and also protects you from shooting yourself in the foot,
|
||||
# as certain workers can only be spawned just once.
|
||||
#
|
||||
# Each worker instance in the list defines the following fields:
|
||||
# - `id` - a string that uniquely identifies the worker
|
||||
# - `name` - a string that will be used as the container and systemd service name
|
||||
# - `type` - the type of worker (`generic_worker`, `stream_writer`, `pusher`, etc.)
|
||||
# - `app` - the Synapse app (https://matrix-org.github.io/synapse/latest/workers.html#available-worker-applications) that powers this worker (`generic_worker`, `federation_sender`, etc.).
|
||||
# The `app` usually matches the `type`, but not always. For example, `type = stream_writer` workers are served by the `generic_worker` type.
|
||||
# - `port` - an HTTP port where the worker listens for requests (can be `0` for workers that don't do HTTP request processing)
|
||||
# - `metrics_port` - an HTTP port where the worker exports Prometheus metrics
|
||||
# - `replication_port` - an HTTP port where the worker serves `replication` endpoints (used by stream writers, etc.)
|
||||
# - `webserving` - tells whether this type of worker serves web (client or federation) requests, so that it can be injected as a dependency to the reverse-proxy
|
||||
#
|
||||
# Example of what this needs to look like, if you're defining it manually:
|
||||
# matrix_synapse_workers_enabled_list:
|
||||
# - { 'id': 'generic-worker-0', 'name': 'matrix-synapse-worker-generic-0', 'type': 'generic_worker', 'app': 'generic_worker', 'port': 18111, 'metrics_port': 19111, 'webserving': true }
|
||||
# - { 'id': 'generic-worker-1', 'name': 'matrix-synapse-worker-generic-1', 'type': 'generic_worker', 'app': 'generic_worker', 'port': 18112, 'metrics_port': 19112, 'webserving': true }
|
||||
# - { 'id': 'generic-worker-2', 'name': 'matrix-synapse-worker-generic-2', 'type': 'generic_worker', 'app': 'generic_worker', 'port': 18113, 'metrics_port': 19113, 'webserving': true }
|
||||
# - { 'id': 'generic-worker-3', 'name': 'matrix-synapse-worker-generic-3', 'type': 'generic_worker', 'app': 'generic_worker', 'port': 18114, 'metrics_port': 19114, 'webserving': true }
|
||||
# - { 'id': 'generic-worker-4', 'name': 'matrix-synapse-worker-generic-4', 'type': 'generic_worker', 'app': 'generic_worker', 'port': 18115, 'metrics_port': 19115, 'webserving': true }
|
||||
# - { 'id': 'generic-worker-5', 'name': 'matrix-synapse-worker-generic-5', 'type': 'generic_worker', 'app': 'generic_worker', 'port': 18116, 'metrics_port': 19116, 'webserving': true }
|
||||
# - { 'id': 'stream-writer-0-events', 'name': 'matrix-synapse-worker-stream-writer-0-events', 'type': 'stream_writer', 'app': 'generic_worker', 'stream_writer_stream': 'events', 'port': 0, 'replication_port': 25011, metrics_port: 19111, 'webserving': false }
|
||||
# - { 'id': 'stream-writer-1-typing', 'name': 'matrix-synapse-worker-stream-writer-1-typing', 'type': 'stream_writer', 'app': 'generic_worker', 'stream_writer_stream': 'typing', 'port': 20012, 'replication_port': 25012, metrics_port: 19112, 'webserving': true }
|
||||
# - { 'id': 'pusher-0', 'name': 'matrix-synapse-worker-pusher-0', 'type': 'pusher', 'app': 'pusher', 'port': 0, 'metrics_port': 19200, 'webserving': false }
|
||||
# - { 'id': 'appservice-0', 'name': 'matrix-synapse-worker-appservice-0', 'type': 'appservice', 'port': 0, 'metrics_port': 19300, 'webserving': false }
|
||||
# - { 'id': 'federation-sender-0', 'name': 'matrix-synapse-worker-federation-sender-0', 'type': 'federation_sender', 'port': 0, 'metrics_port': 19400, 'webserving': false }
|
||||
# - { 'id': 'media-repository-0', 'name': 'matrix-synapse-worker-media-repository-0', 'type': 'media_repository', 'port': 18551, 'metrics_port': 19551, 'webserving': true }
|
||||
matrix_synapse_workers_enabled_list: []
|
||||
|
||||
# matrix_synapse_instance_map holds the instance map used for mapping worker names (for certain generic workers only!) to where they live (host, port which handles replication traffic).
|
||||
# This is populated automatically based on `matrix_synapse_workers_enabled_list` during runtime, so you're not required to tweak it manually.
|
||||
matrix_synapse_instance_map: {}
|
||||
|
||||
# Redis information
|
||||
matrix_synapse_redis_enabled: false
|
||||
matrix_synapse_redis_host: ""
|
||||
matrix_synapse_redis_port: 6379
|
||||
matrix_synapse_redis_password: ""
|
||||
|
||||
# Controls whether Synapse starts a replication listener necessary for workers.
|
||||
#
|
||||
# If Redis is available, we prefer to use that, instead of talking over Synapse's custom replication protocol.
|
||||
#
|
||||
# matrix_synapse_replication_listener_enabled: "{{ matrix_synapse_workers_enabled and not matrix_redis_enabled }}"
|
||||
# We force-enable this listener for now until we debug why communication via Redis fails.
|
||||
matrix_synapse_replication_listener_enabled: true
|
||||
|
||||
# Port used for communication between main synapse process and workers.
|
||||
# Only gets used if `matrix_synapse_replication_listener_enabled: true`
|
||||
matrix_synapse_replication_http_port: 9093
|
||||
|
||||
# Send ERROR logs to sentry.io for easier tracking
|
||||
# To set this up: go to sentry.io, create a python project, and set
|
||||
# matrix_synapse_sentry_dsn to the URL it gives you.
|
||||
# See https://github.com/matrix-org/synapse/issues/4632 for important privacy concerns
|
||||
matrix_synapse_sentry_dsn: ""
|
||||
|
||||
# Postgres database information
|
||||
matrix_synapse_database_txn_limit: 0
|
||||
matrix_synapse_database_host: "matrix-postgres"
|
||||
matrix_synapse_database_port: 5432
|
||||
matrix_synapse_database_user: "synapse"
|
||||
matrix_synapse_database_password: ""
|
||||
matrix_synapse_database_database: "synapse"
|
||||
|
||||
matrix_synapse_turn_uris: []
|
||||
matrix_synapse_turn_shared_secret: ""
|
||||
matrix_synapse_turn_allow_guests: false
|
||||
|
||||
matrix_synapse_email_enabled: false
|
||||
matrix_synapse_email_smtp_host: ""
|
||||
matrix_synapse_email_smtp_port: 587
|
||||
matrix_synapse_email_smtp_user: ""
|
||||
matrix_synapse_email_smtp_pass: ""
|
||||
matrix_synapse_email_smtp_require_transport_security: false
|
||||
matrix_synapse_email_notif_from: "Matrix <matrix@{{ matrix_domain }}>"
|
||||
matrix_synapse_email_client_base_url: "https://{{ matrix_server_fqn_element }}"
|
||||
matrix_synapse_email_invite_client_location: "https://app.element.io"
|
||||
|
||||
|
||||
# Enable this to activate the REST auth password provider module.
|
||||
# See: https://github.com/ma1uta/matrix-synapse-rest-password-provider
|
||||
matrix_synapse_ext_password_provider_rest_auth_enabled: false
|
||||
matrix_synapse_ext_password_provider_rest_auth_download_url: "https://raw.githubusercontent.com/ma1uta/matrix-synapse-rest-password-provider/ed377fb70513c2e51b42055eb364195af1ccaf33/rest_auth_provider.py"
|
||||
matrix_synapse_ext_password_provider_rest_auth_endpoint: ""
|
||||
matrix_synapse_ext_password_provider_rest_auth_registration_enforce_lowercase: false
|
||||
matrix_synapse_ext_password_provider_rest_auth_registration_profile_name_autofill: true
|
||||
matrix_synapse_ext_password_provider_rest_auth_login_profile_name_autofill: false
|
||||
|
||||
# Enable this to activate the Shared Secret Auth password provider module.
|
||||
# See: https://github.com/devture/matrix-synapse-shared-secret-auth
|
||||
matrix_synapse_ext_password_provider_shared_secret_auth_enabled: false
|
||||
matrix_synapse_ext_password_provider_shared_secret_auth_download_url: "https://raw.githubusercontent.com/devture/matrix-synapse-shared-secret-auth/2.0.2/shared_secret_authenticator.py"
|
||||
matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret: ""
|
||||
matrix_synapse_ext_password_provider_shared_secret_auth_m_login_password_support_enabled: true
|
||||
# We'd like to enable this, but it causes trouble for Element: https://github.com/vector-im/element-web/issues/19605
|
||||
matrix_synapse_ext_password_provider_shared_secret_auth_com_devture_shared_secret_auth_support_enabled: false
|
||||
matrix_synapse_ext_password_provider_shared_secret_config: "{{ matrix_synapse_ext_password_provider_shared_secret_config_yaml | from_yaml }}"
|
||||
matrix_synapse_ext_password_provider_shared_secret_config_yaml: |
|
||||
shared_secret: {{ matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret | string | to_json }}
|
||||
m_login_password_support_enabled: {{ matrix_synapse_ext_password_provider_shared_secret_auth_m_login_password_support_enabled | to_json }}
|
||||
com_devture_shared_secret_auth_support_enabled: {{ matrix_synapse_ext_password_provider_shared_secret_auth_com_devture_shared_secret_auth_support_enabled | to_json }}
|
||||
|
||||
# Enable this to activate LDAP password provider
|
||||
matrix_synapse_ext_password_provider_ldap_enabled: false
|
||||
matrix_synapse_ext_password_provider_ldap_uri: "ldap://ldap.mydomain.tld:389"
|
||||
matrix_synapse_ext_password_provider_ldap_start_tls: true
|
||||
matrix_synapse_ext_password_provider_ldap_base: ""
|
||||
matrix_synapse_ext_password_provider_ldap_attributes_uid: "uid"
|
||||
matrix_synapse_ext_password_provider_ldap_attributes_mail: "mail"
|
||||
matrix_synapse_ext_password_provider_ldap_attributes_name: "cn"
|
||||
matrix_synapse_ext_password_provider_ldap_bind_dn: ""
|
||||
matrix_synapse_ext_password_provider_ldap_bind_password: ""
|
||||
matrix_synapse_ext_password_provider_ldap_filter: ""
|
||||
matrix_synapse_ext_password_provider_ldap_active_directory: false
|
||||
matrix_synapse_ext_password_provider_ldap_default_domain: ""
|
||||
|
||||
# Enable this to activate the Synapse Antispam spam-checker module.
|
||||
# See: https://github.com/t2bot/synapse-simple-antispam
|
||||
matrix_synapse_ext_spam_checker_synapse_simple_antispam_enabled: false
|
||||
matrix_synapse_ext_spam_checker_synapse_simple_antispam_git_repository_url: "https://github.com/t2bot/synapse-simple-antispam"
|
||||
matrix_synapse_ext_spam_checker_synapse_simple_antispam_git_version: "5ab711971e3a4541a7a40310ff85e17f8262cc05"
|
||||
matrix_synapse_ext_spam_checker_synapse_simple_antispam_config_blocked_homeservers: []
|
||||
|
||||
# Enable this to activate the Mjolnir Antispam spam-checker module.
|
||||
# See: https://github.com/matrix-org/mjolnir#synapse-module
|
||||
matrix_synapse_ext_spam_checker_mjolnir_antispam_enabled: false
|
||||
matrix_synapse_ext_spam_checker_mjolnir_antispam_git_repository_url: "https://github.com/matrix-org/mjolnir"
|
||||
matrix_synapse_ext_spam_checker_mjolnir_antispam_git_version: "4008e3f65d3745b9307dd31f1c5aa80c13a61a58"
|
||||
matrix_synapse_ext_spam_checker_mjolnir_antispam_config_block_invites: true
|
||||
# Flag messages sent by servers/users in the ban lists as spam. Currently
|
||||
# this means that spammy messages will appear as empty to users. Default
|
||||
# false.
|
||||
matrix_synapse_ext_spam_checker_mjolnir_antispam_config_block_messages: false
|
||||
# Remove users from the user directory search by filtering matrix IDs and
|
||||
# display names by the entries in the user ban list. Default false.
|
||||
matrix_synapse_ext_spam_checker_mjolnir_antispam_config_block_usernames: false
|
||||
# The room IDs of the ban lists to honour. Unlike other parts of Mjolnir,
|
||||
# this list cannot be room aliases or permalinks. This server is expected
|
||||
# to already be joined to the room - Mjolnir will not automatically join
|
||||
# these rooms.
|
||||
# ["!roomid:example.org"]
|
||||
matrix_synapse_ext_spam_checker_mjolnir_antispam_config_ban_lists: []
|
||||
|
||||
|
||||
# Enable this to activate the E2EE disabling Synapse module.
|
||||
# See: https://github.com/digitalentity/matrix_encryption_disabler
|
||||
matrix_synapse_ext_encryption_disabler_enabled: false
|
||||
matrix_synapse_ext_encryption_disabler_download_url: "https://raw.githubusercontent.com/digitalentity/matrix_encryption_disabler/cdc37a07441acb7c2a3288bcb29b376658d5e766/matrix_e2ee_filter.py"
|
||||
# A list of server domain names for which to deny encryption if the event sender's domain matches the domain in the list.
|
||||
# By default, with the configuration below, we prevent all homeserver users from initiating encryption in ANY room.
|
||||
matrix_synapse_ext_encryption_disabler_deny_encryption_for_users_of: ["{{ matrix_domain }}"]
|
||||
# A list of server domain names for which to deny encryption if the destination room id's domain matches the domain in the list.
|
||||
# By default, with the configuration below, we prevent locally-created encryption events by ANY user encrypt rooms on the homeserver.
|
||||
# Note: foreign users with enough room privileges will still be able to send an encryption event to your rooms and encrypt them.
|
||||
matrix_synapse_ext_encryption_disabler_deny_encryption_for_rooms_of: ["{{ matrix_domain }}"]
|
||||
# Specifies whether the power levels event (setting) provided during room creation should be patched.
|
||||
# This makes it impossible for anybody (locally or over federation) from enabling room encryption
|
||||
# for the lifetime of rooms created while this setting is enabled (irreversible).
|
||||
# Enabling this may have incompatiblity consequences with servers / clients.
|
||||
# Familiarize yourself with the caveats upstream: https://github.com/digitalentity/matrix_encryption_disabler
|
||||
matrix_synapse_ext_encryption_disabler_patch_power_levels: false
|
||||
matrix_synapse_ext_encryption_config: "{{ matrix_synapse_ext_encryption_config_yaml | from_yaml }}"
|
||||
matrix_synapse_ext_encryption_config_yaml: |
|
||||
deny_encryption_for_users_of: {{ matrix_synapse_ext_encryption_disabler_deny_encryption_for_users_of | to_json }}
|
||||
deny_encryption_for_rooms_of: {{ matrix_synapse_ext_encryption_disabler_deny_encryption_for_rooms_of | to_json }}
|
||||
patch_power_levels: {{ matrix_synapse_ext_encryption_disabler_patch_power_levels | to_json }}
|
||||
|
||||
|
||||
# matrix_synapse_ext_synapse_s3_storage_provider_enabled controls whether to enable https://github.com/matrix-org/synapse-s3-storage-provider
|
||||
# Installing it requires building a customized Docker image for Synapse (see `matrix_synapse_container_image_customizations_enabled`).
|
||||
# Enabling this will enable customizations and inject the appropriate Dockerfile clauses for installing synapse-s3-storage-provider.
|
||||
matrix_synapse_ext_synapse_s3_storage_provider_enabled: false
|
||||
matrix_synapse_ext_synapse_s3_storage_provider_version: 1.1.2
|
||||
# Controls whether media from this (local) server is stored in s3-storage-provider
|
||||
matrix_synapse_ext_synapse_s3_storage_provider_store_local: true
|
||||
# Controls whether media from remote servers is stored in s3-storage-provider
|
||||
matrix_synapse_ext_synapse_s3_storage_provider_store_remote: true
|
||||
# Controls whether files are stored to S3 at the same time they are stored on the local filesystem.
|
||||
# For slightly improved reliability, consider setting this to `true`.
|
||||
# Even with asynchronous uploading to S3 (`false` value), data loss shouldn't be possible,
|
||||
# because the local filesystem is a reliable data store anyway.
|
||||
matrix_synapse_ext_synapse_s3_storage_provider_store_synchronous: false
|
||||
matrix_synapse_ext_synapse_s3_storage_provider_config_bucket: ''
|
||||
matrix_synapse_ext_synapse_s3_storage_provider_config_region_name: ''
|
||||
matrix_synapse_ext_synapse_s3_storage_provider_config_endpoint_url: ''
|
||||
matrix_synapse_ext_synapse_s3_storage_provider_config_access_key_id: ''
|
||||
matrix_synapse_ext_synapse_s3_storage_provider_config_secret_access_key: ''
|
||||
matrix_synapse_ext_synapse_s3_storage_provider_config_storage_class: STANDARD
|
||||
matrix_synapse_ext_synapse_s3_storage_provider_config_threadpool_size: 40
|
||||
# matrix_synapse_ext_synapse_s3_storage_provider_update_db_day_count is a day value (number) for the `s3_media_upload update-db` command.
|
||||
# It specifies how old files need to have been inactive to be eligible for migration from the local filesystem to the S3 data store.
|
||||
# By default, we use `0` which says "all files are eligible for migration".
|
||||
matrix_synapse_ext_synapse_s3_storage_provider_update_db_day_count: 0
|
||||
|
||||
matrix_s3_media_store_enabled: false
|
||||
matrix_s3_media_store_custom_endpoint_enabled: false
|
||||
matrix_s3_goofys_docker_image: "ewoutp/goofys:latest"
|
||||
matrix_s3_goofys_docker_image_force_pull: "{{ matrix_s3_goofys_docker_image.endswith(':latest') }}"
|
||||
matrix_s3_media_store_custom_endpoint: "your-custom-endpoint"
|
||||
matrix_s3_media_store_bucket_name: "your-bucket-name"
|
||||
matrix_s3_media_store_aws_access_key: "your-aws-access-key"
|
||||
matrix_s3_media_store_aws_secret_key: "your-aws-secret-key"
|
||||
matrix_s3_media_store_region: "eu-central-1"
|
||||
matrix_s3_media_store_path: "{{ matrix_synapse_media_store_path }}"
|
||||
|
||||
# Controls whether the self-check feature should validate SSL certificates.
|
||||
matrix_synapse_self_check_validate_certificates: true
|
||||
|
||||
# Controls whether searching the public room list is enabled.
|
||||
matrix_synapse_enable_room_list_search: true
|
||||
|
||||
# Controls who's allowed to create aliases on this server.
|
||||
matrix_synapse_alias_creation_rules:
|
||||
- user_id: "*"
|
||||
alias: "*"
|
||||
room_id: "*"
|
||||
action: allow
|
||||
|
||||
# Controls who can publish and which rooms can be published in the public room list.
|
||||
matrix_synapse_room_list_publication_rules:
|
||||
- user_id: "*"
|
||||
alias: "*"
|
||||
room_id: "*"
|
||||
action: allow
|
||||
|
||||
matrix_synapse_default_room_version: "9"
|
||||
|
||||
# Controls the Synapse `spam_checker` setting.
|
||||
#
|
||||
# If a spam-checker extension is enabled, this variable's value is set automatically by the playbook during runtime.
|
||||
# If not, you can also control its value manually.
|
||||
matrix_synapse_spam_checker: []
|
||||
|
||||
# Controls the Synapse `modules` list.
|
||||
# You can define your own list of modules here. See the `modules` syntax in `homeserver.yaml.j2`
|
||||
# Certain Synapse extensions that you can enable below auto-inject themselves into `matrix_synapse_modules` at runtime.
|
||||
matrix_synapse_modules: []
|
||||
|
||||
# matrix_synapse_media_storage_providers contains the Synapse `media_storage_providers` configuration setting.
|
||||
# To add your own custom `media_storage_providers`, use `matrix_synapse_media_storage_providers_custom`.
|
||||
matrix_synapse_media_storage_providers: "{{ matrix_synapse_media_storage_providers_auto + matrix_synapse_media_storage_providers_custom }}"
|
||||
|
||||
# matrix_synapse_media_storage_providers_auto contains a list of storage providers that are added by the playbook based on other configuration
|
||||
matrix_synapse_media_storage_providers_auto: |
|
||||
{{
|
||||
[]
|
||||
+
|
||||
[
|
||||
lookup('ansible.builtin.template', role_path + '/templates/synapse/ext/s3-storage-provider/media_storage_provider.yaml.j2') | from_yaml
|
||||
] if matrix_synapse_ext_synapse_s3_storage_provider_enabled else []
|
||||
}}
|
||||
|
||||
# matrix_synapse_media_storage_providers_custom contains your own custom list of storage providers.
|
||||
# You're meant to define each custom module as valid keys and values, not as a YAML string that needs to be parsed.
|
||||
#
|
||||
# Example:
|
||||
# matrix_synapse_media_storage_providers_custom:
|
||||
# - module: module.SomeModule
|
||||
# store_local: True
|
||||
# # ...
|
||||
matrix_synapse_media_storage_providers_custom: []
|
||||
|
||||
matrix_synapse_encryption_enabled_by_default_for_room_type: "off"
|
||||
|
||||
matrix_synapse_trusted_key_servers:
|
||||
- server_name: "matrix.org"
|
||||
|
||||
matrix_synapse_redaction_retention_period: 7d
|
||||
|
||||
matrix_synapse_user_ips_max_age: 28d
|
||||
|
||||
|
||||
matrix_synapse_rust_synapse_compress_state_docker_image: "registry.gitlab.com/mb-saces/rust-synapse-compress-state:latest"
|
||||
matrix_synapse_rust_synapse_compress_state_docker_image_force_pull: "{{ matrix_synapse_rust_synapse_compress_state_docker_image.endswith(':latest') }}"
|
||||
|
||||
matrix_synapse_rust_synapse_compress_state_base_path: "{{ matrix_base_data_path }}/rust-synapse-compress-state"
|
||||
matrix_synapse_rust_synapse_compress_state_synapse_compress_state_in_container_path: "/usr/local/bin/synapse_compress_state"
|
||||
|
||||
|
||||
# Default Synapse configuration template which covers the generic use case.
|
||||
# You can customize it by controlling the various variables inside it.
|
||||
#
|
||||
# For a more advanced customization, you can extend the default (see `matrix_synapse_configuration_extension_yaml`)
|
||||
# or completely replace this variable with your own template.
|
||||
matrix_synapse_configuration_yaml: "{{ lookup('template', 'templates/synapse/homeserver.yaml.j2') }}"
|
||||
|
||||
matrix_synapse_configuration_extension_yaml: |
|
||||
# Your custom YAML configuration for Synapse goes here.
|
||||
# This configuration extends the default starting configuration (`matrix_synapse_configuration_yaml`).
|
||||
#
|
||||
# You can override individual variables from the default configuration, or introduce new ones.
|
||||
#
|
||||
# If you need something more special, you can take full control by
|
||||
# completely redefining `matrix_synapse_configuration_yaml`.
|
||||
#
|
||||
# Example configuration extension follows:
|
||||
#
|
||||
# server_notices:
|
||||
# system_mxid_localpart: notices
|
||||
# system_mxid_display_name: "Server Notices"
|
||||
# system_mxid_avatar_url: "mxc://server.com/oumMVlgDnLYFaPVkExemNVVZ"
|
||||
# room_name: "Server Notices"
|
||||
|
||||
matrix_synapse_configuration_extension: "{{ matrix_synapse_configuration_extension_yaml | from_yaml if matrix_synapse_configuration_extension_yaml | from_yaml is mapping else {} }}"
|
||||
|
||||
# Holds the final Synapse configuration (a combination of the default and its extension).
|
||||
# You most likely don't need to touch this variable. Instead, see `matrix_synapse_configuration_yaml`.
|
||||
matrix_synapse_configuration: "{{ matrix_synapse_configuration_yaml | from_yaml | combine(matrix_synapse_configuration_extension, recursive=True) }}"
|
146
roles/custom/matrix-synapse/files/workers-doc-to-yaml.awk
Executable file
146
roles/custom/matrix-synapse/files/workers-doc-to-yaml.awk
Executable file
@ -0,0 +1,146 @@
|
||||
#!/usr/bin/awk
|
||||
# Hackish approach to get a machine-readable list of current matrix
|
||||
# synapse REST API endpoints from the official documentation at
|
||||
# https://github.com/matrix-org/synapse/raw/master/docs/workers.md
|
||||
#
|
||||
# invoke in shell with:
|
||||
# URL=https://github.com/matrix-org/synapse/raw/master/docs/workers.md
|
||||
# curl -L ${URL} | awk -f workers-doc-to-yaml.awk -
|
||||
|
||||
function worker_stanza_append(string) {
|
||||
worker_stanza = worker_stanza string
|
||||
}
|
||||
|
||||
function line_is_endpoint_url(line) {
|
||||
# probably API endpoint if it starts with white-space and ^ or /
|
||||
return (line ~ /^ +[\^\/].*\//)
|
||||
}
|
||||
|
||||
# Put YAML marker at beginning of file.
|
||||
BEGIN {
|
||||
print "---"
|
||||
endpoint_conditional_comment = " # FIXME: ADDITIONAL CONDITIONS REQUIRED: to be enabled manually\n"
|
||||
}
|
||||
|
||||
# Enable further processing after the introductory text.
|
||||
# Read each synapse worker section as record and its lines as fields.
|
||||
/Available worker applications/ {
|
||||
enable_parsing = 1
|
||||
# set record separator to markdown section header
|
||||
RS = "\n### "
|
||||
# set field separator to newline
|
||||
FS = "\n"
|
||||
}
|
||||
|
||||
# Once parsing is active, this will process each section as record.
|
||||
enable_parsing {
|
||||
# Each worker section starts with a synapse.app.X headline
|
||||
if ($1 ~ /synapse\.app\./) {
|
||||
|
||||
# get rid of the backticks and extract worker type from headline
|
||||
gsub("`", "", $1)
|
||||
gsub("synapse.app.", "", $1)
|
||||
worker_type = $1
|
||||
|
||||
# initialize empty worker stanza
|
||||
worker_stanza = ""
|
||||
|
||||
# track if any endpoints are mentioned in a specific section
|
||||
worker_has_urls = 0
|
||||
|
||||
# some endpoint descriptions contain flag terms
|
||||
endpoints_seem_conditional = 0
|
||||
|
||||
# also, collect a list of available workers
|
||||
workers = (workers ? workers "\n" : "") " - " worker_type
|
||||
|
||||
# loop through the lines (2 - number of fields in record)
|
||||
for (i = 2; i < NF + 1; i++) {
|
||||
# copy line for gsub replacements
|
||||
line = $i
|
||||
|
||||
# end all lines but the last with a linefeed
|
||||
linefeed = (i < NF - 1) ? "\n" : ""
|
||||
|
||||
# line starts with white-space and a hash: endpoint block headline
|
||||
if (line ~ /^ +#/) {
|
||||
|
||||
# copy to output verbatim, normalizing white-space
|
||||
gsub(/^ +/, "", line)
|
||||
worker_stanza_append(" " line linefeed)
|
||||
|
||||
} else if (line_is_endpoint_url(line)) {
|
||||
|
||||
# mark section for special output formatting
|
||||
worker_has_urls = 1
|
||||
|
||||
# remove leading white-space
|
||||
gsub(/^ +/, "", line)
|
||||
api_endpoint_regex = line
|
||||
|
||||
# FIXME: https://github.com/matrix-org/synapse/issues/new
|
||||
# munge inconsistent media_repository endpoint notation
|
||||
if (api_endpoint_regex == "/_matrix/media/") {
|
||||
api_endpoint_regex = "^" line
|
||||
}
|
||||
|
||||
# FIXME: https://github.com/matrix-org/synapse/issues/7530
|
||||
# https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/456#issuecomment-719015911
|
||||
if (api_endpoint_regex == "^/_matrix/client/(r0|v3|unstable)/auth/.*/fallback/web$") {
|
||||
worker_stanza_append(" # FIXME: possible bug with SSO and multiple generic workers\n")
|
||||
worker_stanza_append(" # see https://github.com/matrix-org/synapse/issues/7530\n")
|
||||
worker_stanza_append(" # " api_endpoint_regex linefeed)
|
||||
continue
|
||||
}
|
||||
|
||||
# disable endpoints which specify complications
|
||||
if (endpoints_seem_conditional) {
|
||||
# only add notice if previous line didn't match
|
||||
if (!line_is_endpoint_url($(i - 1))) {
|
||||
worker_stanza_append(endpoint_conditional_comment)
|
||||
}
|
||||
worker_stanza_append(" # " api_endpoint_regex linefeed)
|
||||
} else {
|
||||
# output endpoint regex
|
||||
worker_stanza_append(" - " api_endpoint_regex linefeed)
|
||||
}
|
||||
|
||||
# white-space only line?
|
||||
} else if (line ~ /^ *$/) {
|
||||
|
||||
if (i > 3 && i < NF) {
|
||||
# print white-space lines unless 1st or last line in section
|
||||
worker_stanza_append(line linefeed)
|
||||
}
|
||||
|
||||
# nothing of the above: the line is regular documentation text
|
||||
} else {
|
||||
|
||||
# include this text line as comment
|
||||
worker_stanza_append(" # " line linefeed)
|
||||
|
||||
# and take note of words hinting at additional conditions to be met
|
||||
if (line ~ /(^[Ii]f|care must be taken|can be handled for)/) {
|
||||
endpoints_seem_conditional = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (worker_has_urls) {
|
||||
print "\nmatrix_synapse_workers_" worker_type "_endpoints:"
|
||||
print worker_stanza
|
||||
} else {
|
||||
# include workers without endpoints as well for reference
|
||||
print "\n# " worker_type " worker (no API endpoints) ["
|
||||
print worker_stanza
|
||||
print "# ]"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
END {
|
||||
print "\nmatrix_synapse_workers_avail_list:"
|
||||
print workers | "sort"
|
||||
}
|
||||
|
||||
# vim: tabstop=4 shiftwidth=4 expandtab autoindent
|
6
roles/custom/matrix-synapse/files/workers-doc-to-yaml.sh
Executable file
6
roles/custom/matrix-synapse/files/workers-doc-to-yaml.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
# Fetch the synapse worker documentation and extract endpoint URLs
|
||||
# matrix-org/synapse master branch points to current stable release
|
||||
|
||||
URL=https://github.com/matrix-org/synapse/raw/master/docs/workers.md
|
||||
curl -L ${URL} | awk -f workers-doc-to-yaml.awk > ../vars/workers.yml
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/encryption-disabler/setup_install.yml"
|
||||
when: matrix_synapse_ext_encryption_disabler_enabled | bool
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/encryption-disabler/setup_uninstall.yml"
|
||||
when: "not matrix_synapse_ext_encryption_disabler_enabled | bool"
|
@ -0,0 +1,41 @@
|
||||
---
|
||||
|
||||
- name: Download matrix_encryption_disabler
|
||||
ansible.builtin.get_url:
|
||||
url: "{{ matrix_synapse_ext_encryption_disabler_download_url }}"
|
||||
dest: "{{ matrix_synapse_ext_path }}/matrix_e2ee_filter.py"
|
||||
force: true
|
||||
mode: 0440
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
register: result
|
||||
retries: "{{ matrix_geturl_retries_count }}"
|
||||
delay: "{{ matrix_geturl_retries_delay }}"
|
||||
until: result is not failed
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_synapse_modules: |
|
||||
{{
|
||||
matrix_synapse_modules | default([])
|
||||
+
|
||||
[
|
||||
{
|
||||
"module": "matrix_e2ee_filter.EncryptedRoomFilter",
|
||||
"config": matrix_synapse_ext_encryption_config
|
||||
}
|
||||
]
|
||||
}}
|
||||
|
||||
matrix_synapse_container_extra_arguments: >
|
||||
{{
|
||||
matrix_synapse_container_extra_arguments | default([])
|
||||
+
|
||||
["--mount type=bind,src={{ matrix_synapse_ext_path }}/matrix_e2ee_filter.py,dst={{ matrix_synapse_in_container_python_packages_path }}/matrix_e2ee_filter.py,ro"]
|
||||
}}
|
||||
|
||||
matrix_synapse_additional_loggers: >
|
||||
{{
|
||||
matrix_synapse_additional_loggers
|
||||
+
|
||||
[{'name': 'matrix_e2ee_filter', 'level': 'INFO'}]
|
||||
}}
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
|
||||
- name: Ensure matrix_encryption_disabler doesn't exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_synapse_ext_path }}/matrix_e2ee_filter.py"
|
||||
state: absent
|
12
roles/custom/matrix-synapse/tasks/ext/ldap-auth/setup.yml
Normal file
12
roles/custom/matrix-synapse/tasks/ext/ldap-auth/setup.yml
Normal file
@ -0,0 +1,12 @@
|
||||
---
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_synapse_password_providers_enabled: true
|
||||
|
||||
matrix_synapse_additional_loggers: >
|
||||
{{
|
||||
matrix_synapse_additional_loggers
|
||||
+
|
||||
[{'name': 'ldap_auth_provider', 'level': 'INFO'}]
|
||||
}}
|
||||
when: matrix_synapse_ext_password_provider_ldap_enabled | bool
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/mjolnir-antispam/setup_install.yml"
|
||||
when: matrix_synapse_ext_spam_checker_mjolnir_antispam_enabled | bool
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/mjolnir-antispam/setup_uninstall.yml"
|
||||
when: "not matrix_synapse_ext_spam_checker_mjolnir_antispam_enabled | bool"
|
@ -0,0 +1,56 @@
|
||||
---
|
||||
|
||||
- name: Ensure git installed (RedHat)
|
||||
ansible.builtin.yum:
|
||||
name:
|
||||
- git
|
||||
state: present
|
||||
update_cache: false
|
||||
when: "ansible_os_family == 'RedHat'"
|
||||
|
||||
- name: Ensure git installed (Debian)
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- git
|
||||
state: present
|
||||
update_cache: false
|
||||
when: "ansible_os_family == 'Debian'"
|
||||
|
||||
- name: Ensure git installed (Archlinux)
|
||||
community.general.pacman:
|
||||
name:
|
||||
- git
|
||||
state: present
|
||||
update_cache: false
|
||||
when: "ansible_distribution == 'Archlinux'"
|
||||
|
||||
- name: Clone mjolnir-antispam git repository
|
||||
ansible.builtin.git:
|
||||
repo: "{{ matrix_synapse_ext_spam_checker_mjolnir_antispam_git_repository_url }}"
|
||||
version: "{{ matrix_synapse_ext_spam_checker_mjolnir_antispam_git_version }}"
|
||||
dest: "{{ matrix_synapse_ext_path }}/mjolnir"
|
||||
become: true
|
||||
become_user: "{{ matrix_user_username }}"
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_synapse_spam_checker: >
|
||||
{{
|
||||
matrix_synapse_spam_checker
|
||||
+
|
||||
[{
|
||||
"module": "mjolnir.AntiSpam",
|
||||
"config": {
|
||||
"block_invites": matrix_synapse_ext_spam_checker_mjolnir_antispam_config_block_invites,
|
||||
"block_messages": matrix_synapse_ext_spam_checker_mjolnir_antispam_config_block_messages,
|
||||
"block_usernames": matrix_synapse_ext_spam_checker_mjolnir_antispam_config_block_usernames,
|
||||
"ban_lists": matrix_synapse_ext_spam_checker_mjolnir_antispam_config_ban_lists,
|
||||
}
|
||||
}]
|
||||
}}
|
||||
|
||||
matrix_synapse_container_extra_arguments: >
|
||||
{{
|
||||
matrix_synapse_container_extra_arguments | default([])
|
||||
+
|
||||
["--mount type=bind,src={{ matrix_synapse_ext_path }}/mjolnir/synapse_antispam/mjolnir,dst={{ matrix_synapse_in_container_python_packages_path }}/mjolnir,ro"]
|
||||
}}
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
|
||||
- name: Ensure mjolnir-antispam doesn't exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_synapse_ext_path }}/mjolnir"
|
||||
state: absent
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/rest-auth/setup_install.yml"
|
||||
when: matrix_synapse_ext_password_provider_rest_auth_enabled | bool
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/rest-auth/setup_uninstall.yml"
|
||||
when: "not matrix_synapse_ext_password_provider_rest_auth_enabled | bool"
|
@ -0,0 +1,36 @@
|
||||
---
|
||||
|
||||
- name: Fail if REST Auth endpoint not configured
|
||||
ansible.builtin.fail:
|
||||
msg: "You have enabled the REST Auth password provider, but have not configured its endpoint in the `matrix_synapse_ext_password_provider_rest_auth_endpoint` variable. Consult the documentation."
|
||||
when: "matrix_synapse_ext_password_provider_rest_auth_endpoint == ''"
|
||||
|
||||
- name: Download matrix-synapse-rest-auth
|
||||
ansible.builtin.get_url:
|
||||
url: "{{ matrix_synapse_ext_password_provider_rest_auth_download_url }}"
|
||||
dest: "{{ matrix_synapse_ext_path }}/rest_auth_provider.py"
|
||||
force: true
|
||||
mode: 0440
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
register: result
|
||||
retries: "{{ matrix_geturl_retries_count }}"
|
||||
delay: "{{ matrix_geturl_retries_delay }}"
|
||||
until: result is not failed
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_synapse_password_providers_enabled: true
|
||||
|
||||
matrix_synapse_container_extra_arguments: >
|
||||
{{
|
||||
matrix_synapse_container_extra_arguments | default([])
|
||||
+
|
||||
["--mount type=bind,src={{ matrix_synapse_ext_path }}/rest_auth_provider.py,dst={{ matrix_synapse_in_container_python_packages_path }}/rest_auth_provider.py,ro"]
|
||||
}}
|
||||
|
||||
matrix_synapse_additional_loggers: >
|
||||
{{
|
||||
matrix_synapse_additional_loggers
|
||||
+
|
||||
[{'name': 'rest_auth_provider', 'level': 'INFO'}]
|
||||
}}
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
|
||||
- name: Ensure matrix-synapse-rest-auth doesn't exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_synapse_ext_path }}/rest_auth_provider.py"
|
||||
state: absent
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-synapse-s3-storage-provider-migrate.timer'] }}"
|
||||
when: matrix_synapse_ext_synapse_s3_storage_provider_enabled | bool
|
@ -0,0 +1,10 @@
|
||||
---
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/s3-storage-provider/validate_config.yml"
|
||||
when: matrix_synapse_ext_synapse_s3_storage_provider_enabled | bool
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/s3-storage-provider/setup_install.yml"
|
||||
when: matrix_synapse_ext_synapse_s3_storage_provider_enabled | bool
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/s3-storage-provider/setup_uninstall.yml"
|
||||
when: not matrix_synapse_ext_synapse_s3_storage_provider_enabled | bool
|
@ -0,0 +1,52 @@
|
||||
---
|
||||
|
||||
# We install this into Synapse by making `matrix_synapse_ext_synapse_s3_storage_provider_enabled` influence other variables:
|
||||
# - `matrix_synapse_media_storage_providers` (via `matrix_synapse_media_storage_providers_auto`)
|
||||
# - `matrix_synapse_container_image_customizations_enabled`
|
||||
# - `matrix_synapse_container_image_customizations_s3_storage_provider_installation_enabled`
|
||||
#
|
||||
# Below are additional tasks for setting up various helper scripts, etc.
|
||||
|
||||
- name: Ensure s3-storage-provider env file installed
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/synapse/ext/s3-storage-provider/env.j2"
|
||||
dest: "{{ matrix_synapse_ext_s3_storage_provider_path }}/env"
|
||||
mode: 0640
|
||||
|
||||
- name: Ensure s3-storage-provider data path exists
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_synapse_ext_s3_storage_provider_path }}/data"
|
||||
state: directory
|
||||
mode: 0750
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
|
||||
- name: Ensure s3-storage-provider database.yaml file installed
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/synapse/ext/s3-storage-provider/database.yaml.j2"
|
||||
dest: "{{ matrix_synapse_ext_s3_storage_provider_path }}/data/database.yaml"
|
||||
mode: 0640
|
||||
|
||||
- name: Ensure s3-storage-provider scripts installed
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/synapse/ext/s3-storage-provider/usr-local-bin/{{ item }}.j2"
|
||||
dest: "{{ matrix_local_bin_path }}/{{ item }}"
|
||||
mode: 0750
|
||||
with_items:
|
||||
- matrix-synapse-s3-storage-provider-shell
|
||||
- matrix-synapse-s3-storage-provider-migrate
|
||||
|
||||
- name: Ensure matrix-synapse-s3-storage-provider-migrate.service and timer are installed
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/synapse/ext/s3-storage-provider/systemd/{{ item }}.j2"
|
||||
dest: "{{ matrix_systemd_path }}/{{ item }}"
|
||||
mode: 0640
|
||||
with_items:
|
||||
- matrix-synapse-s3-storage-provider-migrate.service
|
||||
- matrix-synapse-s3-storage-provider-migrate.timer
|
||||
register: matrix_synapse_s3_storage_provider_systemd_service_result
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-synapse-s3-storage-provider-migrate.service installation
|
||||
ansible.builtin.service:
|
||||
daemon_reload: true
|
||||
when: matrix_synapse_s3_storage_provider_systemd_service_result.changed | bool
|
@ -0,0 +1,24 @@
|
||||
---
|
||||
|
||||
- name: Ensure matrix-synapse-s3-storage-provider-migrate.service and timer don't exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_systemd_path }}/{{ item }}"
|
||||
state: absent
|
||||
with_items:
|
||||
- matrix-synapse-s3-storage-provider-migrate.timer
|
||||
- matrix-synapse-s3-storage-provider-migrate.service
|
||||
register: matrix_synapse_s3_storage_provider_migrate_sevice_removal
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-synapse-s3-storage-provider-migrate.service removal
|
||||
ansible.builtin.service:
|
||||
daemon_reload: true
|
||||
when: matrix_synapse_s3_storage_provider_migrate_sevice_removal.changed | bool
|
||||
|
||||
- name: Ensure s3-storage-provider files don't exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: absent
|
||||
with_items:
|
||||
- "{{ matrix_local_bin_path }}/matrix-synapse-s3-storage-provider-shell"
|
||||
- "{{ matrix_local_bin_path }}/matrix-synapse-s3-storage-provider-migrate"
|
||||
- "{{ matrix_synapse_ext_s3_storage_provider_path }}"
|
@ -0,0 +1,18 @@
|
||||
---
|
||||
|
||||
- name: Fail if required s3-storage-provider settings not defined
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
You need to define a required configuration setting (`{{ item }}`) for using s3-storage-provider.
|
||||
when: "vars[item] == ''"
|
||||
with_items:
|
||||
- "matrix_synapse_ext_synapse_s3_storage_provider_config_bucket"
|
||||
- "matrix_synapse_ext_synapse_s3_storage_provider_config_region_name"
|
||||
- "matrix_synapse_ext_synapse_s3_storage_provider_config_access_key_id"
|
||||
- "matrix_synapse_ext_synapse_s3_storage_provider_config_secret_access_key"
|
||||
|
||||
- name: Fail if required matrix_synapse_ext_synapse_s3_storage_provider_config_endpoint_url looks invalid
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
`matrix_synapse_ext_synapse_s3_storage_provider_config_endpoint_url` needs to look like a URL (`http://` or `https://` prefix).
|
||||
when: "matrix_synapse_ext_synapse_s3_storage_provider_config_endpoint_url != '' and not matrix_synapse_ext_synapse_s3_storage_provider_config_endpoint_url.startswith('http')"
|
15
roles/custom/matrix-synapse/tasks/ext/setup.yml
Normal file
15
roles/custom/matrix-synapse/tasks/ext/setup.yml
Normal file
@ -0,0 +1,15 @@
|
||||
---
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/encryption-disabler/setup.yml"
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/rest-auth/setup.yml"
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/shared-secret-auth/setup.yml"
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/ldap-auth/setup.yml"
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/synapse-simple-antispam/setup.yml"
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/mjolnir-antispam/setup.yml"
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/s3-storage-provider/setup.yml"
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/shared-secret-auth/setup_install.yml"
|
||||
when: matrix_synapse_ext_password_provider_shared_secret_auth_enabled | bool
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/shared-secret-auth/setup_uninstall.yml"
|
||||
when: "not matrix_synapse_ext_password_provider_shared_secret_auth_enabled | bool"
|
@ -0,0 +1,51 @@
|
||||
---
|
||||
|
||||
- name: Fail if Shared Secret Auth secret not set
|
||||
ansible.builtin.fail:
|
||||
msg: "Shared Secret Auth is enabled, but no secret has been set in matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret"
|
||||
when: "matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret == ''"
|
||||
|
||||
- name: Fail if no Shared Secret Auth login types enabled
|
||||
ansible.builtin.fail:
|
||||
msg: "Shared Secret Auth is enabled, but none of the login types are"
|
||||
when: "not (matrix_synapse_ext_password_provider_shared_secret_auth_m_login_password_support_enabled or matrix_synapse_ext_password_provider_shared_secret_auth_com_devture_shared_secret_auth_support_enabled)"
|
||||
|
||||
- name: Download matrix-synapse-shared-secret-auth
|
||||
ansible.builtin.get_url:
|
||||
url: "{{ matrix_synapse_ext_password_provider_shared_secret_auth_download_url }}"
|
||||
dest: "{{ matrix_synapse_ext_path }}/shared_secret_authenticator.py"
|
||||
force: true
|
||||
mode: 0440
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
register: result
|
||||
retries: "{{ matrix_geturl_retries_count }}"
|
||||
delay: "{{ matrix_geturl_retries_delay }}"
|
||||
until: result is not failed
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_synapse_modules: |
|
||||
{{
|
||||
matrix_synapse_modules | default([])
|
||||
+
|
||||
[
|
||||
{
|
||||
"module": "shared_secret_authenticator.SharedSecretAuthProvider",
|
||||
"config": matrix_synapse_ext_password_provider_shared_secret_config
|
||||
}
|
||||
]
|
||||
}}
|
||||
|
||||
matrix_synapse_container_extra_arguments: >
|
||||
{{
|
||||
matrix_synapse_container_extra_arguments | default([])
|
||||
+
|
||||
["--mount type=bind,src={{ matrix_synapse_ext_path }}/shared_secret_authenticator.py,dst={{ matrix_synapse_in_container_python_packages_path }}/shared_secret_authenticator.py,ro"]
|
||||
}}
|
||||
|
||||
matrix_synapse_additional_loggers: >
|
||||
{{
|
||||
matrix_synapse_additional_loggers
|
||||
+
|
||||
[{'name': 'shared_secret_authenticator', 'level': 'INFO'}]
|
||||
}}
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
|
||||
- name: Ensure matrix-synapse-shared-secret-auth doesn't exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_synapse_ext_path }}/shared_secret_authenticator.py"
|
||||
state: absent
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/synapse-simple-antispam/setup_install.yml"
|
||||
when: matrix_synapse_ext_spam_checker_synapse_simple_antispam_enabled | bool
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/synapse-simple-antispam/setup_uninstall.yml"
|
||||
when: "not matrix_synapse_ext_spam_checker_synapse_simple_antispam_enabled | bool"
|
@ -0,0 +1,58 @@
|
||||
---
|
||||
|
||||
- name: Fail if Synapse Simple Antispam blocked homeservers is not set
|
||||
ansible.builtin.fail:
|
||||
msg: "Synapse Simple Antispam is enabled, but no blocked homeservers have been set in matrix_synapse_ext_spam_checker_synapse_simple_antispam_config_blocked_homeservers"
|
||||
when: "matrix_synapse_ext_spam_checker_synapse_simple_antispam_config_blocked_homeservers | length == 0"
|
||||
|
||||
- name: Ensure git installed (RedHat)
|
||||
ansible.builtin.yum:
|
||||
name:
|
||||
- git
|
||||
state: present
|
||||
update_cache: false
|
||||
when: "ansible_os_family == 'RedHat'"
|
||||
|
||||
- name: Ensure git installed (Debian)
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- git
|
||||
state: present
|
||||
update_cache: false
|
||||
when: "ansible_os_family == 'Debian'"
|
||||
|
||||
- name: Ensure git installed (Archlinux)
|
||||
community.general.pacman:
|
||||
name:
|
||||
- git
|
||||
state: present
|
||||
update_cache: false
|
||||
when: "ansible_distribution == 'Archlinux'"
|
||||
|
||||
- name: Clone synapse-simple-antispam git repository
|
||||
ansible.builtin.git:
|
||||
repo: "{{ matrix_synapse_ext_spam_checker_synapse_simple_antispam_git_repository_url }}"
|
||||
version: "{{ matrix_synapse_ext_spam_checker_synapse_simple_antispam_git_version }}"
|
||||
dest: "{{ matrix_synapse_ext_path }}/synapse-simple-antispam"
|
||||
become: true
|
||||
become_user: "{{ matrix_user_username }}"
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_synapse_modules: >
|
||||
{{
|
||||
matrix_synapse_modules
|
||||
+
|
||||
[{
|
||||
"module": "synapse_simple_antispam.AntiSpamInvites",
|
||||
"config": {
|
||||
"blocked_homeservers": matrix_synapse_ext_spam_checker_synapse_simple_antispam_config_blocked_homeservers
|
||||
}
|
||||
}]
|
||||
}}
|
||||
|
||||
matrix_synapse_container_extra_arguments: >
|
||||
{{
|
||||
matrix_synapse_container_extra_arguments | default([])
|
||||
+
|
||||
["--mount type=bind,src={{ matrix_synapse_ext_path }}/synapse-simple-antispam/synapse_simple_antispam,dst={{ matrix_synapse_in_container_python_packages_path }}/synapse_simple_antispam,ro"]
|
||||
}}
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
|
||||
- name: Ensure synapse-simple-antispam doesn't exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_synapse_ext_path }}/synapse-simple-antispam"
|
||||
state: absent
|
7
roles/custom/matrix-synapse/tasks/goofys/setup.yml
Normal file
7
roles/custom/matrix-synapse/tasks/goofys/setup.yml
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/goofys/setup_install.yml"
|
||||
when: matrix_s3_media_store_enabled | bool
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/goofys/setup_uninstall.yml"
|
||||
when: "not matrix_s3_media_store_enabled | bool"
|
49
roles/custom/matrix-synapse/tasks/goofys/setup_install.yml
Normal file
49
roles/custom/matrix-synapse/tasks/goofys/setup_install.yml
Normal file
@ -0,0 +1,49 @@
|
||||
---
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/../matrix-base/tasks/util/ensure_fuse_installed.yml"
|
||||
|
||||
- name: Ensure Goofys Docker image is pulled
|
||||
community.docker.docker_image:
|
||||
name: "{{ matrix_s3_goofys_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_s3_goofys_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_s3_goofys_docker_image_force_pull }}"
|
||||
register: result
|
||||
retries: "{{ matrix_container_retries_count }}"
|
||||
delay: "{{ matrix_container_retries_delay }}"
|
||||
until: result is not failed
|
||||
|
||||
# This will throw a Permission Denied error if already mounted
|
||||
- name: Check Matrix Goofys external storage mountpoint path
|
||||
ansible.builtin.stat:
|
||||
path: "{{ matrix_s3_media_store_path }}"
|
||||
register: local_path_matrix_s3_media_store_path_stat
|
||||
ignore_errors: true
|
||||
|
||||
- name: Ensure Matrix Goofys external storage mountpoint exists
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_s3_media_store_path }}"
|
||||
state: directory
|
||||
mode: 0750
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
when: "not local_path_matrix_s3_media_store_path_stat.failed and not local_path_matrix_s3_media_store_path_stat.stat.exists"
|
||||
|
||||
- name: Ensure goofys environment variables file created
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/goofys/env-goofys.j2"
|
||||
dest: "{{ matrix_synapse_config_dir_path }}/env-goofys"
|
||||
owner: root
|
||||
mode: 0600
|
||||
|
||||
- name: Ensure matrix-goofys.service installed
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/goofys/systemd/matrix-goofys.service.j2"
|
||||
dest: "{{ matrix_systemd_path }}/matrix-goofys.service"
|
||||
mode: 0644
|
||||
register: matrix_goofys_systemd_service_result
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-goofys.service installation
|
||||
ansible.builtin.service:
|
||||
daemon_reload: true
|
||||
when: "matrix_goofys_systemd_service_result.changed"
|
36
roles/custom/matrix-synapse/tasks/goofys/setup_uninstall.yml
Normal file
36
roles/custom/matrix-synapse/tasks/goofys/setup_uninstall.yml
Normal file
@ -0,0 +1,36 @@
|
||||
---
|
||||
|
||||
- name: Check existence of matrix-goofys service
|
||||
ansible.builtin.stat:
|
||||
path: "{{ matrix_systemd_path }}/matrix-goofys.service"
|
||||
register: matrix_goofys_service_stat
|
||||
|
||||
- name: Ensure matrix-goofys is stopped
|
||||
ansible.builtin.service:
|
||||
name: matrix-goofys
|
||||
state: stopped
|
||||
enabled: false
|
||||
daemon_reload: true
|
||||
register: stopping_result
|
||||
when: "matrix_goofys_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure matrix-goofys.service doesn't exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_systemd_path }}/matrix-goofys.service"
|
||||
state: absent
|
||||
when: "matrix_goofys_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-goofys.service removal
|
||||
ansible.builtin.service:
|
||||
daemon_reload: true
|
||||
when: "matrix_goofys_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure goofys environment variables file doesn't exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_synapse_config_dir_path }}/env-goofys"
|
||||
state: absent
|
||||
|
||||
- name: Ensure Goofys Docker image doesn't exist
|
||||
community.docker.docker_image:
|
||||
name: "{{ matrix_s3_goofys_docker_image }}"
|
||||
state: absent
|
84
roles/custom/matrix-synapse/tasks/import_media_store.yml
Normal file
84
roles/custom/matrix-synapse/tasks/import_media_store.yml
Normal file
@ -0,0 +1,84 @@
|
||||
---
|
||||
|
||||
# Pre-checks
|
||||
|
||||
- name: Fail if playbook called incorrectly
|
||||
ansible.builtin.fail:
|
||||
msg: "The `server_path_media_store` variable needs to be provided to this playbook, via --extra-vars"
|
||||
when: "server_path_media_store is not defined or server_path_media_store.startswith('<')"
|
||||
|
||||
- name: Fail if media store is on Amazon S3
|
||||
ansible.builtin.fail:
|
||||
msg: "Your media store is on Amazon S3. Due to technical limitations, restoring is not supported."
|
||||
when: matrix_s3_media_store_enabled | bool
|
||||
|
||||
- name: Check if the provided media store directory exists
|
||||
ansible.builtin.stat:
|
||||
path: "{{ server_path_media_store }}"
|
||||
register: server_path_media_store_stat
|
||||
|
||||
- name: Fail if provided media store directory doesn't exist on the server
|
||||
ansible.builtin.fail:
|
||||
msg: "{{ server_path_media_store }} cannot be found on the server"
|
||||
when: "not server_path_media_store_stat.stat.exists or not server_path_media_store_stat.stat.isdir"
|
||||
|
||||
- name: Check if media store contains local_content
|
||||
ansible.builtin.stat:
|
||||
path: "{{ server_path_media_store }}/local_content"
|
||||
register: server_path_media_store_local_content_stat
|
||||
|
||||
- name: Check if media store contains remote_content
|
||||
ansible.builtin.stat:
|
||||
path: "{{ server_path_media_store }}/remote_content"
|
||||
register: server_path_media_store_remote_content_stat
|
||||
|
||||
- name: Fail if media store directory doesn't look okay (lacking remote and local content)
|
||||
ansible.builtin.fail:
|
||||
msg: "{{ server_path_media_store }} contains neither local_content nor remote_content directories. It's most likely a mistake and is not a media store directory."
|
||||
when: "not server_path_media_store_local_content_stat.stat.exists and not server_path_media_store_remote_content_stat.stat.exists"
|
||||
|
||||
|
||||
# Actual import work
|
||||
|
||||
- name: Ensure matrix-synapse is stopped
|
||||
ansible.builtin.service:
|
||||
name: matrix-synapse
|
||||
state: stopped
|
||||
enabled: false
|
||||
daemon_reload: true
|
||||
register: stopping_result
|
||||
|
||||
# This can only work with local files, not if the media store is on Amazon S3,
|
||||
# as it won't be accessible in such a case.
|
||||
- name: Ensure provided media store directory is synchronized
|
||||
ansible.posix.synchronize:
|
||||
src: "{{ server_path_media_store }}/"
|
||||
dest: "{{ matrix_synapse_media_store_path }}"
|
||||
delete: true
|
||||
# It's wasteful to preserve owner/group now. We chown below anyway.
|
||||
owner: false
|
||||
group: false
|
||||
times: true
|
||||
delegate_to: "{{ inventory_hostname }}"
|
||||
|
||||
# This is for the generic case and fails in other cases (remote file systems),
|
||||
# because in such cases the base path (matrix_synapse_media_store_path) is a mount point.
|
||||
- name: Ensure media store permissions are correct (generic case)
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_synapse_media_store_path }}"
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
recurse: true
|
||||
when: "not matrix_s3_media_store_enabled | bool"
|
||||
|
||||
# We don't chown for Goofys, because due to the way it's mounted,
|
||||
# all files become owned by whoever needs to own them.
|
||||
|
||||
- name: Ensure Synapse is started (if it previously was)
|
||||
ansible.builtin.service:
|
||||
name: "{{ item }}"
|
||||
state: started
|
||||
daemon_reload: true
|
||||
when: "stopping_result.changed"
|
||||
with_items:
|
||||
- matrix-synapse
|
90
roles/custom/matrix-synapse/tasks/init.yml
Normal file
90
roles/custom/matrix-synapse/tasks/init.yml
Normal file
@ -0,0 +1,90 @@
|
||||
---
|
||||
# See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070
|
||||
# and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407
|
||||
- name: Fail if trying to self-build on Ansible < 2.8
|
||||
ansible.builtin.fail:
|
||||
msg: "To self-build the Synapse image, you should use Ansible 2.8 or higher. See docs/ansible.md"
|
||||
when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_synapse_container_image_self_build and matrix_synapse_enabled"
|
||||
|
||||
# Unless `matrix_synapse_workers_enabled_list` is explicitly defined,
|
||||
# we'll generate it dynamically.
|
||||
- ansible.builtin.include_tasks: "{{ role_path }}/tasks/synapse/workers/init.yml"
|
||||
when: "matrix_synapse_enabled and matrix_synapse_workers_enabled and matrix_synapse_workers_enabled_list | length == 0"
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-synapse.service'] }}"
|
||||
when: matrix_synapse_enabled | bool
|
||||
|
||||
- name: Ensure workers are injected into various places
|
||||
ansible.builtin.include_tasks: "{{ role_path }}/tasks/synapse/workers/util/inject_worker.yml"
|
||||
with_items: "{{ matrix_synapse_workers_enabled_list }}"
|
||||
loop_control:
|
||||
loop_var: matrix_synapse_worker_details
|
||||
when: matrix_synapse_enabled | bool and matrix_synapse_workers_enabled | bool
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-goofys.service'] }}"
|
||||
when: matrix_s3_media_store_enabled | bool
|
||||
|
||||
- ansible.builtin.include_tasks: "{{ role_path }}/tasks/ext/s3-storage-provider/init.yml"
|
||||
when: matrix_synapse_ext_synapse_s3_storage_provider_enabled | bool
|
||||
|
||||
- when: matrix_synapse_enabled | bool and matrix_synapse_metrics_proxying_enabled | bool
|
||||
block:
|
||||
- name: Fail if matrix-nginx-proxy role already executed
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
Trying to append Synapse's reverse-proxying configuration to matrix-nginx-proxy,
|
||||
but it's pointless since the matrix-nginx-proxy role had already executed.
|
||||
To fix this, please change the order of roles in your playbook,
|
||||
so that the matrix-nginx-proxy role would run after the matrix-synapse role.
|
||||
when: matrix_nginx_proxy_role_executed | default(False) | bool
|
||||
|
||||
- name: Generate synapse metrics proxying configuration for matrix-nginx-proxy (matrix.DOMAIN/metrics/synapse/main-process)
|
||||
ansible.builtin.set_fact:
|
||||
matrix_synapse_nginx_metrics_configuration_block: |
|
||||
location /metrics/synapse/main-process {
|
||||
{% if matrix_nginx_proxy_enabled | default(False) %}
|
||||
{# Use the embedded DNS resolver in Docker containers to discover the service #}
|
||||
resolver 127.0.0.11 valid=5s;
|
||||
set $backend "matrix-synapse:{{ matrix_synapse_metrics_port }}";
|
||||
proxy_pass http://$backend/_synapse/metrics;
|
||||
{% else %}
|
||||
{# Generic configuration for use outside of our container setup #}
|
||||
proxy_pass http://127.0.0.1:{{ matrix_synapse_metrics_port }}/_synapse/metrics;
|
||||
{% endif %}
|
||||
}
|
||||
|
||||
- name: Register synapse metrics proxying configuration with matrix-nginx-proxy (matrix.DOMAIN/metrics/synapse/main-process)
|
||||
ansible.builtin.set_fact:
|
||||
matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks: |
|
||||
{{
|
||||
matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks | default([])
|
||||
+
|
||||
[matrix_synapse_nginx_metrics_configuration_block]
|
||||
}}
|
||||
|
||||
- name: Generate synapse worker metrics proxying configuration for matrix-nginx-proxy (matrix.DOMAIN/metrics/synapse/worker)
|
||||
ansible.builtin.set_fact:
|
||||
matrix_synapse_worker_nginx_metrics_configuration_block: |
|
||||
{% for worker in matrix_synapse_workers_enabled_list %}
|
||||
{% if worker.metrics_port != 0 %}
|
||||
location /metrics/synapse/worker/{{ worker.id }} {
|
||||
resolver 127.0.0.11 valid=5s;
|
||||
set $backend "{{ worker.name }}:{{ worker.metrics_port }}";
|
||||
proxy_pass http://$backend/_synapse/metrics;
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
when: matrix_synapse_workers_enabled_list | length > 0
|
||||
|
||||
- name: Register synapse worker metrics proxying configuration with matrix-nginx-proxy (matrix.DOMAIN/metrics/synapse/worker)
|
||||
ansible.builtin.set_fact:
|
||||
matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks: |
|
||||
{{
|
||||
matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks | default([])
|
||||
+
|
||||
[matrix_synapse_worker_nginx_metrics_configuration_block]
|
||||
}}
|
||||
when: matrix_synapse_workers_enabled_list | length > 0
|
57
roles/custom/matrix-synapse/tasks/main.yml
Normal file
57
roles/custom/matrix-synapse/tasks/main.yml
Normal file
@ -0,0 +1,57 @@
|
||||
---
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml"
|
||||
tags:
|
||||
- always
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml"
|
||||
when: run_setup | bool and matrix_synapse_enabled | bool
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-synapse
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_synapse.yml"
|
||||
when: run_setup | bool
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-synapse
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/import_media_store.yml"
|
||||
when: run_synapse_import_media_store | bool
|
||||
tags:
|
||||
- import-synapse-media-store
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/register_user.yml"
|
||||
when: run_synapse_register_user | bool and matrix_synapse_enabled | bool
|
||||
tags:
|
||||
- register-user
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/self_check_client_api.yml"
|
||||
delegate_to: 127.0.0.1
|
||||
become: false
|
||||
when: run_self_check | bool
|
||||
tags:
|
||||
- self-check
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/self_check_federation_api.yml"
|
||||
delegate_to: 127.0.0.1
|
||||
become: false
|
||||
when: run_self_check | bool
|
||||
tags:
|
||||
- self-check
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/update_user_password.yml"
|
||||
when: run_synapse_update_user_password | bool and matrix_synapse_enabled | bool
|
||||
tags:
|
||||
- update-user-password
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/rust-synapse-compress-state/main.yml"
|
||||
when: run_synapse_rust_synapse_compress_state | bool
|
||||
tags:
|
||||
- rust-synapse-compress-state
|
||||
|
||||
- name: Mark matrix-synapse role as executed
|
||||
ansible.builtin.set_fact:
|
||||
matrix_synapse_role_executed: true
|
||||
tags:
|
||||
- always
|
33
roles/custom/matrix-synapse/tasks/register_user.yml
Normal file
33
roles/custom/matrix-synapse/tasks/register_user.yml
Normal file
@ -0,0 +1,33 @@
|
||||
---
|
||||
|
||||
- name: Fail if playbook called incorrectly
|
||||
ansible.builtin.fail:
|
||||
msg: "The `username` variable needs to be provided to this playbook, via --extra-vars"
|
||||
when: "username is not defined or username == '<your-username>'"
|
||||
|
||||
- name: Fail if playbook called incorrectly
|
||||
ansible.builtin.fail:
|
||||
msg: "The `password` variable needs to be provided to this playbook, via --extra-vars"
|
||||
when: "password is not defined or password == '<your-password>'"
|
||||
|
||||
- name: Fail if playbook called incorrectly
|
||||
ansible.builtin.fail:
|
||||
msg: "The `admin` variable needs to be provided to this playbook, via --extra-vars"
|
||||
when: "admin is not defined or admin not in ['yes', 'no']"
|
||||
|
||||
- name: Ensure matrix-synapse is started
|
||||
ansible.builtin.service:
|
||||
name: matrix-synapse
|
||||
state: started
|
||||
daemon_reload: true
|
||||
register: start_result
|
||||
|
||||
- name: Wait a while, so that Synapse can manage to start
|
||||
ansible.builtin.pause:
|
||||
seconds: 7
|
||||
when: "start_result.changed"
|
||||
|
||||
- name: Register user
|
||||
ansible.builtin.command: "{{ matrix_local_bin_path }}/matrix-synapse-register-user {{ username | quote }} {{ password | quote }} {{ '1' if admin == 'yes' else '0' }}"
|
||||
register: matrix_synapse_register_user_result
|
||||
changed_when: matrix_synapse_register_user_result.rc == 0
|
@ -0,0 +1,55 @@
|
||||
---
|
||||
|
||||
- ansible.builtin.debug:
|
||||
msg: "Compressing room `{{ room_details.room_id }}` having {{ room_details.count }} state group rows"
|
||||
|
||||
- name: Generate rust-synapse-compress-state room compression command
|
||||
ansible.builtin.set_fact:
|
||||
matrix_synapse_rust_synapse_compress_state_compress_room_command: >-
|
||||
{{ matrix_host_command_docker }} run --rm --name matrix-rust-synapse-compress-state-compress-room
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }}
|
||||
--cap-drop=ALL
|
||||
--network={{ matrix_docker_network }}
|
||||
--mount type=bind,src={{ matrix_synapse_rust_synapse_compress_state_base_path }},dst=/work
|
||||
{{ matrix_synapse_rust_synapse_compress_state_docker_image }}
|
||||
{{ matrix_synapse_rust_synapse_compress_state_synapse_compress_state_in_container_path }} -t -o /work/state-compressor.sql
|
||||
-p "host={{ matrix_synapse_database_host }} user={{ matrix_synapse_database_user }} password={{ matrix_synapse_database_password }} dbname={{ matrix_synapse_database_database }}"
|
||||
-r '{{ room_details.room_id }}'
|
||||
|
||||
- name: Run rust-synapse-compress-state room compression command (SQL generation)
|
||||
ansible.builtin.command: "{{ matrix_synapse_rust_synapse_compress_state_compress_room_command }}"
|
||||
async: "{{ matrix_synapse_rust_synapse_compress_state_compress_room_time }}"
|
||||
poll: 10
|
||||
register: matrix_synapse_rust_synapse_compress_state_compress_room_command_result
|
||||
failed_when: not matrix_synapse_rust_synapse_compress_state_compress_room_command_result.finished or matrix_synapse_rust_synapse_compress_state_compress_room_command_result.rc != 0
|
||||
changed_when: matrix_synapse_rust_synapse_compress_state_compress_room_command_result.finished and matrix_synapse_rust_synapse_compress_state_compress_room_command_result.rc == 0
|
||||
|
||||
- ansible.builtin.debug:
|
||||
var: "matrix_synapse_rust_synapse_compress_state_compress_room_command_result"
|
||||
|
||||
- name: Generate Postgres compression SQL import command
|
||||
ansible.builtin.set_fact:
|
||||
matrix_synapse_rust_synapse_compress_state_psql_import_command: >-
|
||||
{{ matrix_host_command_docker }} run --rm --name matrix-rust-synapse-compress-state-psql-import
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }}
|
||||
--cap-drop=ALL
|
||||
--network={{ matrix_docker_network }}
|
||||
--env-file={{ matrix_postgres_base_path }}/env-postgres-psql
|
||||
--mount type=bind,src={{ matrix_synapse_rust_synapse_compress_state_base_path }},dst=/work,ro
|
||||
--entrypoint=/bin/sh
|
||||
{{ matrix_postgres_docker_image_latest }}
|
||||
-c "cat /work/state-compressor.sql |
|
||||
psql -v ON_ERROR_STOP=1 -h matrix-postgres -d {{ matrix_synapse_database_database }}"
|
||||
|
||||
- name: Import compression SQL into Postgres
|
||||
ansible.builtin.command: "{{ matrix_synapse_rust_synapse_compress_state_psql_import_command }}"
|
||||
async: "{{ matrix_synapse_rust_synapse_compress_state_psql_import_time }}"
|
||||
poll: 10
|
||||
register: matrix_synapse_rust_synapse_compress_state_psql_import_command_result
|
||||
failed_when: not matrix_synapse_rust_synapse_compress_state_psql_import_command_result.finished
|
||||
changed_when: matrix_synapse_rust_synapse_compress_state_psql_import_command_result.finished and matrix_synapse_rust_synapse_compress_state_psql_import_command_result.rc == 0
|
||||
|
||||
- name: Clean up
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_synapse_rust_synapse_compress_state_base_path }}/state-compressor.sql"
|
||||
state: absent
|
@ -0,0 +1,126 @@
|
||||
---
|
||||
# Pre-checks
|
||||
|
||||
- name: Fail if Postgres not enabled
|
||||
ansible.builtin.fail:
|
||||
msg: "Postgres via the matrix-postgres role is not enabled (`matrix_postgres_enabled`). Cannot use rust-synapse-compress-state."
|
||||
when: "not matrix_postgres_enabled | bool"
|
||||
|
||||
|
||||
# Defaults
|
||||
|
||||
- name: Set matrix_synapse_rust_synapse_compress_state_find_rooms_command_wait_time, if not provided
|
||||
ansible.builtin.set_fact:
|
||||
matrix_synapse_rust_synapse_compress_state_find_rooms_command_wait_time: 1800
|
||||
when: "matrix_synapse_rust_synapse_compress_state_find_rooms_command_wait_time | default('') == ''"
|
||||
|
||||
- name: Set matrix_synapse_rust_synapse_compress_state_compress_room_time, if not provided
|
||||
ansible.builtin.set_fact:
|
||||
matrix_synapse_rust_synapse_compress_state_compress_room_time: 3600
|
||||
when: "matrix_synapse_rust_synapse_compress_state_compress_room_time | default('') == ''"
|
||||
|
||||
- name: Set matrix_synapse_rust_synapse_compress_state_psql_import_time, if not provided
|
||||
ansible.builtin.set_fact:
|
||||
matrix_synapse_rust_synapse_compress_state_psql_import_time: 3600
|
||||
when: "matrix_synapse_rust_synapse_compress_state_psql_import_time | default('') == ''"
|
||||
|
||||
- name: Set matrix_synapse_rust_synapse_compress_state_min_state_groups_required, if not provided
|
||||
ansible.builtin.set_fact:
|
||||
# The minimum number of state groups we're looking for before we consider a room eligible for compression.
|
||||
# Rooms with a smaller state groups count will not be compressed.
|
||||
matrix_synapse_rust_synapse_compress_state_min_state_groups_required: 100000
|
||||
when: "matrix_synapse_rust_synapse_compress_state_min_state_groups_required | default('') == ''"
|
||||
|
||||
|
||||
# Actual compression work
|
||||
|
||||
- name: Ensure rust-synapse-compress-state paths exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_synapse_rust_synapse_compress_state_base_path }}"
|
||||
state: directory
|
||||
mode: 0750
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
|
||||
- name: Ensure rust-synapse-compress-state image is pulled
|
||||
community.docker.docker_image:
|
||||
name: "{{ matrix_synapse_rust_synapse_compress_state_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_synapse_rust_synapse_compress_state_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_synapse_rust_synapse_compress_state_docker_image_force_pull }}"
|
||||
register: result
|
||||
retries: "{{ matrix_container_retries_count }}"
|
||||
delay: "{{ matrix_container_retries_delay }}"
|
||||
until: result is not failed
|
||||
|
||||
- name: Generate rust-synapse-compress-state room find command
|
||||
ansible.builtin.set_fact:
|
||||
matrix_synapse_rust_synapse_compress_state_find_rooms_command: >-
|
||||
{{ matrix_host_command_docker }} run --rm --name matrix-rust-synapse-compress-state-find-rooms
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }}
|
||||
--cap-drop=ALL
|
||||
--network={{ matrix_docker_network }}
|
||||
--env-file={{ matrix_postgres_base_path }}/env-postgres-psql
|
||||
{{ matrix_postgres_docker_image_latest }}
|
||||
psql -v ON_ERROR_STOP=1 -h matrix-postgres {{ matrix_synapse_database_database }} -c
|
||||
'SELECT array_to_json(array_agg(row_to_json (r))) FROM (SELECT room_id, count(*) AS count FROM state_groups_state GROUP BY room_id HAVING count(*) > {{ matrix_synapse_rust_synapse_compress_state_min_state_groups_required }} ORDER BY count DESC) r;'
|
||||
|
||||
- name: Find rooms eligible for compression with rust-synapse-compress-state
|
||||
ansible.builtin.command: "{{ matrix_synapse_rust_synapse_compress_state_find_rooms_command }}"
|
||||
async: "{{ matrix_synapse_rust_synapse_compress_state_find_rooms_command_wait_time }}"
|
||||
poll: 10
|
||||
register: matrix_synapse_rust_synapse_compress_state_find_rooms_command_result
|
||||
failed_when: not matrix_synapse_rust_synapse_compress_state_find_rooms_command_result.finished
|
||||
changed_when: false
|
||||
|
||||
# We expect the output to be like this:
|
||||
#
|
||||
# "stdout_lines": [
|
||||
# " array_to_json ",
|
||||
# "----------------------------------------------------------------------------------------------------------------------------",
|
||||
# " [{\"room_id\":\"!some-id\",\"count\":2461329},{\"room_id\":\"!another-id\",\"count\":512017}]",
|
||||
# "(1 row)"
|
||||
# ]
|
||||
#
|
||||
# Row 3 (out of 4) contains the actual result.
|
||||
#
|
||||
# Row 3 contains a space when there's no result.
|
||||
|
||||
- when: "matrix_synapse_rust_synapse_compress_state_find_rooms_command_result.failed or matrix_synapse_rust_synapse_compress_state_find_rooms_command_result.stdout_lines | length != 4"
|
||||
block:
|
||||
- ansible.builtin.debug:
|
||||
var: "matrix_synapse_rust_synapse_compress_state_find_rooms_command_result"
|
||||
|
||||
- name: Fail if room find result is not what we expect
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
Expecting 4 lines in the "find rooms" result.
|
||||
|
||||
- when: "matrix_synapse_rust_synapse_compress_state_find_rooms_command_result.stdout_lines[2] != ' '"
|
||||
block:
|
||||
# matrix_synapse_rust_synapse_compress_state_eligible_rooms is a list
|
||||
# of dictionaries like this: {'room_id': '!some-id', 'count': 2461329}
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_synapse_rust_synapse_compress_state_eligible_rooms: "{{ matrix_synapse_rust_synapse_compress_state_find_rooms_command_result.stdout_lines[2] | from_json }}"
|
||||
|
||||
- name: Display rooms that will be compressed
|
||||
ansible.builtin.debug:
|
||||
msg: >-
|
||||
The following rooms contain more than {{ matrix_synapse_rust_synapse_compress_state_min_state_groups_required }} state group rows
|
||||
(configurable via `matrix_synapse_rust_synapse_compress_state_min_state_groups_required`)
|
||||
and will be compressed:
|
||||
{{ matrix_synapse_rust_synapse_compress_state_eligible_rooms }}
|
||||
|
||||
- name: Compress room state
|
||||
ansible.builtin.include_tasks: "{{ role_path }}/tasks/rust-synapse-compress-state/compress_room.yml"
|
||||
with_items: "{{ matrix_synapse_rust_synapse_compress_state_eligible_rooms }}"
|
||||
loop_control:
|
||||
loop_var: room_details
|
||||
|
||||
- name: Show notice about lack of rooms to compress
|
||||
ansible.builtin.debug:
|
||||
msg: >-
|
||||
No rooms were found to contain more than {{ matrix_synapse_rust_synapse_compress_state_min_state_groups_required }} state group rows
|
||||
(configurable via `matrix_synapse_rust_synapse_compress_state_min_state_groups_required`),
|
||||
so there's nothing to compress.
|
||||
when: "matrix_synapse_rust_synapse_compress_state_find_rooms_command_result.stdout_lines[2] == ' '"
|
21
roles/custom/matrix-synapse/tasks/self_check_client_api.yml
Normal file
21
roles/custom/matrix-synapse/tasks/self_check_client_api.yml
Normal file
@ -0,0 +1,21 @@
|
||||
---
|
||||
|
||||
- name: Check Matrix Client API
|
||||
ansible.builtin.uri:
|
||||
url: "{{ matrix_synapse_client_api_url_endpoint_public }}"
|
||||
follow_redirects: none
|
||||
validate_certs: "{{ matrix_synapse_self_check_validate_certificates }}"
|
||||
register: result_matrix_synapse_client_api
|
||||
ignore_errors: true
|
||||
check_mode: false
|
||||
when: matrix_synapse_enabled | bool
|
||||
|
||||
- name: Fail if Matrix Client API not working
|
||||
ansible.builtin.fail:
|
||||
msg: "Failed checking Matrix Client API is up at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_client_api_url_endpoint_public }}`). Is Synapse running? Is port 443 open in your firewall? Full error: {{ result_matrix_synapse_client_api }}"
|
||||
when: "matrix_synapse_enabled | bool and (result_matrix_synapse_client_api.failed or 'json' not in result_matrix_synapse_client_api)"
|
||||
|
||||
- name: Report working Matrix Client API
|
||||
ansible.builtin.debug:
|
||||
msg: "The Matrix Client API at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_client_api_url_endpoint_public }}`) is working"
|
||||
when: matrix_synapse_enabled | bool
|
@ -0,0 +1,26 @@
|
||||
---
|
||||
|
||||
- name: Check Matrix Federation API
|
||||
ansible.builtin.uri:
|
||||
url: "{{ matrix_synapse_federation_api_url_endpoint_public }}"
|
||||
follow_redirects: none
|
||||
validate_certs: "{{ matrix_synapse_self_check_validate_certificates }}"
|
||||
register: result_matrix_synapse_federation_api
|
||||
ignore_errors: true
|
||||
check_mode: false
|
||||
when: matrix_synapse_enabled | bool
|
||||
|
||||
- name: Fail if Matrix Federation API not working
|
||||
ansible.builtin.fail:
|
||||
msg: "Failed checking Matrix Federation API is up at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_federation_api_url_endpoint_public }}`). Is Synapse running? Is port {{ matrix_federation_public_port }} open in your firewall? Full error: {{ result_matrix_synapse_federation_api }}"
|
||||
when: "matrix_synapse_enabled | bool and matrix_synapse_federation_enabled | bool and (result_matrix_synapse_federation_api.failed or 'json' not in result_matrix_synapse_federation_api)"
|
||||
|
||||
- name: Fail if Matrix Federation API unexpectedly enabled
|
||||
ansible.builtin.fail:
|
||||
msg: "Matrix Federation API is up at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_federation_api_url_endpoint_public }}`) despite being disabled."
|
||||
when: "matrix_synapse_enabled | bool and not matrix_synapse_federation_enabled | bool and not result_matrix_synapse_federation_api.failed"
|
||||
|
||||
- name: Report working Matrix Federation API
|
||||
ansible.builtin.debug:
|
||||
msg: "The Matrix Federation API at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_federation_api_url_endpoint_public }}`) is working"
|
||||
when: "matrix_synapse_enabled | bool and matrix_synapse_federation_enabled | bool"
|
27
roles/custom/matrix-synapse/tasks/setup_synapse.yml
Normal file
27
roles/custom/matrix-synapse/tasks/setup_synapse.yml
Normal file
@ -0,0 +1,27 @@
|
||||
---
|
||||
|
||||
- name: Ensure Synapse paths exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
mode: 0750
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
with_items:
|
||||
- {path: "{{ matrix_synapse_config_dir_path }}", when: true}
|
||||
- {path: "{{ matrix_synapse_ext_path }}", when: true}
|
||||
- {path: "{{ matrix_synapse_docker_src_files_path }}", when: "{{ matrix_synapse_container_image_self_build }}"}
|
||||
- {path: "{{ matrix_synapse_customized_docker_src_files_path }}", when: "{{ matrix_synapse_container_image_customizations_enabled }}"}
|
||||
- {path: "{{ matrix_synapse_ext_s3_storage_provider_path }}", when: "{{ matrix_synapse_ext_synapse_s3_storage_provider_enabled }}"}
|
||||
# We handle matrix_synapse_media_store_path elsewhere (in ./synapse/setup_install.yml),
|
||||
# because if it's using Goofys and it's already mounted (from before),
|
||||
# trying to chown/chmod it here will cause trouble.
|
||||
when: "(matrix_synapse_enabled | bool or matrix_s3_media_store_enabled | bool) and item.when"
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/setup.yml"
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/synapse/workers/setup.yml"
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/synapse/setup.yml"
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/goofys/setup.yml"
|
7
roles/custom/matrix-synapse/tasks/synapse/setup.yml
Normal file
7
roles/custom/matrix-synapse/tasks/synapse/setup.yml
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/synapse/setup_install.yml"
|
||||
when: matrix_synapse_enabled | bool
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/synapse/setup_uninstall.yml"
|
||||
when: "not matrix_synapse_enabled | bool"
|
150
roles/custom/matrix-synapse/tasks/synapse/setup_install.yml
Normal file
150
roles/custom/matrix-synapse/tasks/synapse/setup_install.yml
Normal file
@ -0,0 +1,150 @@
|
||||
---
|
||||
|
||||
# This will throw a Permission Denied error if already mounted using fuse
|
||||
- name: Check Synapse media store path
|
||||
ansible.builtin.stat:
|
||||
path: "{{ matrix_synapse_media_store_path }}"
|
||||
register: local_path_media_store_stat
|
||||
ignore_errors: true
|
||||
|
||||
# This is separate and conditional, to ensure we don't execute it
|
||||
# if the path already exists or we failed to check, because it's mounted using fuse.
|
||||
- name: Ensure Synapse media store path exists
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_synapse_media_store_path }}"
|
||||
state: directory
|
||||
mode: 0750
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
when: "not local_path_media_store_stat.failed and not local_path_media_store_stat.stat.exists"
|
||||
|
||||
- when: "matrix_synapse_container_image_self_build | bool"
|
||||
block:
|
||||
- name: Ensure Synapse repository is present on self-build
|
||||
ansible.builtin.git:
|
||||
repo: "{{ matrix_synapse_container_image_self_build_repo }}"
|
||||
dest: "{{ matrix_synapse_docker_src_files_path }}"
|
||||
version: "{{ matrix_synapse_docker_image.split(':')[1] }}"
|
||||
force: "yes"
|
||||
become: true
|
||||
become_user: "{{ matrix_user_username }}"
|
||||
register: matrix_synapse_git_pull_results
|
||||
|
||||
- name: Check if Synapse Docker image exists
|
||||
ansible.builtin.command: "{{ matrix_host_command_docker }} images --quiet --filter 'reference={{ matrix_synapse_docker_image }}'"
|
||||
register: matrix_synapse_docker_image_check_result
|
||||
changed_when: false
|
||||
|
||||
# Invoking the `docker build` command here, instead of calling the `docker_image` Ansible module,
|
||||
# because the latter does not support BuildKit.
|
||||
# See: https://github.com/ansible-collections/community.general/issues/514
|
||||
- name: Ensure Synapse Docker image is built
|
||||
ansible.builtin.shell:
|
||||
chdir: "{{ matrix_synapse_docker_src_files_path }}"
|
||||
cmd: |
|
||||
{{ matrix_host_command_docker }} build \
|
||||
-t "{{ matrix_synapse_docker_image }}" \
|
||||
-f docker/Dockerfile \
|
||||
.
|
||||
environment:
|
||||
DOCKER_BUILDKIT: 1
|
||||
when: "matrix_synapse_git_pull_results.changed | bool or matrix_synapse_docker_image_check_result.stdout == ''"
|
||||
|
||||
- name: Ensure Synapse Docker image is pulled
|
||||
community.docker.docker_image:
|
||||
name: "{{ matrix_synapse_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_synapse_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_synapse_docker_image_force_pull }}"
|
||||
when: "not matrix_synapse_container_image_self_build"
|
||||
register: result
|
||||
retries: "{{ matrix_container_retries_count }}"
|
||||
delay: "{{ matrix_container_retries_delay }}"
|
||||
until: result is not failed
|
||||
|
||||
- when: "matrix_synapse_container_image_customizations_enabled | bool"
|
||||
block:
|
||||
- name: Ensure customizations Dockerfile is created
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/synapse/customizations/Dockerfile.j2"
|
||||
dest: "{{ matrix_synapse_customized_docker_src_files_path }}/Dockerfile"
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
mode: 0640
|
||||
|
||||
- name: Ensure customized Docker image for Synapse is built
|
||||
community.docker.docker_image:
|
||||
name: "{{ matrix_synapse_docker_image_customized }}"
|
||||
source: build
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_synapse_customized_docker_src_files_path }}"
|
||||
pull: true
|
||||
|
||||
- name: Check if a Synapse signing key exists
|
||||
ansible.builtin.stat:
|
||||
path: "{{ matrix_synapse_config_dir_path }}/{{ matrix_server_fqn_matrix }}.signing.key"
|
||||
register: matrix_synapse_signing_key_stat
|
||||
|
||||
# We do this so that the signing key would get generated.
|
||||
#
|
||||
# This will also generate a default homeserver.yaml configuration file and a log configuration file.
|
||||
# We don't care about those configuration files, as we replace them with our own anyway (see below).
|
||||
#
|
||||
# We don't use the `docker_container` module, because using it with `cap_drop` requires
|
||||
# a very recent docker-py version, which is not available for a lot of people yet.
|
||||
- name: Generate initial Synapse config and signing key
|
||||
ansible.builtin.command: |
|
||||
docker run
|
||||
--rm
|
||||
--name=matrix-config
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }}
|
||||
--cap-drop=ALL
|
||||
--mount type=bind,src={{ matrix_synapse_config_dir_path }},dst=/data
|
||||
-e SYNAPSE_CONFIG_PATH=/data/homeserver.yaml
|
||||
-e SYNAPSE_SERVER_NAME={{ matrix_server_fqn_matrix }}
|
||||
-e SYNAPSE_REPORT_STATS=no
|
||||
{{ matrix_synapse_docker_image }}
|
||||
generate
|
||||
when: "not matrix_synapse_signing_key_stat.stat.exists"
|
||||
|
||||
- name: Ensure Synapse homeserver config installed
|
||||
ansible.builtin.copy:
|
||||
content: "{{ matrix_synapse_configuration | to_nice_yaml(indent=2, width=999999) }}"
|
||||
dest: "{{ matrix_synapse_config_dir_path }}/homeserver.yaml"
|
||||
mode: 0644
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
|
||||
- name: Ensure Synapse log config installed
|
||||
ansible.builtin.template:
|
||||
src: "{{ matrix_synapse_template_synapse_log }}"
|
||||
dest: "{{ matrix_synapse_config_dir_path }}/{{ matrix_server_fqn_matrix }}.log.config"
|
||||
mode: 0644
|
||||
|
||||
- name: Ensure matrix-synapse.service installed
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/synapse/systemd/matrix-synapse.service.j2"
|
||||
dest: "{{ matrix_systemd_path }}/matrix-synapse.service"
|
||||
mode: 0644
|
||||
register: matrix_synapse_systemd_service_result
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-synapse.service installation
|
||||
ansible.builtin.service:
|
||||
daemon_reload: true
|
||||
when: "matrix_synapse_systemd_service_result.changed"
|
||||
|
||||
- name: Ensure matrix-synapse-register-user script created
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/synapse/usr-local-bin/matrix-synapse-register-user.j2"
|
||||
dest: "{{ matrix_local_bin_path }}/matrix-synapse-register-user"
|
||||
mode: 0755
|
||||
|
||||
- name: Generate sample prometheus.yml for external scraping
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/synapse/prometheus/external_prometheus.yml.example.j2"
|
||||
dest: "{{ matrix_synapse_base_path }}/external_prometheus.yml.example"
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
mode: 0644
|
||||
when: matrix_synapse_metrics_proxying_enabled | bool
|
@ -0,0 +1,40 @@
|
||||
---
|
||||
|
||||
- name: Check existence of matrix-synapse service
|
||||
ansible.builtin.stat:
|
||||
path: "{{ matrix_systemd_path }}/matrix-synapse.service"
|
||||
register: matrix_synapse_service_stat
|
||||
|
||||
- name: Ensure matrix-synapse is stopped
|
||||
ansible.builtin.service:
|
||||
name: matrix-synapse
|
||||
state: stopped
|
||||
enabled: false
|
||||
daemon_reload: true
|
||||
register: stopping_result
|
||||
when: "matrix_synapse_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure matrix-synapse.service doesn't exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_systemd_path }}/matrix-synapse.service"
|
||||
state: absent
|
||||
when: "matrix_synapse_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-synapse.service removal
|
||||
ansible.builtin.service:
|
||||
daemon_reload: true
|
||||
when: "matrix_synapse_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure Synapse Docker image doesn't exist
|
||||
community.docker.docker_image:
|
||||
name: "{{ item }}"
|
||||
state: absent
|
||||
with_items:
|
||||
- "{{ matrix_synapse_docker_image_final }}"
|
||||
- "{{ matrix_synapse_docker_image }}"
|
||||
|
||||
- name: Ensure sample prometheus.yml for external scraping is deleted
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_synapse_base_path }}/external_prometheus.yml.example"
|
||||
state: absent
|
||||
when: "not matrix_synapse_metrics_proxying_enabled | bool"
|
152
roles/custom/matrix-synapse/tasks/synapse/workers/init.yml
Normal file
152
roles/custom/matrix-synapse/tasks/synapse/workers/init.yml
Normal file
@ -0,0 +1,152 @@
|
||||
---
|
||||
# Below is a huge hack for dynamically building a list of workers and finally assigning it to `matrix_synapse_workers_enabled_list`.
|
||||
#
|
||||
# set_fact within a loop does not work reliably in Ansible (it only executes on the first iteration for some reason),
|
||||
# so we're forced to do something much uglier.
|
||||
|
||||
- name: Build generic workers
|
||||
ansible.builtin.set_fact:
|
||||
worker:
|
||||
id: "generic-worker-{{ item }}"
|
||||
name: "matrix-synapse-worker-generic-{{ item }}"
|
||||
type: 'generic_worker'
|
||||
app: 'generic_worker'
|
||||
webserving: true
|
||||
port: "{{ matrix_synapse_workers_generic_workers_port_range_start + item }}"
|
||||
metrics_port: "{{ matrix_synapse_workers_generic_workers_metrics_range_start + item }}"
|
||||
register: "matrix_synapse_workers_list_results_generic_workers"
|
||||
loop: "{{ range(0, matrix_synapse_workers_generic_workers_count | int) | list }}"
|
||||
|
||||
- name: Build stream writer workers
|
||||
ansible.builtin.set_fact:
|
||||
worker:
|
||||
id: "stream-writer-{{ idx }}-{{ item.stream }}"
|
||||
# Names must not include understores. Certain stream writer streams (to_device, account_data, ..) do, so we fix them up.
|
||||
name: "matrix-synapse-worker-stream-writer-{{ idx }}-{{ item.stream | replace('_', '-') }}"
|
||||
type: 'stream_writer'
|
||||
app: "generic_worker"
|
||||
webserving: "{{ item.stream in matrix_synapse_workers_webserving_stream_writer_types }}"
|
||||
stream_writer_stream: "{{ item.stream }}"
|
||||
port: "{{ matrix_synapse_workers_stream_writer_workers_http_port_range_start + idx }}"
|
||||
replication_port: "{{ matrix_synapse_workers_stream_writer_workers_replication_port_range_start + idx }}"
|
||||
metrics_port: "{{ matrix_synapse_workers_stream_writer_workers_metrics_range_start + idx }}"
|
||||
register: "matrix_synapse_workers_list_results_stream_writer_workers"
|
||||
loop: "{{ matrix_synapse_workers_stream_writers }}"
|
||||
loop_control:
|
||||
index_var: idx
|
||||
|
||||
- name: Populate matrix_synapse_stream_writers from enabled stream writer workers list
|
||||
ansible.builtin.set_fact:
|
||||
matrix_synapse_stream_writers: "{{ matrix_synapse_stream_writers | combine({item.ansible_facts.worker.stream_writer_stream: [item.ansible_facts.worker.name]}, list_merge='append') }}"
|
||||
with_items: "{{ matrix_synapse_workers_list_results_stream_writer_workers.results }}"
|
||||
|
||||
- name: Build federation sender workers
|
||||
ansible.builtin.set_fact:
|
||||
worker:
|
||||
id: "federation-sender-{{ item }}"
|
||||
name: "matrix-synapse-worker-federation-sender-{{ item }}"
|
||||
type: 'federation_sender'
|
||||
app: 'federation_sender'
|
||||
webserving: false
|
||||
port: 0
|
||||
metrics_port: "{{ matrix_synapse_workers_federation_sender_workers_metrics_range_start + item }}"
|
||||
register: "matrix_synapse_workers_list_results_federation_sender_workers"
|
||||
loop: "{{ range(0, matrix_synapse_workers_federation_sender_workers_count | int) | list }}"
|
||||
|
||||
- name: Populate matrix_synapse_federation_sender_instances from enabled federation sender workers list
|
||||
ansible.builtin.set_fact:
|
||||
matrix_synapse_federation_sender_instances: "{{ matrix_synapse_federation_sender_instances + [item.ansible_facts.worker.name] }}"
|
||||
with_items: "{{ matrix_synapse_workers_list_results_federation_sender_workers.results }}"
|
||||
|
||||
# This type of worker can only have a count of 1, at most
|
||||
- name: Build pusher workers
|
||||
ansible.builtin.set_fact:
|
||||
worker:
|
||||
id: "pusher-{{ item }}"
|
||||
name: "matrix-synapse-worker-pusher-{{ item }}"
|
||||
type: 'pusher'
|
||||
app: 'pusher'
|
||||
webserving: false
|
||||
port: 0
|
||||
metrics_port: "{{ matrix_synapse_workers_pusher_workers_metrics_range_start + item }}"
|
||||
register: "matrix_synapse_workers_list_results_pusher_workers"
|
||||
loop: "{{ range(0, matrix_synapse_workers_pusher_workers_count | int) | list }}"
|
||||
|
||||
# This type of worker can only have a count of 1, at most
|
||||
- name: Build appservice workers
|
||||
ansible.builtin.set_fact:
|
||||
worker:
|
||||
id: "appservice-{{ item }}"
|
||||
name: "matrix-synapse-worker-appservice-{{ item }}"
|
||||
type: 'appservice'
|
||||
app: 'generic_worker'
|
||||
webserving: false
|
||||
port: 0
|
||||
metrics_port: "{{ matrix_synapse_workers_appservice_workers_metrics_range_start + item }}"
|
||||
register: "matrix_synapse_workers_list_results_appservice_workers"
|
||||
loop: "{{ range(0, matrix_synapse_workers_appservice_workers_count | int) | list }}"
|
||||
|
||||
# This type of worker can only have a count of 1, at most
|
||||
- name: Build user_dir workers
|
||||
ansible.builtin.set_fact:
|
||||
worker:
|
||||
id: "user-dir-{{ item }}"
|
||||
name: "matrix-synapse-worker-user-dir-{{ item }}"
|
||||
type: 'user_dir'
|
||||
app: 'generic_worker'
|
||||
webserving: true
|
||||
port: "{{ matrix_synapse_workers_user_dir_workers_port_range_start + item }}"
|
||||
metrics_port: "{{ matrix_synapse_workers_user_dir_workers_metrics_range_start + item }}"
|
||||
register: "matrix_synapse_workers_list_results_user_dir_workers"
|
||||
loop: "{{ range(0, matrix_synapse_workers_user_dir_workers_count | int) | list }}"
|
||||
|
||||
# This type of worker can only have a count of 1, at most
|
||||
- name: Build background workers
|
||||
ansible.builtin.set_fact:
|
||||
worker:
|
||||
id: "background-{{ item }}"
|
||||
name: "matrix-synapse-worker-background-{{ item }}"
|
||||
type: 'background'
|
||||
app: 'generic_worker'
|
||||
webserving: false
|
||||
port: 0
|
||||
metrics_port: "{{ matrix_synapse_workers_background_workers_metrics_range_start + item }}"
|
||||
register: "matrix_synapse_workers_list_results_background_workers"
|
||||
loop: "{{ range(0, matrix_synapse_workers_background_workers_count | int) | list }}"
|
||||
|
||||
- name: Build media_repository workers
|
||||
ansible.builtin.set_fact:
|
||||
worker:
|
||||
id: "media-repository-{{ item }}"
|
||||
name: "matrix-synapse-worker-media-repository-{{ item }}"
|
||||
type: 'media_repository'
|
||||
app: 'media_repository'
|
||||
webserving: true
|
||||
port: "{{ matrix_synapse_workers_media_repository_workers_port_range_start + item }}"
|
||||
metrics_port: "{{ matrix_synapse_workers_media_repository_workers_metrics_range_start + item }}"
|
||||
register: "matrix_synapse_workers_list_results_media_repository_workers"
|
||||
loop: "{{ range(0, matrix_synapse_workers_media_repository_workers_count | int) | list }}"
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_synapse_dynamic_workers_list: "{{ matrix_synapse_dynamic_workers_list | default([]) + [item.ansible_facts.worker] }}"
|
||||
with_items: |
|
||||
{{
|
||||
matrix_synapse_workers_list_results_generic_workers.results
|
||||
+
|
||||
matrix_synapse_workers_list_results_stream_writer_workers.results
|
||||
+
|
||||
matrix_synapse_workers_list_results_federation_sender_workers.results
|
||||
+
|
||||
matrix_synapse_workers_list_results_pusher_workers.results
|
||||
+
|
||||
matrix_synapse_workers_list_results_appservice_workers.results
|
||||
+
|
||||
matrix_synapse_workers_list_results_user_dir_workers.results
|
||||
+
|
||||
matrix_synapse_workers_list_results_media_repository_workers.results
|
||||
+
|
||||
matrix_synapse_workers_list_results_background_workers.results
|
||||
}}
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_synapse_workers_enabled_list: "{{ matrix_synapse_dynamic_workers_list }}"
|
21
roles/custom/matrix-synapse/tasks/synapse/workers/setup.yml
Normal file
21
roles/custom/matrix-synapse/tasks/synapse/workers/setup.yml
Normal file
@ -0,0 +1,21 @@
|
||||
---
|
||||
|
||||
# A previous version of the worker setup used this.
|
||||
# This is a temporary cleanup for people who ran that version.
|
||||
- name: Ensure old matrix-synapse.service.wants directory is gone
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_systemd_path }}/matrix-synapse.service.wants"
|
||||
state: absent
|
||||
|
||||
# Same. This was part of a previous version of the worker setup.
|
||||
# No longer necessary.
|
||||
- name: Ensure matrix-synapse-worker-write-pid script is removed
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_local_bin_path }}/matrix-synapse-worker-write-pid"
|
||||
state: absent
|
||||
|
||||
- ansible.builtin.include_tasks: "{{ role_path }}/tasks/synapse/workers/setup_install.yml"
|
||||
when: "matrix_synapse_enabled | bool and matrix_synapse_workers_enabled | bool"
|
||||
|
||||
- ansible.builtin.include_tasks: "{{ role_path }}/tasks/synapse/workers/setup_uninstall.yml"
|
||||
when: "not matrix_synapse_workers_enabled | bool"
|
@ -0,0 +1,42 @@
|
||||
---
|
||||
|
||||
- name: Determine current worker configs
|
||||
ansible.builtin.find:
|
||||
path: "{{ matrix_synapse_config_dir_path }}"
|
||||
patterns: "worker.*.yaml"
|
||||
use_regex: true
|
||||
register: matrix_synapse_workers_current_config_files
|
||||
|
||||
# This also deletes some things which we need. They will be recreated below.
|
||||
- name: Ensure previous worker configs are cleaned
|
||||
ansible.builtin.file:
|
||||
path: "{{ item.path }}"
|
||||
state: absent
|
||||
with_items: "{{ matrix_synapse_workers_current_config_files.files }}"
|
||||
|
||||
- name: Determine current worker systemd services
|
||||
ansible.builtin.find:
|
||||
path: "{{ matrix_systemd_path }}"
|
||||
patterns: "matrix-synapse-worker.*.service"
|
||||
use_regex: true
|
||||
register: matrix_synapse_workers_current_systemd_services
|
||||
|
||||
- name: Ensure unnecessary worker systemd services are stopped and disabled
|
||||
ansible.builtin.service:
|
||||
name: "{{ item.path | basename }}"
|
||||
state: stopped
|
||||
enabled: false
|
||||
with_items: "{{ matrix_synapse_workers_current_systemd_services.files }}"
|
||||
when: "not ansible_check_mode and item.path | basename not in matrix_systemd_services_list"
|
||||
|
||||
- name: Ensure unnecessary worker systemd services are cleaned
|
||||
ansible.builtin.file:
|
||||
path: "{{ item.path }}"
|
||||
state: absent
|
||||
with_items: "{{ matrix_synapse_workers_current_systemd_services.files }}"
|
||||
|
||||
- name: Ensure creation of worker systemd service files and configuration files
|
||||
ansible.builtin.include_tasks: "{{ role_path }}/tasks/synapse/workers/util/setup_files_for_worker.yml"
|
||||
with_items: "{{ matrix_synapse_workers_enabled_list }}"
|
||||
loop_control:
|
||||
loop_var: matrix_synapse_worker_details
|
@ -0,0 +1,37 @@
|
||||
---
|
||||
|
||||
- name: Populate service facts
|
||||
ansible.builtin.service_facts:
|
||||
|
||||
- name: Ensure any worker services are stopped
|
||||
ansible.builtin.service:
|
||||
name: "{{ item.key }}"
|
||||
state: stopped
|
||||
with_dict: "{{ ansible_facts.services | default({}) | dict2items | selectattr('key', 'match', 'matrix-synapse-worker-.+\\.service') | list | items2dict }}"
|
||||
when: "item.value['status'] != 'not-found'" # see https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1461
|
||||
|
||||
- name: Find worker configs to be cleaned
|
||||
ansible.builtin.find:
|
||||
path: "{{ matrix_synapse_config_dir_path }}"
|
||||
patterns: "worker.*.yaml"
|
||||
use_regex: true
|
||||
register: matrix_synapse_workers_current_config_files
|
||||
|
||||
- name: Ensure previous worker configs are cleaned
|
||||
ansible.builtin.file:
|
||||
path: "{{ item.path }}"
|
||||
state: absent
|
||||
with_items: "{{ matrix_synapse_workers_current_config_files.files }}"
|
||||
|
||||
- name: Find worker systemd services to be cleaned
|
||||
ansible.builtin.find:
|
||||
path: "{{ matrix_systemd_path }}"
|
||||
patterns: "matrix-synapse-worker.*.service"
|
||||
use_regex: true
|
||||
register: matrix_synapse_workers_current_systemd_services
|
||||
|
||||
- name: Ensure previous worker systemd services are cleaned
|
||||
ansible.builtin.file:
|
||||
path: "{{ item.path }}"
|
||||
state: absent
|
||||
with_items: "{{ matrix_synapse_workers_current_systemd_services.files }}"
|
@ -0,0 +1,65 @@
|
||||
---
|
||||
# The tasks below run before `validate_config.yml`.
|
||||
# To avoid failing with a cryptic error message, we'll do validation here.
|
||||
#
|
||||
# This check is mostly relevant to people who explicitly define `matrix_synapse_workers_enabled_list`
|
||||
# (Synapse Workers users from the earlier days of this PR - https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/456).
|
||||
#
|
||||
# In the future, it should be possible to remove this check.
|
||||
# Our own code which dynamically builds `matrix_synapse_workers_enabled_list` does things right.
|
||||
- name: Fail if required property not defined for worker
|
||||
ansible.builtin.fail:
|
||||
msg: "Synapse workers (like {{ matrix_synapse_worker_details | to_json }}) need to define a `{{ item }}` property"
|
||||
with_items:
|
||||
- id
|
||||
- name
|
||||
- type
|
||||
- app
|
||||
- port
|
||||
- webserving
|
||||
when: "item not in matrix_synapse_worker_details"
|
||||
|
||||
# Names are used for container names and systemd services.
|
||||
# Routing happens based on container names, so Synapse processes that try to route to workers with underscores in the name will complain. Example:
|
||||
# > InvalidCodepoint Codepoint U+005F at position 46 of 'matrix-synapse-worker-stream-writer-3-account_data' not allowed
|
||||
- name: Fail if worker name includes underscore
|
||||
ansible.builtin.fail:
|
||||
msg: "Unrecognized Synapse worker `name`: `{{ matrix_synapse_worker_details.name }}`. It must not include underscores"
|
||||
when: "'_' in matrix_synapse_worker_details.name"
|
||||
|
||||
- name: Fail if worker type unknown
|
||||
ansible.builtin.fail:
|
||||
msg: "Unrecognized Synapse worker `type`: `{{ matrix_synapse_worker_details.type }}`. Supported types are: {{ matrix_synapse_known_worker_types | join(', ') }}"
|
||||
when: "matrix_synapse_worker_details.type not in matrix_synapse_known_worker_types"
|
||||
|
||||
- name: Fail if worker app unknown
|
||||
ansible.builtin.fail:
|
||||
msg: "Unrecognized Synapse worker `app`: `{{ matrix_synapse_worker_details.app }}`. Supported types are: {{ matrix_synapse_workers_avail_list | join(', ') }}"
|
||||
when: "matrix_synapse_worker_details.app not in matrix_synapse_workers_avail_list"
|
||||
|
||||
- when: "matrix_synapse_worker_details.type == 'stream_writer'"
|
||||
block:
|
||||
- name: Fail if stream_writer_stream not defined for stream_writer worker
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
Synapse stream_writer workers (such as {{ item }}) need to define a valid `stream_writer_stream` property
|
||||
(not `{{ matrix_synapse_worker_details.stream_writer_stream | default('undefined') }}`).
|
||||
Supported types are: {{ matrix_synapse_workers_known_stream_writer_stream_types | join(', ') }}
|
||||
when: "'stream_writer_stream' not in matrix_synapse_worker_details or matrix_synapse_worker_details.stream_writer_stream not in matrix_synapse_workers_known_stream_writer_stream_types"
|
||||
|
||||
- name: Fail if replication_port not defined for stream_writer worker
|
||||
ansible.builtin.fail:
|
||||
msg: "Synapse background workers of type stream_writer (such as {{ item }}) need to define a valid `replication_port` property"
|
||||
when: "'replication_port' not in matrix_synapse_worker_details"
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + [matrix_synapse_worker_details.name + '.service'] }}"
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_synapse_webserving_workers_systemd_services_list: "{{ matrix_synapse_webserving_workers_systemd_services_list + [matrix_synapse_worker_details.name + '.service'] }}"
|
||||
when: matrix_synapse_worker_details.webserving | bool
|
||||
|
||||
# Inject stream writers into the instance map.
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_synapse_instance_map: "{{ matrix_synapse_instance_map | combine({matrix_synapse_worker_details.name: {'host': matrix_synapse_worker_details.name, 'port': matrix_synapse_worker_details.replication_port}}) }}"
|
||||
when: matrix_synapse_worker_details.type in matrix_synapse_known_instance_map_eligible_worker_types
|
@ -0,0 +1,20 @@
|
||||
---
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_synapse_worker_systemd_service_name: "{{ matrix_synapse_worker_details.name }}"
|
||||
matrix_synapse_worker_container_name: "{{ matrix_synapse_worker_details.name }}"
|
||||
matrix_synapse_worker_config_file_name: "worker.{{ matrix_synapse_worker_details.name }}.yaml"
|
||||
|
||||
- name: Ensure configuration exists for {{ matrix_synapse_worker_systemd_service_name }}
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/synapse/worker.yaml.j2"
|
||||
dest: "{{ matrix_synapse_config_dir_path }}/{{ matrix_synapse_worker_config_file_name }}"
|
||||
mode: 0644
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
|
||||
- name: Ensure systemd service exists for {{ matrix_synapse_worker_systemd_service_name }}
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/synapse/systemd/matrix-synapse-worker.service.j2"
|
||||
dest: "{{ matrix_systemd_path }}/{{ matrix_synapse_worker_systemd_service_name }}.service"
|
||||
mode: 0644
|
46
roles/custom/matrix-synapse/tasks/update_user_password.yml
Normal file
46
roles/custom/matrix-synapse/tasks/update_user_password.yml
Normal file
@ -0,0 +1,46 @@
|
||||
---
|
||||
|
||||
- name: Fail if playbook called incorrectly
|
||||
ansible.builtin.fail:
|
||||
msg: "The `username` variable needs to be provided to this playbook, via --extra-vars"
|
||||
when: "username is not defined or username == '<your-username>'"
|
||||
|
||||
- name: Fail if playbook called incorrectly
|
||||
ansible.builtin.fail:
|
||||
msg: "The `password` variable needs to be provided to this playbook, via --extra-vars"
|
||||
when: "password is not defined or password == '<your-password>'"
|
||||
|
||||
- name: Fail if not using matrix-postgres container
|
||||
ansible.builtin.fail:
|
||||
msg: "This command is working only when matrix-postgres container is being used"
|
||||
when: "not matrix_postgres_enabled | bool"
|
||||
|
||||
- name: Ensure matrix-synapse is started
|
||||
ansible.builtin.service:
|
||||
name: matrix-synapse
|
||||
state: started
|
||||
daemon_reload: true
|
||||
register: start_result
|
||||
|
||||
- name: Ensure matrix-postgres is started
|
||||
ansible.builtin.service:
|
||||
name: matrix-postgres
|
||||
state: started
|
||||
daemon_reload: true
|
||||
register: postgres_start_result
|
||||
|
||||
|
||||
- name: Wait a while, so that Matrix Synapse can manage to start
|
||||
ansible.builtin.pause:
|
||||
seconds: 7
|
||||
when: "start_result.changed or postgres_start_result.changed"
|
||||
|
||||
- name: Generate password hash
|
||||
ansible.builtin.shell: "{{ matrix_host_command_docker }} exec matrix-synapse /usr/local/bin/hash_password -c /data/homeserver.yaml -p {{ password | quote }}"
|
||||
register: password_hash
|
||||
changed_when: false
|
||||
|
||||
- name: Update user password hash
|
||||
ansible.builtin.command: "{{ matrix_local_bin_path }}/matrix-postgres-update-user-password-hash {{ username | quote }} {{ password_hash.stdout | quote }}"
|
||||
register: matrix_synapse_update_user_password_result
|
||||
changed_when: matrix_synapse_update_user_password_result.rc == 0
|
70
roles/custom/matrix-synapse/tasks/validate_config.yml
Normal file
70
roles/custom/matrix-synapse/tasks/validate_config.yml
Normal file
@ -0,0 +1,70 @@
|
||||
---
|
||||
|
||||
- name: Fail if required Synapse settings not defined
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
You need to define a required configuration setting (`{{ item }}`) for using Synapse.
|
||||
when: "vars[item] == ''"
|
||||
with_items:
|
||||
- "matrix_synapse_macaroon_secret_key"
|
||||
- "matrix_synapse_database_host"
|
||||
- "matrix_synapse_database_user"
|
||||
- "matrix_synapse_database_password"
|
||||
- "matrix_synapse_database_database"
|
||||
|
||||
- name: Fail if asking for more than 1 instance of single-instance workers
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
`{{ item }}` cannot be more than 1. This is a single-instance worker.
|
||||
when: "vars[item] | int > 1"
|
||||
with_items:
|
||||
- "matrix_synapse_workers_appservice_workers_count"
|
||||
- "matrix_synapse_workers_user_dir_workers_count"
|
||||
- "matrix_synapse_workers_background_workers_count"
|
||||
- "matrix_synapse_workers_stream_writer_typing_stream_workers_count"
|
||||
- "matrix_synapse_workers_stream_writer_to_device_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_presence_stream_workers_count"
|
||||
|
||||
- name: (Deprecation) Catch and report renamed settings
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
Your configuration contains a variable, which now has a different name.
|
||||
Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`).
|
||||
when: "item.old in vars"
|
||||
with_items:
|
||||
- {'old': 'matrix_synapse_email_riot_base_url', 'new': '<superseded by client_base_url>'}
|
||||
- {'old': 'matrix_synapse_container_expose_api_port', 'new': '<superseded by matrix_synapse_container_federation_api_plain_host_bind_port>'}
|
||||
- {'old': 'matrix_synapse_no_tls', 'new': '<removed>'}
|
||||
- {'old': 'matrix_enable_room_list_search', 'new': 'matrix_synapse_enable_room_list_search'}
|
||||
- {'old': 'matrix_alias_creation_rules', 'new': 'matrix_synapse_alias_creation_rules'}
|
||||
- {'old': 'matrix_room_list_publication_rules', 'new': 'matrix_synapse_room_list_publication_rules'}
|
||||
- {'old': 'matrix_synapse_rc_messages_per_second', 'new': '<per_second subkey of matrix_synapse_rc_message>'}
|
||||
- {'old': 'matrix_synapse_rc_message_burst_count', 'new': '<burst_count subkey of matrix_synapse_rc_message>'}
|
||||
- {'old': 'matrix_synapse_federation_rc_window_size', 'new': '<window_size subkey of matrix_synapse_rc_federation>'}
|
||||
- {'old': 'matrix_synapse_federation_rc_sleep_limit', 'new': '<sleep_limit subkey of matrix_synapse_rc_federation>'}
|
||||
- {'old': 'matrix_synapse_federation_rc_sleep_delay', 'new': '<sleep_delay subkey of matrix_synapse_rc_federation>'}
|
||||
- {'old': 'matrix_synapse_federation_rc_reject_limit', 'new': '<reject_limit subkey of matrix_synapse_rc_federation>'}
|
||||
- {'old': 'matrix_synapse_federation_rc_concurrent', 'new': '<concurrent subkey of matrix_synapse_rc_federation>'}
|
||||
- {'old': 'matrix_synapse_container_expose_client_api_port', 'new': '<superseded by matrix_synapse_container_client_api_host_bind_port>'}
|
||||
- {'old': 'matrix_synapse_container_expose_federation_api_port', 'new': '<superseded by matrix_synapse_container_federation_api_plain_host_bind_port>'}
|
||||
- {'old': 'matrix_synapse_container_expose_metrics_port', 'new': '<superseded by matrix_synapse_container_metrics_api_host_bind_port>'}
|
||||
- {'old': 'matrix_synapse_cache_factor', 'new': 'matrix_synapse_caches_global_factor'}
|
||||
- {'old': 'matrix_synapse_trusted_third_party_id_servers', 'new': '<deprecated in Synapse v0.99.4 and removed in Synapse v1.19.0>'}
|
||||
- {'old': 'matrix_synapse_use_presence', 'new': 'matrix_synapse_presence_enabled'}
|
||||
- {'old': 'matrix_synapse_version_arm64', 'new': '<superseded by matrix_synapse_version - see https://github.com/matrix-org/synapse/pull/11810>'}
|
||||
- {'old': 'matrix_synapse_enable_group_creation', 'new': '<removed in Synapse v1.61.0 - use the new Spaces feature instead>'}
|
||||
- {'old': 'matrix_synapse_account_threepid_delegates_email', 'new': '<removed in Synapse v1.66.0 - make sure to configure email settings for Synapse - see https://matrix-org.github.io/synapse/v1.66/upgrade.html#delegation-of-email-validation-no-longer-supported>'}
|
||||
- {'old': 'matrix_synapse_workers_frontend_proxy_workers_count', 'new': '<removed in favor of generic workers - see https://github.com/matrix-org/synapse/pull/13645>'}
|
||||
- {'old': 'matrix_synapse_workers_frontend_proxy_workers_port_range_start', 'new': '<removed in favor of generic workers - see https://github.com/matrix-org/synapse/pull/13645>'}
|
||||
- {'old': 'matrix_synapse_workers_frontend_proxy_workers_metrics_range_start', 'new': '<removed in favor of generic workers - see https://github.com/matrix-org/synapse/pull/13645>'}
|
||||
|
||||
- name: (Deprecation) Catch and report renamed settings in matrix_synapse_configuration_extension_yaml
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
Your matrix_synapse_configuration_extension_yaml configuration contains a variable, which now has a different name.
|
||||
Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`).
|
||||
when: "item.old in matrix_synapse_configuration_extension"
|
||||
with_items:
|
||||
- {'old': 'federation_ip_range_blacklist', 'new': 'ip_range_blacklist'}
|
@ -0,0 +1,3 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
AWS_ACCESS_KEY={{ matrix_s3_media_store_aws_access_key }}
|
||||
AWS_SECRET_KEY={{ matrix_s3_media_store_aws_secret_key }}
|
@ -0,0 +1,39 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
[Unit]
|
||||
Description=Matrix Goofys media store
|
||||
After=docker.service
|
||||
Requires=docker.service
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Environment="HOME={{ matrix_systemd_unit_home_path }}"
|
||||
ExecStartPre=-{{ matrix_host_command_docker }} kill %n
|
||||
ExecStartPre=-{{ matrix_host_command_docker }} rm %n
|
||||
|
||||
ExecStart={{ matrix_host_command_docker }} run --rm --name %n \
|
||||
--log-driver=none \
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
||||
--mount type=bind,src=/etc/passwd,dst=/etc/passwd,ro \
|
||||
--mount type=bind,src=/etc/group,dst=/etc/group,ro \
|
||||
--mount type=bind,src={{ matrix_s3_media_store_path }},dst=/s3,bind-propagation=shared \
|
||||
--security-opt apparmor:unconfined \
|
||||
--cap-add mknod \
|
||||
--cap-add sys_admin \
|
||||
--device=/dev/fuse \
|
||||
--env-file={{ matrix_synapse_config_dir_path }}/env-goofys \
|
||||
--entrypoint /bin/sh \
|
||||
{{ matrix_s3_goofys_docker_image }} \
|
||||
-c 'goofys -f{% if not matrix_s3_media_store_custom_endpoint_enabled %} --storage-class=STANDARD_IA{% endif %}{% if matrix_s3_media_store_custom_endpoint_enabled %} --endpoint={{ matrix_s3_media_store_custom_endpoint }}{% endif %} --region {{ matrix_s3_media_store_region }} --stat-cache-ttl 60m0s --type-cache-ttl 60m0s --dir-mode 0700 --file-mode 0700 {{ matrix_s3_media_store_bucket_name }} /s3'
|
||||
|
||||
TimeoutStartSec=5min
|
||||
ExecStop=-{{ matrix_host_command_docker }} stop %n
|
||||
ExecStop=-{{ matrix_host_command_docker }} kill %n
|
||||
ExecStop=-{{ matrix_host_command_docker }} rm %n
|
||||
ExecStop=-{{ matrix_host_command_fusermount }} -u {{ matrix_s3_media_store_path }}
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
SyslogIdentifier=matrix-goofys
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -0,0 +1,7 @@
|
||||
FROM {{ matrix_synapse_docker_image }}
|
||||
|
||||
{% if matrix_synapse_container_image_customizations_s3_storage_provider_installation_enabled %}
|
||||
RUN pip install synapse-s3-storage-provider=={{ matrix_synapse_ext_synapse_s3_storage_provider_version }}
|
||||
{% endif %}
|
||||
|
||||
{{ matrix_synapse_container_image_customizations_dockerfile_body_custom }}
|
@ -0,0 +1,5 @@
|
||||
user: {{ matrix_synapse_database_user | to_json }}
|
||||
password: {{ matrix_synapse_database_password | to_json }}
|
||||
database: {{ matrix_synapse_database_database | to_json }}
|
||||
host: {{ matrix_synapse_database_host | to_json }}
|
||||
port: {{ matrix_synapse_database_port | to_json }}
|
@ -0,0 +1,11 @@
|
||||
AWS_ACCESS_KEY_ID={{ matrix_synapse_ext_synapse_s3_storage_provider_config_access_key_id }}
|
||||
AWS_SECRET_ACCESS_KEY={{ matrix_synapse_ext_synapse_s3_storage_provider_config_secret_access_key }}
|
||||
AWS_DEFAULT_REGION={{ matrix_synapse_ext_synapse_s3_storage_provider_config_region_name }}
|
||||
|
||||
ENDPOINT={{ matrix_synapse_ext_synapse_s3_storage_provider_config_endpoint_url }}
|
||||
BUCKET={{ matrix_synapse_ext_synapse_s3_storage_provider_config_bucket }}
|
||||
STORAGE_CLASS={{ matrix_synapse_ext_synapse_s3_storage_provider_config_storage_class }}
|
||||
|
||||
MEDIA_PATH=/matrix-media-store-parent/{{ matrix_synapse_media_store_directory_name }}
|
||||
|
||||
UPDATE_DB_DURATION={{ matrix_synapse_ext_synapse_s3_storage_provider_update_db_day_count }}d
|
@ -0,0 +1,14 @@
|
||||
module: s3_storage_provider.S3StorageProviderBackend
|
||||
store_local: {{ matrix_synapse_ext_synapse_s3_storage_provider_store_local | to_json }}
|
||||
store_remote: {{ matrix_synapse_ext_synapse_s3_storage_provider_store_remote | to_json }}
|
||||
store_synchronous: {{ matrix_synapse_ext_synapse_s3_storage_provider_store_synchronous | to_json }}
|
||||
config:
|
||||
bucket: {{ matrix_synapse_ext_synapse_s3_storage_provider_config_bucket | to_json }}
|
||||
region_name: {{ matrix_synapse_ext_synapse_s3_storage_provider_config_region_name | to_json }}
|
||||
endpoint_url: {{ matrix_synapse_ext_synapse_s3_storage_provider_config_endpoint_url | to_json }}
|
||||
access_key_id: {{ matrix_synapse_ext_synapse_s3_storage_provider_config_access_key_id | to_json }}
|
||||
secret_access_key: {{ matrix_synapse_ext_synapse_s3_storage_provider_config_secret_access_key | to_json }}
|
||||
|
||||
storage_class: {{ matrix_synapse_ext_synapse_s3_storage_provider_config_storage_class | to_json }}
|
||||
|
||||
threadpool_size: {{ matrix_synapse_ext_synapse_s3_storage_provider_config_threadpool_size | to_json }}
|
@ -0,0 +1,7 @@
|
||||
[Unit]
|
||||
Description=Migrates locally-stored Synapse media store files to S3
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
Environment="HOME={{ matrix_systemd_unit_home_path }}"
|
||||
ExecStart={{ matrix_local_bin_path }}/matrix-synapse-s3-storage-provider-migrate
|
@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Migrates locally-stored Synapse media store files to S3
|
||||
|
||||
[Timer]
|
||||
Unit=matrix-synapse-s3-storage-provider-migrate.service
|
||||
OnCalendar=*-*-* 05:00:00
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
@ -0,0 +1,13 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
#!/bin/bash
|
||||
|
||||
{{ matrix_host_command_docker }} run \
|
||||
--rm \
|
||||
--env-file={{ matrix_synapse_ext_s3_storage_provider_path }}/env \
|
||||
--mount type=bind,src={{ matrix_synapse_storage_path }},dst=/matrix-media-store-parent,bind-propagation=slave \
|
||||
--mount type=bind,src={{ matrix_synapse_ext_s3_storage_provider_path }}/data,dst=/data \
|
||||
--workdir=/data \
|
||||
--network={{ matrix_docker_network }} \
|
||||
--entrypoint=/bin/bash \
|
||||
{{ matrix_synapse_docker_image_final }} \
|
||||
-c 's3_media_upload update-db $UPDATE_DB_DURATION && s3_media_upload --no-progress check-deleted $MEDIA_PATH && s3_media_upload --no-progress upload $MEDIA_PATH $BUCKET --delete --storage-class $STORAGE_CLASS --endpoint-url $ENDPOINT'
|
@ -0,0 +1,13 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
#!/bin/bash
|
||||
|
||||
{{ matrix_host_command_docker }} run \
|
||||
-it \
|
||||
--rm \
|
||||
--env-file={{ matrix_synapse_ext_s3_storage_provider_path }}/env \
|
||||
--mount type=bind,src={{ matrix_synapse_storage_path }},dst=/matrix-media-store-parent,bind-propagation=slave \
|
||||
--mount type=bind,src={{ matrix_synapse_ext_s3_storage_provider_path }}/data,dst=/data \
|
||||
--workdir=/data \
|
||||
--network={{ matrix_docker_network }} \
|
||||
--entrypoint=/bin/bash \
|
||||
{{ matrix_synapse_docker_image_final }}
|
2961
roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2
Normal file
2961
roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,41 @@
|
||||
global:
|
||||
scrape_interval: 5s
|
||||
|
||||
# Attach these labels to any time series or alerts when communicating with
|
||||
# external systems (federation, remote storage, Alertmanager).
|
||||
external_labels:
|
||||
monitor: 'synapse-{{ matrix_domain }}'
|
||||
|
||||
rule_files:
|
||||
- /etc/prometheus/synapse-v2.rules
|
||||
|
||||
scrape_configs:
|
||||
- job_name: 'synapse'
|
||||
metrics_path: /metrics/synapse/main-process
|
||||
scheme: {{ 'https' if matrix_nginx_proxy_https_enabled|default(true) else 'http' }}
|
||||
{% if matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_enabled|default(true) %}
|
||||
basic_auth:
|
||||
username: prometheus
|
||||
password_file: /path/to/your/passwordfile.pwd
|
||||
{% endif %}
|
||||
static_configs:
|
||||
- targets: ['{{ matrix_server_fqn_matrix }}:{{ matrix_nginx_proxy_container_https_host_bind_port|default(443) if matrix_nginx_proxy_https_enabled|default(true) else matrix_nginx_proxy_container_http_host_bind_port|default(80) }}']
|
||||
labels:
|
||||
job: "master"
|
||||
index: "0"
|
||||
{% for worker in matrix_synapse_workers_enabled_list %}
|
||||
- job_name: '{{ worker.name }}'
|
||||
metrics_path: /metrics/synapse/worker/{{ worker.id }}
|
||||
scheme: {{ 'https' if matrix_nginx_proxy_https_enabled|default(true) else 'http' }}
|
||||
{% if matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_enabled|default(true) %}
|
||||
basic_auth:
|
||||
username: prometheus
|
||||
password_file: /path/to/your/passwordfile.pwd
|
||||
{% endif %}
|
||||
static_configs:
|
||||
- targets: ['{{ matrix_server_fqn_matrix }}:{{ matrix_nginx_proxy_container_https_host_bind_port|default(443) if matrix_nginx_proxy_https_enabled|default(true) else matrix_nginx_proxy_container_http_host_bind_port|default(80) }}']
|
||||
labels:
|
||||
worker_id: {{ worker.id }}
|
||||
job: "{{ worker.type }}"
|
||||
app: {{ worker.app }}
|
||||
{% endfor %}
|
@ -0,0 +1,36 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
|
||||
version: 1
|
||||
|
||||
formatters:
|
||||
precise:
|
||||
format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s'
|
||||
|
||||
filters:
|
||||
context:
|
||||
(): synapse.util.logcontext.LoggingContextFilter
|
||||
request: ""
|
||||
|
||||
handlers:
|
||||
console:
|
||||
class: logging.StreamHandler
|
||||
formatter: precise
|
||||
filters: [context]
|
||||
|
||||
loggers:
|
||||
synapse:
|
||||
level: {{ matrix_synapse_log_level }}
|
||||
|
||||
synapse.storage.SQL:
|
||||
# beware: increasing this to DEBUG will make synapse log sensitive
|
||||
# information such as access tokens.
|
||||
level: {{ matrix_synapse_storage_sql_log_level }}
|
||||
|
||||
{% for logger in matrix_synapse_additional_loggers %}
|
||||
{{ logger.name }}:
|
||||
level: {{ logger.level }}
|
||||
{% endfor %}
|
||||
|
||||
root:
|
||||
level: {{ matrix_synapse_root_log_level }}
|
||||
handlers: [console]
|
@ -0,0 +1,62 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
[Unit]
|
||||
Description=Synapse worker ({{ matrix_synapse_worker_container_name }})
|
||||
AssertPathExists={{ matrix_synapse_config_dir_path }}/{{ matrix_synapse_worker_config_file_name }}
|
||||
After=matrix-synapse.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Environment="HOME={{ matrix_systemd_unit_home_path }}"
|
||||
|
||||
ExecStartPre=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} kill {{ matrix_synapse_worker_container_name }} 2>/dev/null || true'
|
||||
ExecStartPre=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm {{ matrix_synapse_worker_container_name }} 2>/dev/null || true'
|
||||
|
||||
# Intentional delay, so that the homeserver can manage to start.
|
||||
ExecStartPre={{ matrix_host_command_sleep }} 5
|
||||
|
||||
ExecStart={{ matrix_host_command_docker }} run --rm --name {{ matrix_synapse_worker_container_name }} \
|
||||
--log-driver=none \
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
||||
--cap-drop=ALL \
|
||||
--read-only \
|
||||
--tmpfs=/tmp:rw,noexec,nosuid,size={{ matrix_synapse_tmp_directory_size_mb }}m \
|
||||
--network={{ matrix_docker_network }} \
|
||||
{% if matrix_synapse_worker_details.port != 0 %}
|
||||
--health-cmd 'curl -fSs http://localhost:{{ matrix_synapse_worker_details.port }}/health || exit 1' \
|
||||
{% else %}
|
||||
--no-healthcheck \
|
||||
{% endif %}
|
||||
{% if matrix_synapse_workers_enabled and matrix_synapse_workers_container_host_bind_address %}
|
||||
{% if matrix_synapse_worker_details.port != 0 %}
|
||||
-p {{ '' if matrix_synapse_workers_container_host_bind_address == '*' else (matrix_synapse_workers_container_host_bind_address + ':') }}{{ matrix_synapse_worker_details.port }}:{{ matrix_synapse_worker_details.port }} \
|
||||
{% endif %}
|
||||
{% if matrix_synapse_worker_details.metrics_port != 0 %}
|
||||
-p {{ '' if matrix_synapse_workers_container_host_bind_address == '*' else (matrix_synapse_workers_container_host_bind_address + ':') }}{{ matrix_synapse_worker_details.metrics_port }}:{{ matrix_synapse_worker_details.metrics_port }} \
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
--mount type=bind,src={{ matrix_synapse_config_dir_path }},dst=/data,ro \
|
||||
--mount type=bind,src={{ matrix_synapse_storage_path }},dst=/matrix-media-store-parent,bind-propagation=slave \
|
||||
{% for volume in matrix_synapse_container_additional_volumes %}
|
||||
-v {{ volume.src }}:{{ volume.dst }}:{{ volume.options }} \
|
||||
{% endfor %}
|
||||
{% for arg in matrix_synapse_container_arguments %}
|
||||
{{ arg }} \
|
||||
{% endfor %}
|
||||
{{ matrix_synapse_docker_image_final }} \
|
||||
run -m synapse.app.{{ matrix_synapse_worker_details.app }} -c /data/homeserver.yaml -c /data/{{ matrix_synapse_worker_config_file_name }}
|
||||
|
||||
|
||||
ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} kill {{ matrix_synapse_worker_container_name }} 2>/dev/null || true'
|
||||
ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm {{ matrix_synapse_worker_container_name }} 2>/dev/null || true'
|
||||
|
||||
ExecReload={{ matrix_host_command_docker }} exec {{ matrix_synapse_worker_container_name }} /bin/sh -c 'kill -HUP 1'
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
SyslogIdentifier={{ matrix_synapse_worker_container_name }}
|
||||
|
||||
# Intentionally not making this WantedBy=matrix-synapse.service,
|
||||
# as matrix.synapse.service already has `Wants=` lines.
|
||||
# Also, WantedBy will trigger the creation of some `matrix-synapse.service.wants/` directory,
|
||||
# which we'd have to clean, etc. Better not.
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -0,0 +1,74 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
[Unit]
|
||||
Description=Synapse server
|
||||
{% for service in matrix_synapse_systemd_required_services_list %}
|
||||
Requires={{ service }}
|
||||
After={{ service }}
|
||||
|
||||
{% endfor %}
|
||||
{% for service in matrix_synapse_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
|
||||
{% if matrix_synapse_workers_enabled %}
|
||||
{% for matrix_synapse_worker_details in matrix_synapse_workers_enabled_list %}
|
||||
Wants={{ matrix_synapse_worker_details.name }}.service
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Environment="HOME={{ matrix_systemd_unit_home_path }}"
|
||||
ExecStartPre=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} kill matrix-synapse 2>/dev/null || true'
|
||||
ExecStartPre=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-synapse 2>/dev/null || true'
|
||||
{% if matrix_s3_media_store_enabled %}
|
||||
# Allow for some time before starting, so that media store can mount.
|
||||
# Mounting can happen later too, but if we start writing,
|
||||
# we'd write files to the local filesystem and fusermount will complain.
|
||||
ExecStartPre={{ matrix_host_command_sleep }} 3
|
||||
{% endif %}
|
||||
|
||||
ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-synapse \
|
||||
--log-driver=none \
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
||||
--cap-drop=ALL \
|
||||
--read-only \
|
||||
--tmpfs=/tmp:rw,noexec,nosuid,size={{ matrix_synapse_tmp_directory_size_mb }}m \
|
||||
--network={{ matrix_docker_network }} \
|
||||
{% if matrix_synapse_container_client_api_host_bind_port %}
|
||||
-p {{ matrix_synapse_container_client_api_host_bind_port }}:{{ matrix_synapse_container_client_api_port }} \
|
||||
{% endif %}
|
||||
{% if matrix_synapse_federation_enabled and matrix_synapse_tls_federation_listener_enabled and matrix_synapse_container_federation_api_tls_host_bind_port %}
|
||||
-p {{ matrix_synapse_container_federation_api_tls_host_bind_port }}:{{ matrix_synapse_container_federation_api_tls_port }} \
|
||||
{% endif %}
|
||||
{% if matrix_synapse_federation_enabled and matrix_synapse_federation_port_enabled and matrix_synapse_container_federation_api_plain_host_bind_port %}
|
||||
-p {{ matrix_synapse_container_federation_api_plain_host_bind_port }}:{{ matrix_synapse_container_federation_api_plain_port }} \
|
||||
{% endif %}
|
||||
{% if matrix_synapse_metrics_enabled and matrix_synapse_container_metrics_api_host_bind_port %}
|
||||
-p {{ matrix_synapse_container_metrics_api_host_bind_port }}:{{ matrix_synapse_metrics_port }} \
|
||||
{% endif %}
|
||||
{% if matrix_synapse_manhole_enabled and matrix_synapse_container_manhole_api_host_bind_port %}
|
||||
-p {{ matrix_synapse_container_manhole_api_host_bind_port }}:9000 \
|
||||
{% endif %}
|
||||
--mount type=bind,src={{ matrix_synapse_config_dir_path }},dst=/data,ro \
|
||||
--mount type=bind,src={{ matrix_synapse_storage_path }},dst=/matrix-media-store-parent,bind-propagation=slave \
|
||||
{% for volume in matrix_synapse_container_additional_volumes %}
|
||||
-v {{ volume.src }}:{{ volume.dst }}:{{ volume.options }} \
|
||||
{% endfor %}
|
||||
{% for arg in matrix_synapse_container_arguments %}
|
||||
{{ arg }} \
|
||||
{% endfor %}
|
||||
{{ matrix_synapse_docker_image_final }} \
|
||||
run -m synapse.app.homeserver -c /data/homeserver.yaml
|
||||
|
||||
ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} kill matrix-synapse 2>/dev/null || true'
|
||||
ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-synapse 2>/dev/null || true'
|
||||
ExecReload={{ matrix_host_command_docker }} exec matrix-synapse /bin/sh -c 'kill -HUP 1'
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
SyslogIdentifier=matrix-synapse
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -0,0 +1,17 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
#!/bin/bash
|
||||
|
||||
if [ $# -ne 3 ]; then
|
||||
echo "Usage: "$0" <username> <password> <admin access: 0 or 1>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
user=$1
|
||||
password=$2
|
||||
admin=$3
|
||||
|
||||
if [ "$admin" -eq "1" ]; then
|
||||
docker exec matrix-synapse register_new_matrix_user -u "$user" -p "$password" -c /data/homeserver.yaml --admin http://localhost:{{ matrix_synapse_container_client_api_port }}
|
||||
else
|
||||
docker exec matrix-synapse register_new_matrix_user -u "$user" -p "$password" -c /data/homeserver.yaml --no-admin http://localhost:{{ matrix_synapse_container_client_api_port }}
|
||||
fi
|
64
roles/custom/matrix-synapse/templates/synapse/worker.yaml.j2
Normal file
64
roles/custom/matrix-synapse/templates/synapse/worker.yaml.j2
Normal file
@ -0,0 +1,64 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
worker_app: synapse.app.{{ matrix_synapse_worker_details.app }}
|
||||
worker_name: {{ matrix_synapse_worker_details.name }}
|
||||
|
||||
worker_daemonize: false
|
||||
worker_log_config: /data/{{ matrix_server_fqn_matrix }}.log.config
|
||||
|
||||
{% if matrix_synapse_replication_listener_enabled %}
|
||||
worker_replication_host: matrix-synapse
|
||||
worker_replication_http_port: {{ matrix_synapse_replication_http_port }}
|
||||
{% endif %}
|
||||
|
||||
{% if matrix_synapse_worker_details.type == 'generic_worker' %}
|
||||
worker_main_http_uri: http://matrix-synapse:{{ matrix_synapse_container_client_api_port }}
|
||||
{% endif %}
|
||||
|
||||
{% set http_resources = [] %}
|
||||
|
||||
{% if matrix_synapse_worker_details.type == 'user_dir' %}
|
||||
{% set http_resources = http_resources + ['client'] %}
|
||||
{% endif %}
|
||||
{% if matrix_synapse_worker_details.type == 'generic_worker' %}
|
||||
{% set http_resources = http_resources + ['client', 'federation'] %}
|
||||
{% endif %}
|
||||
{#
|
||||
None of the background workers need to handle federation traffic.
|
||||
Only some of the stream writers need to handle client traffic.
|
||||
#}
|
||||
{% if matrix_synapse_worker_details.type == 'stream_writer' and matrix_synapse_worker_details.webserving %}
|
||||
{% set http_resources = http_resources + ['client'] %}
|
||||
{% endif %}
|
||||
{% if matrix_synapse_worker_details.type == 'media_repository' %}
|
||||
{% set http_resources = http_resources + ['media'] %}
|
||||
{% endif %}
|
||||
|
||||
{% set replication_http_resources = [] %}
|
||||
{% if matrix_synapse_worker_details.type == 'stream_writer' %}
|
||||
{# All background workers need to handle replication traffic. #}
|
||||
{% set replication_http_resources = replication_http_resources + ['replication'] %}
|
||||
{% endif %}
|
||||
|
||||
{% if http_resources|length > 0 or matrix_synapse_metrics_enabled or replication_http_resources|length > 0 %}
|
||||
worker_listeners:
|
||||
{% if http_resources|length > 0 %}
|
||||
- type: http
|
||||
bind_addresses: ['::']
|
||||
x_forwarded: true
|
||||
port: {{ matrix_synapse_worker_details.port }}
|
||||
resources:
|
||||
- names: {{ http_resources|to_json }}
|
||||
{% endif %}
|
||||
{% if matrix_synapse_metrics_enabled %}
|
||||
- type: metrics
|
||||
bind_addresses: ['0.0.0.0']
|
||||
port: {{ matrix_synapse_worker_details.metrics_port }}
|
||||
{% endif %}
|
||||
{% if replication_http_resources|length > 0 %}
|
||||
- type: http
|
||||
bind_addresses: ['::']
|
||||
port: {{ matrix_synapse_worker_details.replication_port }}
|
||||
resources:
|
||||
- names: {{ replication_http_resources|to_json }}
|
||||
{% endif %}
|
||||
{% endif %}
|
112
roles/custom/matrix-synapse/vars/main.yml
Normal file
112
roles/custom/matrix-synapse/vars/main.yml
Normal file
@ -0,0 +1,112 @@
|
||||
---
|
||||
|
||||
matrix_synapse_client_api_url_endpoint_public: "https://{{ matrix_server_fqn_matrix }}/_matrix/client/versions"
|
||||
matrix_synapse_federation_api_url_endpoint_public: "https://{{ matrix_server_fqn_matrix }}:{{ matrix_federation_public_port }}/_matrix/federation/v1/version"
|
||||
|
||||
# Tells whether this role had executed or not. Toggled to `true` during runtime.
|
||||
matrix_synapse_role_executed: false
|
||||
|
||||
matrix_synapse_media_store_directory_name: "{{ matrix_synapse_media_store_path | basename }}"
|
||||
|
||||
# A Synapse generic worker can handle both federation and client-server API endpoints.
|
||||
# We wish to split these, as we normally serve federation separately and don't want them mixed up.
|
||||
#
|
||||
# This is some ugly Ansible/Jinja2 hack (seen here: https://stackoverflow.com/a/47831492),
|
||||
# which takes a list of various strings and removes the ones NOT containing `/_matrix/client` anywhere in them.
|
||||
#
|
||||
# We intentionally don't do a diff between everything possible (`matrix_synapse_workers_generic_worker_endpoints`) and `matrix_synapse_workers_generic_worker_federation_endpoints`,
|
||||
# because `matrix_synapse_workers_generic_worker_endpoints` also contains things like `/_synapse/client/`, etc.
|
||||
# While /_synapse/client/ endpoints are somewhat client-server API-related, they're:
|
||||
# - neither part of the client-server API spec (and are thus, different)
|
||||
# - nor always OK to forward to a worker (we're supposed to obey `matrix_nginx_proxy_proxy_matrix_client_api_forwarded_location_synapse_client_api_enabled`)
|
||||
#
|
||||
# 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),
|
||||
# so it's not that important whether we forward them or not.
|
||||
#
|
||||
# Basically, we aim to cover most things. Skipping `/_synapse/client` or a few other minor things doesn't matter too much.
|
||||
matrix_synapse_workers_generic_worker_client_server_endpoints: "{{ matrix_synapse_workers_generic_worker_endpoints | default([]) | map('regex_search', '.*/_matrix/client.*') | list | difference([none]) }}"
|
||||
|
||||
# A Synapse generic worker can handle both federation and client-server API endpoints.
|
||||
# We wish to split these, as we normally serve federation separately and don't want them mixed up.
|
||||
#
|
||||
# This is some ugly Ansible/Jinja2 hack (seen here: https://stackoverflow.com/a/47831492),
|
||||
# which takes a list of various strings and removes the ones NOT containing `/_matrix/federation` or `/_matrix/key` anywhere in them.
|
||||
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]) }}"
|
||||
|
||||
# matrix_synapse_workers_generic_worker_federation_endpoints_regex contains the regex used in matrix_synapse_workers_generic_worker_federation_endpoints.
|
||||
# It's intentionally put in a separate variable, to avoid tripping ansible-lint's jinja[spacing] rule.
|
||||
matrix_synapse_workers_generic_worker_federation_endpoints_regex: '.*(/_matrix/federation|/_matrix/key).*'
|
||||
|
||||
# matrix_synapse_workers_stream_writer_typing_stream_worker_client_server_endpoints contains the endpoints serviced by the `typing` stream writer.
|
||||
# See: https://matrix-org.github.io/synapse/latest/workers.html#the-typing-stream
|
||||
matrix_synapse_workers_stream_writer_typing_stream_worker_client_server_endpoints:
|
||||
- ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/typing
|
||||
|
||||
# matrix_synapse_workers_stream_writer_to_device_stream_worker_client_server_endpoints contains the endpoints serviced by the `to_device` stream writer.
|
||||
# See: https://matrix-org.github.io/synapse/latest/workers.html#the-to_device-stream
|
||||
matrix_synapse_workers_stream_writer_to_device_stream_worker_client_server_endpoints:
|
||||
- ^/_matrix/client/(r0|v3|unstable)/sendToDevice/
|
||||
|
||||
# matrix_synapse_workers_stream_writer_account_data_stream_worker_client_server_endpoints contains the endpoints serviced by the `account_data` stream writer.
|
||||
# See: https://matrix-org.github.io/synapse/latest/workers.html#the-account_data-stream
|
||||
matrix_synapse_workers_stream_writer_account_data_stream_worker_client_server_endpoints:
|
||||
- ^/_matrix/client/(r0|v3|unstable)/.*/tags
|
||||
- ^/_matrix/client/(r0|v3|unstable)/.*/account_data
|
||||
|
||||
# matrix_synapse_workers_stream_writer_receipts_stream_worker_client_server_endpoints contains the endpoints serviced by the `recepts` stream writer.
|
||||
# See: https://matrix-org.github.io/synapse/latest/workers.html#the-receipts-stream
|
||||
matrix_synapse_workers_stream_writer_receipts_stream_worker_client_server_endpoints:
|
||||
- ^/_matrix/client/(r0|v3|unstable)/rooms/.*/receipt
|
||||
- ^/_matrix/client/(r0|v3|unstable)/rooms/.*/read_markers
|
||||
|
||||
# matrix_synapse_workers_stream_writer_presence_stream_worker_client_server_endpoints contains the endpoints serviced by the `presence` stream writer.
|
||||
# See: https://matrix-org.github.io/synapse/latest/workers.html#the-presence-stream
|
||||
matrix_synapse_workers_stream_writer_presence_stream_worker_client_server_endpoints:
|
||||
- ^/_matrix/client/(api/v1|r0|v3|unstable)/presence/
|
||||
|
||||
# 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
|
||||
matrix_synapse_workers_user_dir_worker_client_server_endpoints:
|
||||
- ^/_matrix/client/(r0|v3|unstable)/user_directory/search$
|
||||
|
||||
# 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,
|
||||
# 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_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.
|
||||
matrix_synapse_workers_webserving_stream_writer_types: ['typing', 'to_device', 'account_data', 'receipts', 'presence']
|
||||
|
||||
# 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.
|
||||
# Not all workers serve web requests. Those that don't won't be injected here.
|
||||
matrix_synapse_webserving_workers_systemd_services_list: []
|
||||
|
||||
# matrix_synapse_known_worker_types contains the list of known worker types.
|
||||
#
|
||||
# A worker type is different than a worker app (e.g. `generic_worker`).
|
||||
# For example, the `stream_writer` worker type is served by the `generic_worker` app, but is a separate type that we recognize.
|
||||
#
|
||||
# Some other types (`appservice` and `user_dir`) used to be Synapse worker apps, which got subsequently deprecated.
|
||||
# We still allow these types of workers and map them to the `generic_worker` app,
|
||||
# which is why we make sure they're part of the list below.
|
||||
# We use the `unique` filter because they're part of `matrix_synapse_workers_avail_list` too (for now; scheduled for removal).
|
||||
matrix_synapse_known_worker_types: |
|
||||
{{
|
||||
(
|
||||
matrix_synapse_workers_avail_list
|
||||
+
|
||||
['stream_writer']
|
||||
+
|
||||
['appservice']
|
||||
+
|
||||
['user_dir']
|
||||
+
|
||||
['background']
|
||||
) | unique
|
||||
}}
|
||||
|
||||
# matrix_synapse_known_instance_map_eligible_worker_types contains the list of worker types that are to be injected into `matrix_synapse_instance_map`.
|
||||
matrix_synapse_known_instance_map_eligible_worker_types:
|
||||
- stream_writer
|
456
roles/custom/matrix-synapse/vars/workers.yml
Normal file
456
roles/custom/matrix-synapse/vars/workers.yml
Normal file
@ -0,0 +1,456 @@
|
||||
---
|
||||
|
||||
matrix_synapse_workers_generic_worker_endpoints:
|
||||
# This worker can handle API requests matching the following regular expressions.
|
||||
# These endpoints can be routed to any worker. If a worker is set up to handle a
|
||||
# stream then, for maximum efficiency, additional endpoints should be routed to that
|
||||
# worker: refer to the [stream writers](#stream-writers) section below for further
|
||||
# information.
|
||||
|
||||
# Sync requests
|
||||
- ^/_matrix/client/(r0|v3)/sync$
|
||||
- ^/_matrix/client/(api/v1|r0|v3)/events$
|
||||
- ^/_matrix/client/(api/v1|r0|v3)/initialSync$
|
||||
- ^/_matrix/client/(api/v1|r0|v3)/rooms/[^/]+/initialSync$
|
||||
|
||||
# Federation requests
|
||||
- ^/_matrix/federation/v1/event/
|
||||
- ^/_matrix/federation/v1/state/
|
||||
- ^/_matrix/federation/v1/state_ids/
|
||||
- ^/_matrix/federation/v1/backfill/
|
||||
- ^/_matrix/federation/v1/get_missing_events/
|
||||
- ^/_matrix/federation/v1/publicRooms
|
||||
- ^/_matrix/federation/v1/query/
|
||||
- ^/_matrix/federation/v1/make_join/
|
||||
- ^/_matrix/federation/v1/make_leave/
|
||||
- ^/_matrix/federation/(v1|v2)/send_join/
|
||||
- ^/_matrix/federation/(v1|v2)/send_leave/
|
||||
- ^/_matrix/federation/(v1|v2)/invite/
|
||||
- ^/_matrix/federation/v1/event_auth/
|
||||
- ^/_matrix/federation/v1/exchange_third_party_invite/
|
||||
- ^/_matrix/federation/v1/user/devices/
|
||||
- ^/_matrix/key/v2/query
|
||||
- ^/_matrix/federation/v1/hierarchy/
|
||||
|
||||
# Inbound federation transaction request
|
||||
- ^/_matrix/federation/v1/send/
|
||||
|
||||
# Client API requests
|
||||
- ^/_matrix/client/(api/v1|r0|v3|unstable)/createRoom$
|
||||
- ^/_matrix/client/(api/v1|r0|v3|unstable)/publicRooms$
|
||||
- ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/joined_members$
|
||||
- ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/context/.*$
|
||||
- ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/members$
|
||||
- ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/state$
|
||||
- ^/_matrix/client/v1/rooms/.*/hierarchy$
|
||||
- ^/_matrix/client/(v1|unstable)/rooms/.*/relations/
|
||||
- ^/_matrix/client/v1/rooms/.*/threads$
|
||||
- ^/_matrix/client/unstable/org.matrix.msc2716/rooms/.*/batch_send$
|
||||
- ^/_matrix/client/unstable/im.nheko.summary/rooms/.*/summary$
|
||||
- ^/_matrix/client/(r0|v3|unstable)/account/3pid$
|
||||
- ^/_matrix/client/(r0|v3|unstable)/account/whoami$
|
||||
- ^/_matrix/client/(r0|v3|unstable)/devices$
|
||||
- ^/_matrix/client/versions$
|
||||
- ^/_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)/joined_rooms$
|
||||
- ^/_matrix/client/(api/v1|r0|v3|unstable)/search$
|
||||
|
||||
# Encryption requests
|
||||
# Note that ^/_matrix/client/(r0|v3|unstable)/keys/upload/ requires `worker_main_http_uri`
|
||||
- ^/_matrix/client/(r0|v3|unstable)/keys/query$
|
||||
- ^/_matrix/client/(r0|v3|unstable)/keys/changes$
|
||||
- ^/_matrix/client/(r0|v3|unstable)/keys/claim$
|
||||
- ^/_matrix/client/(r0|v3|unstable)/room_keys/
|
||||
- ^/_matrix/client/(r0|v3|unstable)/keys/upload/
|
||||
|
||||
# Registration/login requests
|
||||
- ^/_matrix/client/(api/v1|r0|v3|unstable)/login$
|
||||
- ^/_matrix/client/(r0|v3|unstable)/register$
|
||||
- ^/_matrix/client/v1/register/m.login.registration_token/validity$
|
||||
|
||||
# Event sending requests
|
||||
- ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/redact
|
||||
- ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/send
|
||||
- ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/state/
|
||||
- ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/(join|invite|leave|ban|unban|kick)$
|
||||
- ^/_matrix/client/(api/v1|r0|v3|unstable)/join/
|
||||
- ^/_matrix/client/(api/v1|r0|v3|unstable)/profile/
|
||||
|
||||
# These appear to be conditional and should not be enabled by default.
|
||||
# We need to fix up our workers-doc-to-yaml.awk parsing script to exclude them.
|
||||
# For now, they've been commented out manually.
|
||||
# # Account data requests
|
||||
# - ^/_matrix/client/(r0|v3|unstable)/.*/tags
|
||||
# - ^/_matrix/client/(r0|v3|unstable)/.*/account_data
|
||||
#
|
||||
# # Receipts requests
|
||||
# - ^/_matrix/client/(r0|v3|unstable)/rooms/.*/receipt
|
||||
# - ^/_matrix/client/(r0|v3|unstable)/rooms/.*/read_markers
|
||||
#
|
||||
# # Presence requests
|
||||
# - ^/_matrix/client/(api/v1|r0|v3|unstable)/presence/
|
||||
|
||||
# User directory search requests
|
||||
# Any worker can handle these, but we have a dedicated user_dir worker for this,
|
||||
# so we'd like for other generic workers to not try and capture these requests.
|
||||
# - ^/_matrix/client/(r0|v3|unstable)/user_directory/search$
|
||||
|
||||
# Additionally, the following REST endpoints can be handled for GET requests:
|
||||
|
||||
# FIXME: ADDITIONAL CONDITIONS REQUIRED: to be enabled manually
|
||||
# ^/_matrix/client/(api/v1|r0|v3|unstable)/pushrules/
|
||||
|
||||
# Pagination requests can also be handled, but all requests for a given
|
||||
# room must be routed to the same instance. Additionally, care must be taken to
|
||||
# ensure that the purge history admin API is not used while pagination requests
|
||||
# for the room are in flight:
|
||||
|
||||
# FIXME: ADDITIONAL CONDITIONS REQUIRED: to be enabled manually
|
||||
# ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/messages$
|
||||
|
||||
# Additionally, the following endpoints should be included if Synapse is configured
|
||||
# to use SSO (you only need to include the ones for whichever SSO provider you're
|
||||
# using):
|
||||
|
||||
# for all SSO providers
|
||||
# FIXME: ADDITIONAL CONDITIONS REQUIRED: to be enabled manually
|
||||
# ^/_matrix/client/(api/v1|r0|v3|unstable)/login/sso/redirect
|
||||
# ^/_synapse/client/pick_idp$
|
||||
# ^/_synapse/client/pick_username
|
||||
# ^/_synapse/client/new_user_consent$
|
||||
# ^/_synapse/client/sso_register$
|
||||
|
||||
# OpenID Connect requests.
|
||||
# FIXME: ADDITIONAL CONDITIONS REQUIRED: to be enabled manually
|
||||
# ^/_synapse/client/oidc/callback$
|
||||
|
||||
# SAML requests.
|
||||
# FIXME: ADDITIONAL CONDITIONS REQUIRED: to be enabled manually
|
||||
# ^/_synapse/client/saml2/authn_response$
|
||||
|
||||
# CAS requests.
|
||||
# FIXME: ADDITIONAL CONDITIONS REQUIRED: to be enabled manually
|
||||
# ^/_matrix/client/(api/v1|r0|v3|unstable)/login/cas/ticket$
|
||||
|
||||
# Ensure that all SSO logins go to a single process.
|
||||
# For multiple workers not handling the SSO endpoints properly, see
|
||||
# [#7530](https://github.com/matrix-org/synapse/issues/7530) and
|
||||
# [#9427](https://github.com/matrix-org/synapse/issues/9427).
|
||||
|
||||
# Note that a [HTTP listener](usage/configuration/config_documentation.md#listeners)
|
||||
# with `client` and `federation` `resources` must be configured in the `worker_listeners`
|
||||
# option in the worker config.
|
||||
|
||||
# #### Load balancing
|
||||
|
||||
# It is possible to run multiple instances of this worker app, with incoming requests
|
||||
# being load-balanced between them by the reverse-proxy. However, different endpoints
|
||||
# have different characteristics and so admins
|
||||
# may wish to run multiple groups of workers handling different endpoints so that
|
||||
# load balancing can be done in different ways.
|
||||
|
||||
# For `/sync` and `/initialSync` requests it will be more efficient if all
|
||||
# requests from a particular user are routed to a single instance. Extracting a
|
||||
# user ID from the access token or `Authorization` header is currently left as an
|
||||
# exercise for the reader. Admins may additionally wish to separate out `/sync`
|
||||
# requests that have a `since` query parameter from those that don't (and
|
||||
# `/initialSync`), as requests that don't are known as "initial sync" that happens
|
||||
# when a user logs in on a new device and can be *very* resource intensive, so
|
||||
# isolating these requests will stop them from interfering with other users ongoing
|
||||
# syncs.
|
||||
|
||||
# Federation and client requests can be balanced via simple round robin.
|
||||
|
||||
# The inbound federation transaction request `^/_matrix/federation/v1/send/`
|
||||
# should be balanced by source IP so that transactions from the same remote server
|
||||
# go to the same process.
|
||||
|
||||
# Registration/login requests can be handled separately purely to help ensure that
|
||||
# unexpected load doesn't affect new logins and sign ups.
|
||||
|
||||
# Finally, event sending requests can be balanced by the room ID in the URI (or
|
||||
# the full URI, or even just round robin), the room ID is the path component after
|
||||
# `/rooms/`. If there is a large bridge connected that is sending or may send lots
|
||||
# of events, then a dedicated set of workers can be provisioned to limit the
|
||||
# effects of bursts of events from that bridge on events sent by normal users.
|
||||
|
||||
# #### Stream writers
|
||||
|
||||
# Additionally, the writing of specific streams (such as events) can be moved off
|
||||
# of the main process to a particular worker.
|
||||
|
||||
# To enable this, the worker must have a
|
||||
# [HTTP `replication` listener](usage/configuration/config_documentation.md#listeners) configured,
|
||||
# have a `worker_name` and be listed in the `instance_map` config. The same worker
|
||||
# can handle multiple streams, but unless otherwise documented, each stream can only
|
||||
# have a single writer.
|
||||
|
||||
# For example, to move event persistence off to a dedicated worker, the shared
|
||||
# configuration would include:
|
||||
|
||||
# ```yaml
|
||||
# instance_map:
|
||||
# event_persister1:
|
||||
# host: localhost
|
||||
# port: 8034
|
||||
|
||||
# stream_writers:
|
||||
# events: event_persister1
|
||||
# ```
|
||||
|
||||
# An example for a stream writer instance:
|
||||
|
||||
# ```yaml
|
||||
# {{#include systemd-with-workers/workers/event_persister.yaml}}
|
||||
# ```
|
||||
|
||||
# Some of the streams have associated endpoints which, for maximum efficiency, should
|
||||
# be routed to the workers handling that stream. See below for the currently supported
|
||||
# streams and the endpoints associated with them:
|
||||
|
||||
# ##### The `events` stream
|
||||
|
||||
# The `events` stream experimentally supports having multiple writers, where work
|
||||
# is sharded between them by room ID. Note that you *must* restart all worker
|
||||
# instances when adding or removing event persisters. An example `stream_writers`
|
||||
# configuration with multiple writers:
|
||||
|
||||
# ```yaml
|
||||
# stream_writers:
|
||||
# events:
|
||||
# - event_persister1
|
||||
# - event_persister2
|
||||
# ```
|
||||
|
||||
# ##### The `typing` stream
|
||||
|
||||
# The following endpoints should be routed directly to the worker configured as
|
||||
# the stream writer for the `typing` stream:
|
||||
|
||||
# FIXME: ADDITIONAL CONDITIONS REQUIRED: to be enabled manually
|
||||
# ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/typing
|
||||
|
||||
# ##### The `to_device` stream
|
||||
|
||||
# The following endpoints should be routed directly to the worker configured as
|
||||
# the stream writer for the `to_device` stream:
|
||||
|
||||
# FIXME: ADDITIONAL CONDITIONS REQUIRED: to be enabled manually
|
||||
# ^/_matrix/client/(r0|v3|unstable)/sendToDevice/
|
||||
|
||||
# ##### The `account_data` stream
|
||||
|
||||
# The following endpoints should be routed directly to the worker configured as
|
||||
# the stream writer for the `account_data` stream:
|
||||
|
||||
# FIXME: ADDITIONAL CONDITIONS REQUIRED: to be enabled manually
|
||||
# ^/_matrix/client/(r0|v3|unstable)/.*/tags
|
||||
# ^/_matrix/client/(r0|v3|unstable)/.*/account_data
|
||||
|
||||
# ##### The `receipts` stream
|
||||
|
||||
# The following endpoints should be routed directly to the worker configured as
|
||||
# the stream writer for the `receipts` stream:
|
||||
|
||||
# FIXME: ADDITIONAL CONDITIONS REQUIRED: to be enabled manually
|
||||
# ^/_matrix/client/(r0|v3|unstable)/rooms/.*/receipt
|
||||
# ^/_matrix/client/(r0|v3|unstable)/rooms/.*/read_markers
|
||||
|
||||
# ##### The `presence` stream
|
||||
|
||||
# The following endpoints should be routed directly to the worker configured as
|
||||
# the stream writer for the `presence` stream:
|
||||
|
||||
# FIXME: ADDITIONAL CONDITIONS REQUIRED: to be enabled manually
|
||||
# ^/_matrix/client/(api/v1|r0|v3|unstable)/presence/
|
||||
|
||||
# #### Background tasks
|
||||
|
||||
# There is also support for moving background tasks to a separate
|
||||
# worker. Background tasks are run periodically or started via replication. Exactly
|
||||
# which tasks are configured to run depends on your Synapse configuration (e.g. if
|
||||
# stats is enabled). This worker doesn't handle any REST endpoints itself.
|
||||
|
||||
# To enable this, the worker must have a `worker_name` and can be configured to run
|
||||
# background tasks. For example, to move background tasks to a dedicated worker,
|
||||
# the shared configuration would include:
|
||||
|
||||
# ```yaml
|
||||
# run_background_tasks_on: background_worker
|
||||
# ```
|
||||
|
||||
# You might also wish to investigate the `update_user_directory_from_worker` and
|
||||
# `media_instance_running_background_jobs` settings.
|
||||
|
||||
# An example for a dedicated background worker instance:
|
||||
|
||||
# ```yaml
|
||||
# {{#include systemd-with-workers/workers/background_worker.yaml}}
|
||||
# ```
|
||||
|
||||
# #### Updating the User Directory
|
||||
|
||||
# You can designate one generic worker to update the user directory.
|
||||
|
||||
# Specify its name in the shared configuration as follows:
|
||||
|
||||
# ```yaml
|
||||
# update_user_directory_from_worker: worker_name
|
||||
# ```
|
||||
|
||||
# This work cannot be load-balanced; please ensure the main process is restarted
|
||||
# after setting this option in the shared configuration!
|
||||
|
||||
# User directory updates allow REST endpoints matching the following regular
|
||||
# expressions to work:
|
||||
|
||||
# FIXME: ADDITIONAL CONDITIONS REQUIRED: to be enabled manually
|
||||
# ^/_matrix/client/(r0|v3|unstable)/user_directory/search$
|
||||
|
||||
# The above endpoints can be routed to any worker, though you may choose to route
|
||||
# it to the chosen user directory worker.
|
||||
|
||||
# This style of configuration supersedes the legacy `synapse.app.user_dir`
|
||||
# worker application type.
|
||||
|
||||
|
||||
# #### Notifying Application Services
|
||||
|
||||
# You can designate one generic worker to send output traffic to Application Services.
|
||||
# Doesn't handle any REST endpoints itself, but you should specify its name in the
|
||||
# shared configuration as follows:
|
||||
|
||||
# ```yaml
|
||||
# notify_appservices_from_worker: worker_name
|
||||
# ```
|
||||
|
||||
# This work cannot be load-balanced; please ensure the main process is restarted
|
||||
# after setting this option in the shared configuration!
|
||||
|
||||
# This style of configuration supersedes the legacy `synapse.app.appservice`
|
||||
# worker application type.
|
||||
|
||||
|
||||
# pusher worker (no API endpoints) [
|
||||
# Handles sending push notifications to sygnal and email. Doesn't handle any
|
||||
# REST endpoints itself, but you should set `start_pushers: False` in the
|
||||
# shared configuration file to stop the main synapse sending push notifications.
|
||||
|
||||
# To run multiple instances at once the `pusher_instances` option should list all
|
||||
# pusher instances by their worker name, e.g.:
|
||||
|
||||
# ```yaml
|
||||
# pusher_instances:
|
||||
# - pusher_worker1
|
||||
# - pusher_worker2
|
||||
# ```
|
||||
|
||||
# An example for a pusher instance:
|
||||
|
||||
# ```yaml
|
||||
# {{#include systemd-with-workers/workers/pusher_worker.yaml}}
|
||||
# ```
|
||||
|
||||
# ]
|
||||
|
||||
# appservice worker (no API endpoints) [
|
||||
# **Deprecated as of Synapse v1.59.** [Use `synapse.app.generic_worker` with the
|
||||
# `notify_appservices_from_worker` option instead.](#notifying-application-services)
|
||||
|
||||
# Handles sending output traffic to Application Services. Doesn't handle any
|
||||
# REST endpoints itself, but you should set `notify_appservices: False` in the
|
||||
# shared configuration file to stop the main synapse sending appservice notifications.
|
||||
|
||||
# Note this worker cannot be load-balanced: only one instance should be active.
|
||||
|
||||
# ]
|
||||
|
||||
# federation_sender worker (no API endpoints) [
|
||||
# Handles sending federation traffic to other servers. Doesn't handle any
|
||||
# REST endpoints itself, but you should set `send_federation: False` in the
|
||||
# shared configuration file to stop the main synapse sending this traffic.
|
||||
|
||||
# If running multiple federation senders then you must list each
|
||||
# instance in the `federation_sender_instances` option by their `worker_name`.
|
||||
# All instances must be stopped and started when adding or removing instances.
|
||||
# For example:
|
||||
|
||||
# ```yaml
|
||||
# federation_sender_instances:
|
||||
# - federation_sender1
|
||||
# - federation_sender2
|
||||
# ```
|
||||
|
||||
# An example for a federation sender instance:
|
||||
|
||||
# ```yaml
|
||||
# {{#include systemd-with-workers/workers/federation_sender.yaml}}
|
||||
# ```
|
||||
# ]
|
||||
|
||||
matrix_synapse_workers_media_repository_endpoints:
|
||||
# Handles the media repository. It can handle all endpoints starting with:
|
||||
|
||||
- ^/_matrix/media/
|
||||
|
||||
# ... and the following regular expressions matching media-specific administration APIs:
|
||||
|
||||
- ^/_synapse/admin/v1/purge_media_cache$
|
||||
- ^/_synapse/admin/v1/room/.*/media.*$
|
||||
- ^/_synapse/admin/v1/user/.*/media.*$
|
||||
- ^/_synapse/admin/v1/media/.*$
|
||||
- ^/_synapse/admin/v1/quarantine_media/.*$
|
||||
- ^/_synapse/admin/v1/users/.*/media$
|
||||
|
||||
# You should also set `enable_media_repo: False` in the shared configuration
|
||||
# file to stop the main synapse running background jobs related to managing the
|
||||
# media repository. Note that doing so will prevent the main process from being
|
||||
# able to handle the above endpoints.
|
||||
|
||||
# In the `media_repository` worker configuration file, configure the
|
||||
# [HTTP listener](usage/configuration/config_documentation.md#listeners) to
|
||||
# expose the `media` resource. For example:
|
||||
|
||||
# ```yaml
|
||||
# {{#include systemd-with-workers/workers/media_worker.yaml}}
|
||||
# ```
|
||||
|
||||
# Note that if running multiple media repositories they must be on the same server
|
||||
# and you must configure a single instance to run the background tasks, e.g.:
|
||||
|
||||
# ```yaml
|
||||
# media_instance_running_background_jobs: "media-repository-1"
|
||||
# ```
|
||||
|
||||
# Note that if a reverse proxy is used , then `/_matrix/media/` must be routed for both inbound client and federation requests (if they are handled separately).
|
||||
|
||||
matrix_synapse_workers_user_dir_endpoints:
|
||||
# **Deprecated as of Synapse v1.59.** [Use `synapse.app.generic_worker` with the
|
||||
# `update_user_directory_from_worker` option instead.](#updating-the-user-directory)
|
||||
|
||||
# Handles searches in the user directory. It can handle REST endpoints matching
|
||||
# the following regular expressions:
|
||||
|
||||
- ^/_matrix/client/(r0|v3|unstable)/user_directory/search$
|
||||
|
||||
# When using this worker you must also set `update_user_directory: false` in the
|
||||
# shared configuration file to stop the main synapse running background
|
||||
# jobs related to updating the user directory.
|
||||
|
||||
# Above endpoint is not *required* to be routed to this worker. By default,
|
||||
# `update_user_directory` is set to `true`, which means the main process
|
||||
# will handle updates. All workers configured with `client` can handle the above
|
||||
# endpoint as long as either this worker or the main process are configured to
|
||||
# handle it, and are online.
|
||||
|
||||
# If `update_user_directory` is set to `false`, and this worker is not running,
|
||||
# the above endpoint may give outdated results.
|
||||
|
||||
matrix_synapse_workers_avail_list:
|
||||
- appservice
|
||||
- federation_sender
|
||||
- generic_worker
|
||||
- media_repository
|
||||
- pusher
|
||||
- user_dir
|
Reference in New Issue
Block a user