commit
d94d0e2ca5
@ -0,0 +1,70 @@
|
|||||||
|
#jinja2: lstrip_blocks: "True"
|
||||||
|
|
||||||
|
{% macro render_vhost_directives() %}
|
||||||
|
root /nginx-data/matrix-domain;
|
||||||
|
|
||||||
|
gzip on;
|
||||||
|
gzip_types text/plain application/json;
|
||||||
|
{% for configuration_block in matrix_nginx_proxy_proxy_domain_additional_server_configuration_blocks %}
|
||||||
|
{{- configuration_block }}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
location /.well-known/matrix {
|
||||||
|
root {{ matrix_static_files_base_path }};
|
||||||
|
{#
|
||||||
|
A somewhat long expires value is used to prevent outages
|
||||||
|
in case this is unreachable due to network failure.
|
||||||
|
#}
|
||||||
|
expires 4h;
|
||||||
|
default_type application/json;
|
||||||
|
add_header Access-Control-Allow-Origin *;
|
||||||
|
}
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen {{ 8080 if matrix_nginx_proxy_enabled else 80 }};
|
||||||
|
|
||||||
|
server_name {{ matrix_nginx_proxy_base_domain_hostname }};
|
||||||
|
server_tokens off;
|
||||||
|
|
||||||
|
{% if matrix_nginx_proxy_https_enabled %}
|
||||||
|
location /.well-known/acme-challenge {
|
||||||
|
{% if matrix_nginx_proxy_enabled %}
|
||||||
|
{# Use the embedded DNS resolver in Docker containers to discover the service #}
|
||||||
|
resolver 127.0.0.11 valid=5s;
|
||||||
|
set $backend "matrix-certbot:8080";
|
||||||
|
proxy_pass http://$backend;
|
||||||
|
{% else %}
|
||||||
|
{# Generic configuration for use outside of our container setup #}
|
||||||
|
proxy_pass http://127.0.0.1:{{ matrix_ssl_lets_encrypt_certbot_standalone_http_port }};
|
||||||
|
{% endif %}
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
return 301 https://$http_host$request_uri;
|
||||||
|
}
|
||||||
|
{% else %}
|
||||||
|
{{ render_vhost_directives() }}
|
||||||
|
{% endif %}
|
||||||
|
}
|
||||||
|
|
||||||
|
{% if matrix_nginx_proxy_https_enabled %}
|
||||||
|
server {
|
||||||
|
listen {{ 8443 if matrix_nginx_proxy_enabled else 443 }} ssl http2;
|
||||||
|
listen [::]:{{ 8443 if matrix_nginx_proxy_enabled else 443 }} ssl http2;
|
||||||
|
|
||||||
|
server_name {{ matrix_nginx_proxy_base_domain_hostname }};
|
||||||
|
server_tokens off;
|
||||||
|
|
||||||
|
ssl_certificate {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_base_domain_hostname }}/fullchain.pem;
|
||||||
|
ssl_certificate_key {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_base_domain_hostname }}/privkey.pem;
|
||||||
|
|
||||||
|
ssl_protocols {{ matrix_nginx_proxy_ssl_protocols }};
|
||||||
|
{% if matrix_nginx_proxy_ssl_ciphers != '' %}
|
||||||
|
ssl_ciphers {{ matrix_nginx_proxy_ssl_ciphers }};
|
||||||
|
{% endif %}
|
||||||
|
ssl_prefer_server_ciphers {{ matrix_nginx_proxy_ssl_prefer_server_ciphers }};
|
||||||
|
|
||||||
|
{{ render_vhost_directives() }}
|
||||||
|
}
|
||||||
|
{% endif %}
|
@ -0,0 +1,21 @@
|
|||||||
|
matrix_redis_enabled: true
|
||||||
|
|
||||||
|
matrix_redis_connection_password: ""
|
||||||
|
|
||||||
|
matrix_redis_base_path: "{{ matrix_base_data_path }}/redis"
|
||||||
|
matrix_redis_data_path: "{{ matrix_redis_base_path }}/data"
|
||||||
|
|
||||||
|
matrix_redis_docker_image_v6: "docker.io/redis:6.0.10-alpine"
|
||||||
|
matrix_redis_docker_image_latest: "{{ matrix_redis_docker_image_v6 }}"
|
||||||
|
matrix_redis_docker_image_to_use: '{{ matrix_redis_docker_image_latest }}'
|
||||||
|
|
||||||
|
matrix_redis_docker_image_force_pull: "{{ matrix_redis_docker_image_to_use.endswith(':latest') }}"
|
||||||
|
|
||||||
|
# A list of extra arguments to pass to the container
|
||||||
|
matrix_redis_container_extra_arguments: []
|
||||||
|
|
||||||
|
# Controls whether the matrix-redis container exposes a port (tcp/6379 in the container)
|
||||||
|
# that can be used to access redis from outside the container
|
||||||
|
#
|
||||||
|
# Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:6379"), or empty string to not expose.
|
||||||
|
matrix_redis_container_redis_bind_port: ""
|
@ -0,0 +1,3 @@
|
|||||||
|
- set_fact:
|
||||||
|
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-redis'] }}"
|
||||||
|
when: matrix_redis_enabled|bool
|
@ -0,0 +1,9 @@
|
|||||||
|
- import_tasks: "{{ role_path }}/tasks/init.yml"
|
||||||
|
tags:
|
||||||
|
- always
|
||||||
|
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/setup_redis.yml"
|
||||||
|
when: run_setup|bool
|
||||||
|
tags:
|
||||||
|
- setup-all
|
||||||
|
- setup-redis
|
@ -0,0 +1,99 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
#
|
||||||
|
# Tasks related to setting up an internal redis server
|
||||||
|
#
|
||||||
|
|
||||||
|
- name: Ensure redis Docker image is pulled
|
||||||
|
docker_image:
|
||||||
|
name: "{{ matrix_redis_docker_image_to_use }}"
|
||||||
|
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||||
|
force_source: "{{ matrix_redis_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_redis_docker_image_force_pull }}"
|
||||||
|
when: matrix_redis_enabled|bool
|
||||||
|
|
||||||
|
- name: Ensure redis paths exist
|
||||||
|
file:
|
||||||
|
path: "{{ item }}"
|
||||||
|
state: directory
|
||||||
|
mode: 0700
|
||||||
|
owner: "{{ matrix_user_username }}"
|
||||||
|
group: "{{ matrix_user_username }}"
|
||||||
|
with_items:
|
||||||
|
- "{{ matrix_redis_base_path }}"
|
||||||
|
- "{{ matrix_redis_data_path }}"
|
||||||
|
when: matrix_redis_enabled|bool
|
||||||
|
|
||||||
|
# We do this as a separate task, because:
|
||||||
|
# - we'd like to do it for the data path only, not for the base path (which contains root-owned environment variable files we'd like to leave as-is)
|
||||||
|
# - we need to do it without `mode`, or we risk making certain `.conf` and other files's executable bit to flip to true
|
||||||
|
- name: Ensure redis data path ownership is correct
|
||||||
|
file:
|
||||||
|
path: "{{ matrix_redis_data_path }}"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ matrix_user_username }}"
|
||||||
|
group: "{{ matrix_user_username }}"
|
||||||
|
recurse: yes
|
||||||
|
when: matrix_redis_enabled|bool
|
||||||
|
|
||||||
|
- name: Ensure redis environment variables file created
|
||||||
|
template:
|
||||||
|
src: "{{ role_path }}/templates/{{ item }}.j2"
|
||||||
|
dest: "{{ matrix_redis_base_path }}/{{ item }}"
|
||||||
|
mode: 0644
|
||||||
|
with_items:
|
||||||
|
- "redis.conf"
|
||||||
|
when: matrix_redis_enabled|bool
|
||||||
|
|
||||||
|
- name: Ensure matrix-redis.service installed
|
||||||
|
template:
|
||||||
|
src: "{{ role_path }}/templates/systemd/matrix-redis.service.j2"
|
||||||
|
dest: "{{ matrix_systemd_path }}/matrix-redis.service"
|
||||||
|
mode: 0644
|
||||||
|
register: matrix_redis_systemd_service_result
|
||||||
|
when: matrix_redis_enabled|bool
|
||||||
|
|
||||||
|
- name: Ensure systemd reloaded after matrix-redis.service installation
|
||||||
|
service:
|
||||||
|
daemon_reload: yes
|
||||||
|
when: "matrix_redis_enabled|bool and matrix_redis_systemd_service_result.changed"
|
||||||
|
|
||||||
|
#
|
||||||
|
# Tasks related to getting rid of the internal redis server (if it was previously enabled)
|
||||||
|
#
|
||||||
|
|
||||||
|
- name: Check existence of matrix-redis service
|
||||||
|
stat:
|
||||||
|
path: "{{ matrix_systemd_path }}/matrix-redis.service"
|
||||||
|
register: matrix_redis_service_stat
|
||||||
|
when: "not matrix_redis_enabled|bool"
|
||||||
|
|
||||||
|
- name: Ensure matrix-redis is stopped
|
||||||
|
service:
|
||||||
|
name: matrix-redis
|
||||||
|
state: stopped
|
||||||
|
daemon_reload: yes
|
||||||
|
when: "not matrix_redis_enabled|bool and matrix_redis_service_stat.stat.exists"
|
||||||
|
|
||||||
|
- name: Ensure matrix-redis.service doesn't exist
|
||||||
|
file:
|
||||||
|
path: "{{ matrix_systemd_path }}/matrix-redis.service"
|
||||||
|
state: absent
|
||||||
|
when: "not matrix_redis_enabled|bool and matrix_redis_service_stat.stat.exists"
|
||||||
|
|
||||||
|
- name: Ensure systemd reloaded after matrix-redis.service removal
|
||||||
|
service:
|
||||||
|
daemon_reload: yes
|
||||||
|
when: "not matrix_redis_enabled|bool and matrix_redis_service_stat.stat.exists"
|
||||||
|
|
||||||
|
- name: Check existence of matrix-redis local data path
|
||||||
|
stat:
|
||||||
|
path: "{{ matrix_redis_data_path }}"
|
||||||
|
register: matrix_redis_data_path_stat
|
||||||
|
when: "not matrix_redis_enabled|bool"
|
||||||
|
|
||||||
|
# We just want to notify the user. Deleting data is too destructive.
|
||||||
|
- name: Notify if matrix-redis local data remains
|
||||||
|
debug:
|
||||||
|
msg: "Note: You are not using a local redis instance, but some old data remains from before in `{{ matrix_redis_data_path }}`. Feel free to delete it."
|
||||||
|
when: "not matrix_redis_enabled|bool and matrix_redis_data_path_stat.stat.exists"
|
@ -0,0 +1,4 @@
|
|||||||
|
#jinja2: lstrip_blocks: "True"
|
||||||
|
{% if matrix_redis_connection_password %}
|
||||||
|
requirepass {{ matrix_redis_connection_password }}
|
||||||
|
{% endif %}
|
@ -0,0 +1,36 @@
|
|||||||
|
#jinja2: lstrip_blocks: "True"
|
||||||
|
[Unit]
|
||||||
|
Description=Matrix Redis server
|
||||||
|
After=docker.service
|
||||||
|
Requires=docker.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStartPre=-/usr/bin/docker stop matrix-redis
|
||||||
|
ExecStartPre=-/usr/bin/docker rm matrix-redis
|
||||||
|
|
||||||
|
ExecStart=/usr/bin/docker run --rm --name matrix-redis \
|
||||||
|
--log-driver=none \
|
||||||
|
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
||||||
|
--cap-drop=ALL \
|
||||||
|
--read-only \
|
||||||
|
--tmpfs=/tmp:rw,noexec,nosuid,size=100m \
|
||||||
|
--network={{ matrix_docker_network }} \
|
||||||
|
{% if matrix_redis_container_redis_bind_port %}
|
||||||
|
-p {{ matrix_redis_container_redis_bind_port }}:6379 \
|
||||||
|
{% endif %}
|
||||||
|
-v {{ matrix_redis_base_path }}/redis.conf:/usr/local/etc/redis/redis.conf \
|
||||||
|
{% for arg in matrix_redis_container_extra_arguments %}
|
||||||
|
{{ arg }} \
|
||||||
|
{% endfor %}
|
||||||
|
{{ matrix_redis_docker_image_to_use }} \
|
||||||
|
redis-server /usr/local/etc/redis/redis.conf
|
||||||
|
|
||||||
|
ExecStop=-/usr/bin/docker stop matrix-redis
|
||||||
|
ExecStop=-/usr/bin/docker rm matrix-redis
|
||||||
|
Restart=always
|
||||||
|
RestartSec=30
|
||||||
|
SyslogIdentifier=matrix-redis
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
@ -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|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 |(^| )[Ff]or /) {
|
||||||
|
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
|
@ -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,86 @@
|
|||||||
|
# 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
|
||||||
|
set_fact:
|
||||||
|
worker:
|
||||||
|
type: 'generic_worker'
|
||||||
|
instanceId: "{{ matrix_synapse_workers_generic_workers_port_range_start + item }}"
|
||||||
|
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 federation sender workers
|
||||||
|
set_fact:
|
||||||
|
worker:
|
||||||
|
type: 'federation_sender'
|
||||||
|
instanceId: "{{ item }}"
|
||||||
|
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 }}"
|
||||||
|
|
||||||
|
# This type of worker can only have a count of 1, at most
|
||||||
|
- name: Build pusher workers
|
||||||
|
set_fact:
|
||||||
|
worker:
|
||||||
|
type: 'pusher'
|
||||||
|
instanceId: "{{ item }}"
|
||||||
|
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
|
||||||
|
set_fact:
|
||||||
|
worker:
|
||||||
|
type: 'appservice'
|
||||||
|
instanceId: "{{ item }}"
|
||||||
|
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 }}"
|
||||||
|
|
||||||
|
- name: Build media_repository workers
|
||||||
|
set_fact:
|
||||||
|
worker:
|
||||||
|
type: 'media_repository'
|
||||||
|
instanceId: "{{ matrix_synapse_workers_media_repository_workers_port_range_start + item }}"
|
||||||
|
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 }}"
|
||||||
|
|
||||||
|
- name: Build frontend_proxy workers
|
||||||
|
set_fact:
|
||||||
|
worker:
|
||||||
|
type: 'frontend_proxy'
|
||||||
|
instanceId: "{{ matrix_synapse_workers_frontend_proxy_workers_port_range_start + item }}"
|
||||||
|
port: "{{ matrix_synapse_workers_frontend_proxy_workers_port_range_start + item }}"
|
||||||
|
metrics_port: "{{ matrix_synapse_workers_frontend_proxy_workers_metrics_range_start + item }}"
|
||||||
|
register: "matrix_synapse_workers_list_results_frontend_proxy_workers"
|
||||||
|
loop: "{{ range(0, matrix_synapse_workers_frontend_proxy_workers_count|int)|list }}"
|
||||||
|
|
||||||
|
- 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_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_media_repository_workers.results
|
||||||
|
+
|
||||||
|
matrix_synapse_workers_list_results_frontend_proxy_workers.results
|
||||||
|
}}
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
matrix_synapse_workers_enabled_list: "{{ matrix_synapse_dynamic_workers_list }}"
|
@ -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
|
||||||
|
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
|
||||||
|
file:
|
||||||
|
path: "{{ matrix_local_bin_path }}/matrix-synapse-worker-write-pid"
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- include_tasks: "{{ role_path }}/tasks/synapse/workers/setup_install.yml"
|
||||||
|
when: "matrix_synapse_enabled|bool and matrix_synapse_workers_enabled|bool"
|
||||||
|
|
||||||
|
- 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
|
||||||
|
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
|
||||||
|
file:
|
||||||
|
path: "{{ item.path }}"
|
||||||
|
state: absent
|
||||||
|
with_items: "{{ matrix_synapse_workers_current_config_files.files }}"
|
||||||
|
|
||||||
|
- name: Determine current worker systemd services
|
||||||
|
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
|
||||||
|
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
|
||||||
|
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
|
||||||
|
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,36 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Populate service facts
|
||||||
|
service_facts:
|
||||||
|
|
||||||
|
- name: Ensure any worker services are stopped
|
||||||
|
service:
|
||||||
|
name: "{{ item.key }}"
|
||||||
|
state: stopped
|
||||||
|
with_dict: "{{ ansible_facts.services|default({})|dict2items|selectattr('key', 'match', 'matrix-synapse-worker-.+\\.service')|list|items2dict }}"
|
||||||
|
|
||||||
|
- name: Find worker configs to be cleaned
|
||||||
|
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
|
||||||
|
file:
|
||||||
|
path: "{{ item.path }}"
|
||||||
|
state: absent
|
||||||
|
with_items: "{{ matrix_synapse_workers_current_config_files.files }}"
|
||||||
|
|
||||||
|
- name: Find worker systemd services to be cleaned
|
||||||
|
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
|
||||||
|
file:
|
||||||
|
path: "{{ item.path }}"
|
||||||
|
state: absent
|
||||||
|
with_items: "{{ matrix_synapse_workers_current_systemd_services.files }}"
|
@ -0,0 +1,18 @@
|
|||||||
|
# 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 instanceId not defined for worker
|
||||||
|
fail:
|
||||||
|
msg: "Synapse workers (like {{ matrix_synapse_worker_details|to_json }}) need to define an instanceId property (type + instanceId must be unique)"
|
||||||
|
when: "'instanceId' not in matrix_synapse_worker_details"
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
matrix_synapse_worker_systemd_service_name: "matrix-synapse-worker-{{ matrix_synapse_worker_details.type }}-{{ matrix_synapse_worker_details.instanceId }}.service"
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
matrix_systemd_services_list: "{{ matrix_systemd_services_list + [matrix_synapse_worker_systemd_service_name] }}"
|
@ -0,0 +1,19 @@
|
|||||||
|
- set_fact:
|
||||||
|
matrix_synapse_worker_systemd_service_name: "matrix-synapse-worker-{{ matrix_synapse_worker_details.type }}-{{ matrix_synapse_worker_details.instanceId }}"
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
matrix_synapse_worker_container_name: "{{ matrix_synapse_worker_systemd_service_name }}"
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
matrix_synapse_worker_config_file_name: "worker.{{ matrix_synapse_worker_details.type }}_{{ matrix_synapse_worker_details.instanceId }}.yaml"
|
||||||
|
|
||||||
|
- name: Ensure configuration exists for {{ matrix_synapse_worker_systemd_service_name }}
|
||||||
|
template:
|
||||||
|
src: "{{ role_path }}/templates/synapse/worker.yaml.j2"
|
||||||
|
dest: "{{ matrix_synapse_config_dir_path }}/{{ matrix_synapse_worker_config_file_name }}"
|
||||||
|
|
||||||
|
- name: Ensure systemd service exists for {{ matrix_synapse_worker_systemd_service_name }}
|
||||||
|
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
|
@ -0,0 +1,45 @@
|
|||||||
|
#jinja2: lstrip_blocks: "True"
|
||||||
|
worker_app: synapse.app.{{ matrix_synapse_worker_details.type }}
|
||||||
|
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_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:
|
||||||
|
{% if http_resources|length > 0 %}
|
||||||
|
- type: http
|
||||||
|
bind_addresses: ['::']
|
||||||
|
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 %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if matrix_synapse_worker_details.type == 'frontend_proxy' %}
|
||||||
|
worker_main_http_uri: http://matrix-synapse:8008
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
worker_daemonize: false
|
||||||
|
worker_log_config: /data/{{ matrix_server_fqn_matrix }}.log.config
|
@ -0,0 +1,313 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
matrix_synapse_workers_generic_worker_endpoints:
|
||||||
|
# This worker can handle API requests matching the following regular
|
||||||
|
# expressions:
|
||||||
|
|
||||||
|
# Sync requests
|
||||||
|
- ^/_matrix/client/(v2_alpha|r0)/sync$
|
||||||
|
- ^/_matrix/client/(api/v1|v2_alpha|r0)/events$
|
||||||
|
- ^/_matrix/client/(api/v1|r0)/initialSync$
|
||||||
|
- ^/_matrix/client/(api/v1|r0)/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/send_join/
|
||||||
|
- ^/_matrix/federation/v2/send_join/
|
||||||
|
- ^/_matrix/federation/v1/send_leave/
|
||||||
|
- ^/_matrix/federation/v2/send_leave/
|
||||||
|
- ^/_matrix/federation/v1/invite/
|
||||||
|
- ^/_matrix/federation/v2/invite/
|
||||||
|
- ^/_matrix/federation/v1/query_auth/
|
||||||
|
- ^/_matrix/federation/v1/event_auth/
|
||||||
|
- ^/_matrix/federation/v1/exchange_third_party_invite/
|
||||||
|
- ^/_matrix/federation/v1/user/devices/
|
||||||
|
- ^/_matrix/federation/v1/get_groups_publicised$
|
||||||
|
- ^/_matrix/key/v2/query
|
||||||
|
|
||||||
|
# Inbound federation transaction request
|
||||||
|
- ^/_matrix/federation/v1/send/
|
||||||
|
|
||||||
|
# Client API requests
|
||||||
|
- ^/_matrix/client/(api/v1|r0|unstable)/publicRooms$
|
||||||
|
- ^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/joined_members$
|
||||||
|
- ^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/context/.*$
|
||||||
|
- ^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/members$
|
||||||
|
- ^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/state$
|
||||||
|
- ^/_matrix/client/(api/v1|r0|unstable)/account/3pid$
|
||||||
|
- ^/_matrix/client/(api/v1|r0|unstable)/devices$
|
||||||
|
- ^/_matrix/client/(api/v1|r0|unstable)/keys/query$
|
||||||
|
- ^/_matrix/client/(api/v1|r0|unstable)/keys/changes$
|
||||||
|
- ^/_matrix/client/versions$
|
||||||
|
- ^/_matrix/client/(api/v1|r0|unstable)/voip/turnServer$
|
||||||
|
- ^/_matrix/client/(api/v1|r0|unstable)/joined_groups$
|
||||||
|
- ^/_matrix/client/(api/v1|r0|unstable)/publicised_groups$
|
||||||
|
- ^/_matrix/client/(api/v1|r0|unstable)/publicised_groups/
|
||||||
|
|
||||||
|
# Registration/login requests
|
||||||
|
- ^/_matrix/client/(api/v1|r0|unstable)/login$
|
||||||
|
- ^/_matrix/client/(r0|unstable)/register$
|
||||||
|
# FIXME: possible bug with SSO and multiple generic workers
|
||||||
|
# see https://github.com/matrix-org/synapse/issues/7530
|
||||||
|
# ^/_matrix/client/(r0|unstable)/auth/.*/fallback/web$
|
||||||
|
|
||||||
|
# Event sending requests
|
||||||
|
- ^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/redact
|
||||||
|
- ^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/send
|
||||||
|
- ^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/state/
|
||||||
|
- ^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/(join|invite|leave|ban|unban|kick)$
|
||||||
|
- ^/_matrix/client/(api/v1|r0|unstable)/join/
|
||||||
|
- ^/_matrix/client/(api/v1|r0|unstable)/profile/
|
||||||
|
|
||||||
|
|
||||||
|
# Additionally, the following REST endpoints can be handled for GET requests:
|
||||||
|
|
||||||
|
# FIXME: ADDITIONAL CONDITIONS REQUIRED: to be enabled manually
|
||||||
|
# ^/_matrix/federation/v1/groups/
|
||||||
|
|
||||||
|
# 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|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|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|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).
|
||||||
|
|
||||||
|
# Note that a HTTP listener 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, there is *experimental* support for moving writing of specific
|
||||||
|
# streams (such as events) off of the main process to a particular worker. (This
|
||||||
|
# is only supported with Redis-based replication.)
|
||||||
|
|
||||||
|
# Currently supported streams are `events` and `typing`.
|
||||||
|
|
||||||
|
# To enable this, the worker must have a HTTP replication listener configured,
|
||||||
|
# have a `worker_name` and be listed in the `instance_map` config. 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
|
||||||
|
# ```
|
||||||
|
|
||||||
|
# The `events` stream also 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
|
||||||
|
# ```
|
||||||
|
|
||||||
|
# #### Background tasks
|
||||||
|
|
||||||
|
# There is also *experimental* 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).
|
||||||
|
|
||||||
|
# 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` and
|
||||||
|
# `media_instance_running_background_jobs` settings.
|
||||||
|
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
# Note this worker cannot be load-balanced: only one instance should be active.
|
||||||
|
# ]
|
||||||
|
|
||||||
|
# appservice worker (no API endpoints) [
|
||||||
|
# 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
|
||||||
|
# ```
|
||||||
|
# ]
|
||||||
|
|
||||||
|
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/.*$
|
||||||
|
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
# In the `media_repository` worker configuration file, configure the http listener to
|
||||||
|
# expose the `media` resource. For example:
|
||||||
|
|
||||||
|
# ```yaml
|
||||||
|
# worker_listeners:
|
||||||
|
# - type: http
|
||||||
|
# port: 8085
|
||||||
|
# resources:
|
||||||
|
# - names:
|
||||||
|
# - media
|
||||||
|
# ```
|
||||||
|
|
||||||
|
# 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:
|
||||||
|
# Handles searches in the user directory. It can handle REST endpoints matching
|
||||||
|
# the following regular expressions:
|
||||||
|
|
||||||
|
- ^/_matrix/client/(api/v1|r0|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.
|
||||||
|
|
||||||
|
matrix_synapse_workers_frontend_proxy_endpoints:
|
||||||
|
# Proxies some frequently-requested client endpoints to add caching and remove
|
||||||
|
# load from the main synapse. It can handle REST endpoints matching the following
|
||||||
|
# regular expressions:
|
||||||
|
|
||||||
|
- ^/_matrix/client/(api/v1|r0|unstable)/keys/upload
|
||||||
|
|
||||||
|
# If `use_presence` is False in the homeserver config, it can also handle REST
|
||||||
|
# endpoints matching the following regular expressions:
|
||||||
|
|
||||||
|
# FIXME: ADDITIONAL CONDITIONS REQUIRED: to be enabled manually
|
||||||
|
# ^/_matrix/client/(api/v1|r0|unstable)/presence/[^/]+/status
|
||||||
|
|
||||||
|
# This "stub" presence handler will pass through `GET` request but make the
|
||||||
|
# `PUT` effectively a no-op.
|
||||||
|
|
||||||
|
# It will proxy any requests it cannot handle to the main synapse instance. It
|
||||||
|
# must therefore be configured with the location of the main instance, via
|
||||||
|
# the `worker_main_http_uri` setting in the `frontend_proxy` worker configuration
|
||||||
|
# file. For example:
|
||||||
|
|
||||||
|
# worker_main_http_uri: http://127.0.0.1:8008
|
||||||
|
|
||||||
|
matrix_synapse_workers_avail_list:
|
||||||
|
- appservice
|
||||||
|
- federation_sender
|
||||||
|
- frontend_proxy
|
||||||
|
- generic_worker
|
||||||
|
- media_repository
|
||||||
|
- pusher
|
||||||
|
- user_dir
|
Loading…
Reference in new issue