matrix-docker-ansible-deploy/roles/custom/matrix-synapse/templates/synapse/worker.yaml.j2

67 lines
2.7 KiB
Plaintext
Raw Normal View History

#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
{% set http_resources = [] %}
{% if matrix_synapse_worker_details.type == 'room_worker' %}
{% set http_resources = http_resources + ['client', 'federation'] %}
{% elif matrix_synapse_worker_details.type == 'sync_worker' %}
{% set http_resources = http_resources + ['client'] %}
{% elif matrix_synapse_worker_details.type == 'client_reader' %}
{% set http_resources = http_resources + ['client'] %}
{% elif matrix_synapse_worker_details.type == 'federation_reader' %}
{% set http_resources = http_resources + ['federation'] %}
{% elif matrix_synapse_worker_details.type == 'user_dir' %}
{% set http_resources = http_resources + ['client'] %}
{% elif 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' %}
{#
2024-07-17 14:54:10 +00:00
Handling authenticated media endpoints (`/_matrix/client/VERSION/media/` and `/_matrix/federation/VERSION/media/`)
requires serving the client and federation resources.
#}
{% set http_resources = http_resources + ['media', 'client', 'federation'] %}
{% 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 %}