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:
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 %}
|
Reference in New Issue
Block a user