mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2024-12-25 02:18:31 +01:00
Clean up worker.yaml generation a bit and make it more flexible
This commit is contained in:
parent
1462409b34
commit
66cdc7bf5a
@ -333,7 +333,16 @@ matrix_synapse_redis_host: ""
|
|||||||
matrix_synapse_redis_port: 6379
|
matrix_synapse_redis_port: 6379
|
||||||
matrix_synapse_redis_password: ""
|
matrix_synapse_redis_password: ""
|
||||||
|
|
||||||
# Port used for communication between main synapse process and workers
|
# 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
|
matrix_synapse_replication_http_port: 9093
|
||||||
|
|
||||||
# Send ERROR logs to sentry.io for easier tracking
|
# Send ERROR logs to sentry.io for easier tracking
|
||||||
|
@ -277,6 +277,8 @@ listeners:
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if matrix_synapse_workers_enabled %}
|
{% if matrix_synapse_workers_enabled %}
|
||||||
|
|
||||||
|
{% if matrix_synapse_replication_listener_enabled %}
|
||||||
# c.f. https://github.com/matrix-org/synapse/tree/master/docs/workers.md
|
# c.f. https://github.com/matrix-org/synapse/tree/master/docs/workers.md
|
||||||
# HTTP replication: for the workers to send data to the main synapse process
|
# HTTP replication: for the workers to send data to the main synapse process
|
||||||
- port: {{ matrix_synapse_replication_http_port }}
|
- port: {{ matrix_synapse_replication_http_port }}
|
||||||
@ -284,6 +286,7 @@ listeners:
|
|||||||
type: http
|
type: http
|
||||||
resources:
|
resources:
|
||||||
- names: [replication]
|
- names: [replication]
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
# c.f. https://github.com/matrix-org/synapse/tree/master/contrib/systemd-with-workers/README.md
|
# c.f. https://github.com/matrix-org/synapse/tree/master/contrib/systemd-with-workers/README.md
|
||||||
worker_app: synapse.app.homeserver
|
worker_app: synapse.app.homeserver
|
||||||
|
@ -2,30 +2,40 @@
|
|||||||
worker_app: synapse.app.{{ matrix_synapse_worker_details.type }}
|
worker_app: synapse.app.{{ matrix_synapse_worker_details.type }}
|
||||||
worker_name: {{ matrix_synapse_worker_details.type ~ ':' ~ matrix_synapse_worker_details.port }}
|
worker_name: {{ matrix_synapse_worker_details.type ~ ':' ~ matrix_synapse_worker_details.port }}
|
||||||
|
|
||||||
|
{% if matrix_synapse_replication_listener_enabled %}
|
||||||
worker_replication_host: matrix-synapse
|
worker_replication_host: matrix-synapse
|
||||||
worker_replication_http_port: {{ matrix_synapse_replication_http_port }}
|
worker_replication_http_port: {{ matrix_synapse_replication_http_port }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% set has_listeners = (matrix_synapse_worker_details.type not in [ 'appservice', 'federation_sender', 'pusher' ] or matrix_synapse_metrics_enabled) %}
|
||||||
|
|
||||||
|
{% set http_resources = [] %}
|
||||||
|
|
||||||
|
{% if matrix_synapse_worker_details.type in ['generic_worker', 'frontend_proxy', 'user_dir'] %}
|
||||||
|
{% set http_resources = http_resources + ['client'] %}
|
||||||
|
{% endif %}
|
||||||
|
{% if matrix_synapse_worker_details.type in ['generic_worker'] %}
|
||||||
|
{% set http_resources = http_resources+ ['federation'] %}
|
||||||
|
{% endif %}
|
||||||
|
{% if matrix_synapse_worker_details.type in ['media_repository'] %}
|
||||||
|
{% set http_resources = http_resources + ['media'] %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if http_resources|length > 0 or matrix_synapse_metrics_enabled %}
|
||||||
worker_listeners:
|
worker_listeners:
|
||||||
{% if matrix_synapse_worker_details.type not in [ 'appservice', 'federation_sender', 'pusher' ] %}
|
{% if http_resources|length > 0 %}
|
||||||
- type: http
|
- type: http
|
||||||
bind_addresses: ['::']
|
bind_addresses: ['::']
|
||||||
port: {{ matrix_synapse_worker_details.port }}
|
port: {{ matrix_synapse_worker_details.port }}
|
||||||
resources:
|
resources:
|
||||||
- names:
|
- names: {{ http_resources|to_json }}
|
||||||
{% if matrix_synapse_worker_details.type in [ 'generic_worker', 'frontend_proxy', 'user_dir' ] %}
|
|
||||||
- client
|
|
||||||
{% endif %}
|
|
||||||
{% if matrix_synapse_worker_details.type in [ 'generic_worker' ] %}
|
|
||||||
- federation
|
|
||||||
{% elif matrix_synapse_worker_details.type in [ 'media_repository' ] %}
|
|
||||||
- media
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if matrix_synapse_metrics_enabled %}
|
{% if matrix_synapse_metrics_enabled %}
|
||||||
- type: metrics
|
- type: metrics
|
||||||
bind_addresses: ['::']
|
bind_addresses: ['::']
|
||||||
port: {{ matrix_synapse_worker_details.metrics_port }}
|
port: {{ matrix_synapse_worker_details.metrics_port }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if matrix_synapse_worker_details.type == 'frontend_proxy' %}
|
{% if matrix_synapse_worker_details.type == 'frontend_proxy' %}
|
||||||
worker_main_http_uri: http://matrix-synapse:8008
|
worker_main_http_uri: http://matrix-synapse:8008
|
||||||
|
Loading…
Reference in New Issue
Block a user