From 9faa65f05914baa75a5eab06aa429d116c5eefe7 Mon Sep 17 00:00:00 2001 From: Samuel Meenzen Date: Thu, 10 Aug 2023 22:07:33 +0200 Subject: [PATCH 1/4] Advertise sliding-sync support when using conduit Starting from version `0.6.0` conduit natively supports some sync v3 (sliding-sync) features. https://gitlab.com/famedly/conduit/-/releases/v0.6.0 https://gitlab.com/famedly/conduit/-/merge_requests/501 --- .../templates/static-files/well-known/matrix-client.j2 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/roles/custom/matrix-base/templates/static-files/well-known/matrix-client.j2 b/roles/custom/matrix-base/templates/static-files/well-known/matrix-client.j2 index 4de91a370..549bfc8ae 100644 --- a/roles/custom/matrix-base/templates/static-files/well-known/matrix-client.j2 +++ b/roles/custom/matrix-base/templates/static-files/well-known/matrix-client.j2 @@ -30,6 +30,10 @@ "org.matrix.msc3575.proxy": { "url": "{{ matrix_sliding_sync_base_url }}" } + {% elif matrix_homeserver_implementation == 'conduit' %}, + "org.matrix.msc3575.proxy": { + "url": "{{ matrix_homeserver_url }}" + } {% endif %} {% if matrix_client_element_location_sharing_enabled %}, "m.tile_server": { From 837cca4ee16d989f4b336232b13665fcb319af31 Mon Sep 17 00:00:00 2001 From: Samuel Meenzen Date: Fri, 11 Aug 2023 08:13:49 +0000 Subject: [PATCH 2/4] Move sliding sync url logic out of matrix-client.j2 --- group_vars/matrix_servers | 4 ++++ roles/custom/matrix-base/defaults/main.yml | 6 ++++++ .../templates/static-files/well-known/matrix-client.j2 | 8 ++------ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers index 114fc09f2..1273280ea 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -4018,6 +4018,8 @@ matrix_sliding_sync_environment_variable_syncv3_secret: "{{ '%s' | format(matrix matrix_sliding_sync_database_hostname: "{{ devture_postgres_connection_hostname if devture_postgres_enabled else '' }}" matrix_sliding_sync_database_password: "{{ '%s' | format(matrix_homeserver_generic_secret_key) | password_hash('sha512', 'ss.db', rounds=655555) | to_uuid }}" +matrix_homeserver_sliding_sync_url: "{{ matrix_sliding_sync_base_url if matrix_sliding_sync_enabled else matrix_homeserver_sliding_sync_url }}" + ###################################################################### # # /matrix-sliding-sync @@ -4107,6 +4109,8 @@ matrix_conduit_systemd_required_services_list: | (['docker.service']) }} +# Starting from version `0.6.0` conduit natively supports some sync v3 (sliding-sync) features. +matrix_homeserver_sliding_sync_url: "{{ matrix_homeserver_url if matrix_conduit_enabled and not matrix_sliding_sync_enabled else matrix_homeserver_sliding_sync_url }}" ###################################################################### # diff --git a/roles/custom/matrix-base/defaults/main.yml b/roles/custom/matrix-base/defaults/main.yml index 8642ace2d..bb0d579fb 100644 --- a/roles/custom/matrix-base/defaults/main.yml +++ b/roles/custom/matrix-base/defaults/main.yml @@ -150,6 +150,12 @@ matrix_homeserver_container_url: "" # This likely gets overriden elsewhere. matrix_homeserver_container_federation_url: "" +# Specifies the public url of the Sync v3 (sliding-sync) API. +# This will be used to set the `org.matrix.msc3575.proxy` property in `/.well-known/matrix/client`. +# Once the API is stabilized, this will no longer be required. +# See MSC3575: https://github.com/matrix-org/matrix-spec-proposals/blob/kegan/sync-v3/proposals/3575-sync.md +matrix_homeserver_sliding_sync_url: "" + matrix_identity_server_url: ~ matrix_integration_manager_rest_url: ~ diff --git a/roles/custom/matrix-base/templates/static-files/well-known/matrix-client.j2 b/roles/custom/matrix-base/templates/static-files/well-known/matrix-client.j2 index 549bfc8ae..96c301a89 100644 --- a/roles/custom/matrix-base/templates/static-files/well-known/matrix-client.j2 +++ b/roles/custom/matrix-base/templates/static-files/well-known/matrix-client.j2 @@ -26,13 +26,9 @@ "preferredDomain": {{ matrix_client_element_jitsi_preferred_domain|to_json }} } {% endif %} - {% if matrix_sliding_sync_enabled %}, + {% if matrix_homeserver_sliding_sync_url %}, "org.matrix.msc3575.proxy": { - "url": "{{ matrix_sliding_sync_base_url }}" - } - {% elif matrix_homeserver_implementation == 'conduit' %}, - "org.matrix.msc3575.proxy": { - "url": "{{ matrix_homeserver_url }}" + "url": "{{ matrix_homeserver_sliding_sync_url }}" } {% endif %} {% if matrix_client_element_location_sharing_enabled %}, From 28b736fc9d6b39c28165477dc9d73d769edd7818 Mon Sep 17 00:00:00 2001 From: Samuel Meenzen Date: Fri, 11 Aug 2023 08:30:22 +0000 Subject: [PATCH 3/4] docs: conduit sliding sync support --- docs/configuring-playbook-sliding-sync-proxy.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/configuring-playbook-sliding-sync-proxy.md b/docs/configuring-playbook-sliding-sync-proxy.md index a0eb36ba4..a7aab981c 100644 --- a/docs/configuring-playbook-sliding-sync-proxy.md +++ b/docs/configuring-playbook-sliding-sync-proxy.md @@ -12,6 +12,7 @@ Element X Android requires manual compilation to get it working with a non-`matr **NOTE**: The Sliding Sync proxy **only works with the Traefik reverse-proxy**. If you have an old server installation (from the time `matrix-nginx-proxy` was our default reverse-proxy - `matrix_playbook_reverse_proxy_type: playbook-managed-nginx`), you won't be able to use Sliding Sync. +**NOTE**: The sliding-sync proxy is **not required** when using the **Conduit homeserver**. Starting from version `0.6.0` Conduit has native support for some sliding sync features. If there are issues with the native implementation, you might have a better experience when enabling the sliding-sync proxy anyway. ## Decide on a domain and path From e01a6f29720577675242c36ff6b7efe6f7c26e44 Mon Sep 17 00:00:00 2001 From: Samuel Meenzen Date: Fri, 11 Aug 2023 08:46:03 +0000 Subject: [PATCH 4/4] fix: `recursive loop detected in template string` error --- group_vars/matrix_servers | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers index 1273280ea..5accdd85a 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -4018,7 +4018,8 @@ matrix_sliding_sync_environment_variable_syncv3_secret: "{{ '%s' | format(matrix matrix_sliding_sync_database_hostname: "{{ devture_postgres_connection_hostname if devture_postgres_enabled else '' }}" matrix_sliding_sync_database_password: "{{ '%s' | format(matrix_homeserver_generic_secret_key) | password_hash('sha512', 'ss.db', rounds=655555) | to_uuid }}" -matrix_homeserver_sliding_sync_url: "{{ matrix_sliding_sync_base_url if matrix_sliding_sync_enabled else matrix_homeserver_sliding_sync_url }}" +# Starting from version `0.6.0` conduit natively supports some sync v3 (sliding-sync) features. +matrix_homeserver_sliding_sync_url: "{{ matrix_sliding_sync_base_url if matrix_sliding_sync_enabled else matrix_homeserver_url if matrix_conduit_enabled else '' }}" ###################################################################### # @@ -4109,9 +4110,6 @@ matrix_conduit_systemd_required_services_list: | (['docker.service']) }} -# Starting from version `0.6.0` conduit natively supports some sync v3 (sliding-sync) features. -matrix_homeserver_sliding_sync_url: "{{ matrix_homeserver_url if matrix_conduit_enabled and not matrix_sliding_sync_enabled else matrix_homeserver_sliding_sync_url }}" - ###################################################################### # # /matrix-conduit