From 499e4887f74544dd5b70bc83a4928e682d4ffdd6 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Fri, 5 Jan 2024 06:28:42 +0200 Subject: [PATCH] Connect sliding-sync directly to the homeserver This saves up 1 container network and avoids going through extra proxies unnecessarily. --- group_vars/matrix_servers | 3 +++ roles/custom/matrix-sliding-sync/defaults/main.yml | 4 ++-- roles/custom/matrix-sliding-sync/tasks/validate_config.yml | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers index 508ea8a92..b3cffe8a7 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -4382,6 +4382,8 @@ matrix_sliding_sync_path_prefix: /sliding-sync matrix_sliding_sync_container_image_self_build: "{{ matrix_architecture not in ['amd64', 'arm64'] }}" +matrix_sliding_sync_container_network: "{{ matrix_homeserver_container_network }}" + matrix_sliding_sync_container_additional_networks: | {{ ( @@ -4405,6 +4407,7 @@ matrix_sliding_sync_systemd_required_services_list_auto: | ([devture_postgres_identifier ~ '.service'] if (devture_postgres_enabled and matrix_sliding_sync_database_hostname == devture_postgres_connection_hostname) else []) }} +matrix_sliding_sync_environment_variable_syncv3_server: "{{ matrix_homeserver_container_url }}" matrix_sliding_sync_environment_variable_syncv3_secret: "{{ '%s' | format(matrix_homeserver_generic_secret_key) | password_hash('sha512', 'ss.secret', rounds=655555) | to_uuid }}" matrix_sliding_sync_database_hostname: "{{ devture_postgres_connection_hostname if devture_postgres_enabled else '' }}" diff --git a/roles/custom/matrix-sliding-sync/defaults/main.yml b/roles/custom/matrix-sliding-sync/defaults/main.yml index 541070837..b2966f9cf 100644 --- a/roles/custom/matrix-sliding-sync/defaults/main.yml +++ b/roles/custom/matrix-sliding-sync/defaults/main.yml @@ -31,7 +31,7 @@ matrix_sliding_sync_container_image_force_pull: "{{ matrix_sliding_sync_containe matrix_sliding_sync_container_image_registry_prefix: ghcr.io/ # The base container network. It will be auto-created by this role if it doesn't exist already. -matrix_sliding_sync_container_network: matrix-sliding-sync +matrix_sliding_sync_container_network: '' # A list of additional container networks that the container would be connected to. # The role does not create these networks, so make sure they already exist. @@ -81,7 +81,7 @@ matrix_sliding_sync_systemd_required_services_list_custom: [] matrix_sliding_sync_systemd_wanted_services_list: [] # Controls the SYNCV3_SERVER environment variable -matrix_sliding_sync_environment_variable_syncv3_server: "{{ matrix_homeserver_container_url }}" +matrix_sliding_sync_environment_variable_syncv3_server: "" # Controls the SYNCV3_SECRET environment variable matrix_sliding_sync_environment_variable_syncv3_secret: '' diff --git a/roles/custom/matrix-sliding-sync/tasks/validate_config.yml b/roles/custom/matrix-sliding-sync/tasks/validate_config.yml index 5d36403ce..08a6e409a 100644 --- a/roles/custom/matrix-sliding-sync/tasks/validate_config.yml +++ b/roles/custom/matrix-sliding-sync/tasks/validate_config.yml @@ -8,4 +8,6 @@ - matrix_sliding_sync_hostname - matrix_sliding_sync_path_prefix - matrix_sliding_sync_database_hostname + - matrix_sliding_sync_environment_variable_syncv3_server - matrix_sliding_sync_environment_variable_syncv3_secret + - matrix_sliding_sync_container_network