From c79f354dcee577d1b4856e0f5c714d826c6f15c7 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Sat, 13 Jan 2024 17:56:53 +0200 Subject: [PATCH] Move Dimension to the addons network and connect to Homeserver via matrix_addons_homeserver_client_api_url --- group_vars/matrix_servers | 31 +++++++++++-------- .../custom/matrix-dimension/defaults/main.yml | 5 ++- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers index d3e2abcad..3f3dbefe3 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -2815,19 +2815,22 @@ matrix_dimension_enabled: false matrix_dimension_container_image_self_build: "{{ matrix_architecture != 'amd64' }}" matrix_dimension_scheme: "{{ 'https' if matrix_playbook_ssl_enabled else 'http' }}" - matrix_dimension_hostname: "{{ matrix_server_fqn_dimension }}" -matrix_dimension_container_network: "{{ matrix_nginx_proxy_container_network if matrix_playbook_reverse_proxy_type == 'playbook-managed-nginx' else 'matrix-dimension' }}" +matrix_dimension_container_network: "{{ matrix_addons_container_network }}" +# Dimension is connected both to `matrix_addons_homeserver_container_network` and `matrix_homeserver_container_network`, +# because these may be different networks on which `matrix_addons_homeserver_client_api_url` and `matrix_homeserver_container_federation_url` live. matrix_dimension_container_additional_networks: | {{ ( - ([matrix_playbook_reverse_proxyable_services_additional_network] if matrix_playbook_reverse_proxyable_services_additional_network else []) + ([] if matrix_addons_homeserver_container_network == '' else [matrix_addons_homeserver_container_network]) + ([matrix_homeserver_container_network] if matrix_homeserver_container_network != matrix_dimension_container_network else []) + - ([devture_postgres_container_network] if devture_postgres_enabled and devture_postgres_container_network != matrix_dimension_container_network else []) + ([devture_postgres_container_network] if (devture_postgres_enabled and matrix_dimension_database_hostname == devture_postgres_connection_hostname and devture_postgres_container_network != matrix_dimension_container_network) else []) + + + ([matrix_playbook_reverse_proxyable_services_additional_network] if matrix_playbook_reverse_proxyable_services_additional_network else []) ) | unique }} @@ -2838,19 +2841,21 @@ matrix_dimension_container_labels_traefik_docker_network: "{{ matrix_playbook_re matrix_dimension_container_labels_traefik_entrypoints: "{{ devture_traefik_entrypoint_primary }}" matrix_dimension_container_labels_traefik_tls_certResolver: "{{ devture_traefik_certResolver_primary }}" -matrix_dimension_homeserver_clientServerUrl: "{{ matrix_homeserver_container_url }}" +matrix_dimension_homeserver_clientServerUrl: "{{ matrix_addons_homeserver_client_api_url }}" matrix_dimension_homeserver_federationUrl: "{{ matrix_homeserver_container_federation_url }}" matrix_dimension_homeserver_mediaUrl: "https://{{ matrix_server_fqn_matrix }}" -matrix_dimension_systemd_required_services_list: | +# Dimension depends both on `matrix_addons_homeserver_systemd_services_list` and on the homeserver service, +# because these are potentially different, depending on whether matrix-homeserver-proxy is enabled, etc. +matrix_dimension_systemd_required_services_list_auto: | {{ - ['docker.service'] - + - ['matrix-' + matrix_homeserver_implementation + '.service'] - + - ([devture_postgres_identifier ~ '.service'] if devture_postgres_enabled else []) - + - (['matrix-nginx-proxy.service'] if matrix_nginx_proxy_enabled else []) + ( + matrix_addons_homeserver_systemd_services_list + + + ['matrix-' + matrix_homeserver_implementation + '.service'] + + + ([devture_postgres_identifier ~ '.service'] if (devture_postgres_enabled and matrix_dimension_database_hostname == devture_postgres_connection_hostname) else []) + ) | unique }} # Postgres is the default, except if not using internal Postgres server diff --git a/roles/custom/matrix-dimension/defaults/main.yml b/roles/custom/matrix-dimension/defaults/main.yml index 718b5d868..7acdacf03 100644 --- a/roles/custom/matrix-dimension/defaults/main.yml +++ b/roles/custom/matrix-dimension/defaults/main.yml @@ -36,7 +36,10 @@ matrix_dimension_docker_image_name_prefix: "{{ 'localhost/' if matrix_dimension_ matrix_dimension_docker_image_force_pull: "{{ matrix_dimension_docker_image.endswith(':latest') }}" # List of systemd services that matrix-dimension.service depends on. -matrix_dimension_systemd_required_services_list: ['docker.service'] +matrix_dimension_systemd_required_services_list: "{{ matrix_dimension_systemd_required_services_list_default + matrix_dimension_systemd_required_services_list_auto + matrix_dimension_systemd_required_services_list_custom }}" +matrix_dimension_systemd_required_services_list_default: ['docker.service'] +matrix_dimension_systemd_required_services_list_auto: [] +matrix_dimension_systemd_required_services_list_custom: [] # List of systemd services that matrix-dimension.service wants matrix_dimension_systemd_wanted_services_list: []