From 4fb0b759428b5ac42b2331ccafdb5f2149e6a872 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Wed, 12 Mar 2025 09:05:59 +0200 Subject: [PATCH 1/4] Reorder Synapse config's `experimental_features` alphabetically --- .../matrix-synapse/templates/synapse/homeserver.yaml.j2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 b/roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 index dbfbdffaf..4daff2fef 100644 --- a/roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 +++ b/roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 @@ -2970,6 +2970,9 @@ background_updates: #default_batch_size: 50 experimental_features: + {% if matrix_synapse_experimental_features_msc3266_enabled %} + msc3266_enabled: true + {% endif %} {% if matrix_synapse_experimental_features_msc3861_enabled %} msc3861: enabled: true @@ -2984,8 +2987,5 @@ experimental_features: {% if matrix_synapse_experimental_features_msc4108_enabled %} msc4108_enabled: true {% endif %} - {% if matrix_synapse_experimental_features_msc3266_enabled %} - msc3266_enabled: true - {% endif %} # vim:ft=yaml From f5a0be0a7b27279544e15770578f2bf830e343d2 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Wed, 12 Mar 2025 09:09:21 +0200 Subject: [PATCH 2/4] Add support for configuring Synapse's MSC4140 (Delayed Events) experimental feature This is required by Element Call. Ref: - https://github.com/element-hq/element-call/blob/93ae2aed9841e0b066d515c56bd4c122d2b591b2/docs/self-hosting.md#a-matrix-homeserver - https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/3562 --- roles/custom/matrix-synapse/defaults/main.yml | 14 ++++++++++++++ .../templates/synapse/homeserver.yaml.j2 | 7 +++++++ 2 files changed, 21 insertions(+) diff --git a/roles/custom/matrix-synapse/defaults/main.yml b/roles/custom/matrix-synapse/defaults/main.yml index 9a99d5cd1..113edb498 100644 --- a/roles/custom/matrix-synapse/defaults/main.yml +++ b/roles/custom/matrix-synapse/defaults/main.yml @@ -1261,6 +1261,20 @@ matrix_synapse_experimental_features_msc4108_enabled: false # Set this to false if you still want to disable to API for some reason. Note that doing so breaks Element X compatibility though. matrix_synapse_experimental_features_msc3266_enabled: true +# Controls whether to enable the "Delayed Events" experimental feature. +# Delayed events are required for proper call (Element Call) participation signalling. +# If disabled it is very likely that you end up with stuck calls in Matrix rooms. +# +# Related to `matrix_synapse_max_event_delay_duration` +# +# See https://github.com/matrix-org/matrix-spec-proposals/pull/4140 +matrix_synapse_experimental_features_msc4140_enabled: false + +# Controls the maximum allowed duration by which sent events can be delayed, as per MSC4140. +# +# See `matrix_synapse_experimental_features_msc4140_enabled`. +matrix_synapse_max_event_delay_duration: 24h + # Enable this to activate the REST auth password provider module. # See: https://github.com/ma1uta/matrix-synapse-rest-password-provider matrix_synapse_ext_password_provider_rest_auth_enabled: false diff --git a/roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 b/roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 index 4daff2fef..ebdf323d8 100644 --- a/roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 +++ b/roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 @@ -2987,5 +2987,12 @@ experimental_features: {% if matrix_synapse_experimental_features_msc4108_enabled %} msc4108_enabled: true {% endif %} + {% if matrix_synapse_experimental_features_msc4140_enabled %} + msc4140_enabled: true + {% endif %} + +{% if matrix_synapse_experimental_features_msc4140_enabled %} +max_event_delay_duration: {{ matrix_synapse_max_event_delay_duration | to_json }} +{% endif %} # vim:ft=yaml From 63f81bf268a67faae5de93d7362590f8d4f575d5 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Wed, 12 Mar 2025 09:12:39 +0200 Subject: [PATCH 3/4] Add support for configuring Synapse's MSC4222 (adding `state_after` to sync v2) experimental feature This is required by Element Call. Ref: - https://github.com/element-hq/element-call/blob/93ae2aed9841e0b066d515c56bd4c122d2b591b2/docs/self-hosting.md#a-matrix-homeserver - https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/3562 --- roles/custom/matrix-synapse/defaults/main.yml | 8 ++++++++ .../matrix-synapse/templates/synapse/homeserver.yaml.j2 | 3 +++ 2 files changed, 11 insertions(+) diff --git a/roles/custom/matrix-synapse/defaults/main.yml b/roles/custom/matrix-synapse/defaults/main.yml index 113edb498..8e270a749 100644 --- a/roles/custom/matrix-synapse/defaults/main.yml +++ b/roles/custom/matrix-synapse/defaults/main.yml @@ -1275,6 +1275,14 @@ matrix_synapse_experimental_features_msc4140_enabled: false # See `matrix_synapse_experimental_features_msc4140_enabled`. matrix_synapse_max_event_delay_duration: 24h +# Controls whether to enable the MSC4222 experimental feature (adding `state_after` to sync v2). +# +# Allow clients to opt-in to a change of the sync v2 API that allows them to correctly track the state of the room. +# This is required by Element Call to track room state reliably. +# +# See https://github.com/matrix-org/matrix-spec-proposals/pull/4222 +matrix_synapse_experimental_features_msc4222_enabled: false + # Enable this to activate the REST auth password provider module. # See: https://github.com/ma1uta/matrix-synapse-rest-password-provider matrix_synapse_ext_password_provider_rest_auth_enabled: false diff --git a/roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 b/roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 index ebdf323d8..9675bb245 100644 --- a/roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 +++ b/roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 @@ -2990,6 +2990,9 @@ experimental_features: {% if matrix_synapse_experimental_features_msc4140_enabled %} msc4140_enabled: true {% endif %} + {% if matrix_synapse_experimental_features_msc4222_enabled %} + msc4222_enabled: true + {% endif %} {% if matrix_synapse_experimental_features_msc4140_enabled %} max_event_delay_duration: {{ matrix_synapse_max_event_delay_duration | to_json }} From c5a03efdf61cc1a936e1579d5f4445a895b9eb18 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Wed, 12 Mar 2025 09:13:43 +0200 Subject: [PATCH 4/4] Increase default Synapse/`rc_message` rate limits The new rate limits are more suitable for running Element Call. Ref: - https://github.com/element-hq/element-call/blob/93ae2aed9841e0b066d515c56bd4c122d2b591b2/docs/self-hosting.md#a-matrix-homeserver - https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/3562 Instead of trying to increase them conditionally only when Element Call is enabled, it's simpler and good-enough to just increase them in all cases. --- roles/custom/matrix-synapse/defaults/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/custom/matrix-synapse/defaults/main.yml b/roles/custom/matrix-synapse/defaults/main.yml index 8e270a749..214e1841c 100644 --- a/roles/custom/matrix-synapse/defaults/main.yml +++ b/roles/custom/matrix-synapse/defaults/main.yml @@ -416,8 +416,8 @@ matrix_synapse_root_log_level: "WARNING" # Rate limits matrix_synapse_rc_message: - per_second: 0.2 - burst_count: 10 + per_second: 0.5 + burst_count: 30 matrix_synapse_rc_registration: per_second: 0.17