synapse workers: reworkings + get endpoints from upstream docs via awk

(yes, a bit awkward and brittle… xD)
This commit is contained in:
Marcel Partap
2020-10-28 07:13:19 +01:00
parent 87bd64ce9e
commit 2d1b9f2dbf
9 changed files with 226 additions and 139 deletions

View File

@ -249,19 +249,19 @@ worker_app: synapse.app.homeserver
# thx https://oznetnerd.com/2017/04/18/jinja2-selectattr-filter/
# reduce the main worker's offerings to core homeserver business
{% if matrix_synapse_workers_enabled_list|selectattr('worker', 'equalto', 'appservice')|list %}
{% if matrix_synapse_workers_enabled_list|selectattr('type', 'equalto', 'appservice')|list %}
notify_appservices: false
{% endif %}
{% if matrix_synapse_workers_enabled_list|selectattr('worker', 'equalto', 'federation_sender')|list %}
{% if matrix_synapse_workers_enabled_list|selectattr('type', 'equalto', 'federation_sender')|list %}
send_federation: false
{% endif %}
{% if matrix_synapse_workers_enabled_list|selectattr('worker', 'equalto', 'media_repository')|list %}
{% if matrix_synapse_workers_enabled_list|selectattr('type', 'equalto', 'media_repository')|list %}
enable_media_repo: false
{% endif %}
{% if matrix_synapse_workers_enabled_list|selectattr('worker', 'equalto', 'pusher')|list %}
{% if matrix_synapse_workers_enabled_list|selectattr('type', 'equalto', 'pusher')|list %}
start_pushers: false
{% endif %}
{% if matrix_synapse_workers_enabled_list|selectattr('worker', 'equalto', 'user_dir')|list %}
{% if matrix_synapse_workers_enabled_list|selectattr('type', 'equalto', 'user_dir')|list %}
update_user_directory: false
{% endif %}

View File

@ -43,9 +43,12 @@ ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-synapse \
{% 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 %}
{% if matrix_synapse_workers_enabled %}
{% if matrix_synapse_workers_enabled and not matrix_nginx_proxy_enabled|default(False) %}
{# Expose worker (by default 18xxx range) ports on host if not using internal nginx proxy #}
{% for worker in matrix_synapse_workers_enabled_list %}
{% if worker.port != 0 %}
-p {{ worker.port }}:{{ worker.port }} \
{% endif %}
{% endfor %}
{% endif %}
-v {{ matrix_synapse_config_dir_path }}:/data:ro \

View File

@ -1,27 +1,27 @@
#jinja2: lstrip_blocks: "True"
worker_app: synapse.app.{{ item.worker }}
worker_name: {{ item.worker ~ ':' ~ item.port }}
worker_app: synapse.app.{{ item.type }}
worker_name: {{ item.type ~ ':' ~ item.port }}
worker_replication_host: 127.0.0.1
worker_replication_http_port: {{ matrix_synapse_replication_http_port }}
{% if item.worker not in [ 'appservice', 'federation_sender', 'pusher' ] %}
{% if item.type not in [ 'appservice', 'federation_sender', 'pusher' ] %}
worker_listeners:
- type: http
port: {{ item.port }}
resources:
- names:
{% if item.worker in [ 'generic_worker', 'frontend_proxy', 'user_dir' ] %}
{% if item.type in [ 'generic_worker', 'frontend_proxy', 'user_dir' ] %}
- client
{% endif %}
{% if item.worker in [ 'generic_worker' ] %}
{% if item.type in [ 'generic_worker' ] %}
- federation
{% elif item.worker in [ 'media_repository' ] %}
{% elif item.type in [ 'media_repository' ] %}
- media
{% endif %}
{% endif %}
{% if item.worker == 'frontend_proxy' %}
{% if item.type == 'frontend_proxy' %}
worker_main_http_uri: http://127.0.0.1:8008
{% endif %}