From d48a70b0522a1757cfff150e0f470932b3f04479 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Sat, 13 Jan 2024 20:00:49 +0200 Subject: [PATCH] Connect matrix-synapse-auto-compressor directly to Postgres network, if integrated Postgres is used This saves us one container network in the ideal case. --- group_vars/matrix_servers | 11 +++-------- .../matrix-synapse-auto-compressor/defaults/main.yml | 5 ++++- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers index 29b1064f4..3feec75e9 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -4318,10 +4318,7 @@ matrix_synapse_auto_compressor_enabled: false matrix_synapse_auto_compressor_container_image_self_build: "{{ matrix_architecture not in ['amd64'] }}" -matrix_synapse_auto_compressor_container_additional_networks: | - {{ - ([devture_postgres_container_network] if devture_postgres_enabled and devture_postgres_container_network != matrix_synapse_auto_compressor_container_network else []) - }} +matrix_synapse_auto_compressor_container_network: "{{ (devture_postgres_container_network if (devture_postgres_enabled and matrix_synapse_auto_compressor_database_hostname == matrix_synapse_database_host and matrix_synapse_database_host == devture_postgres_connection_hostname) else 'matrix-synapse-auto-compressor') }}" matrix_synapse_auto_compressor_database_username: "{{ matrix_synapse_database_user if matrix_synapse_enabled else '' }}" matrix_synapse_auto_compressor_database_password: "{{ matrix_synapse_database_password if matrix_synapse_enabled else '' }}" @@ -4329,11 +4326,9 @@ matrix_synapse_auto_compressor_database_hostname: "{{ matrix_synapse_database_ho matrix_synapse_auto_compressor_database_port: "{{ matrix_synapse_database_port if matrix_synapse_enabled else '5432' }}" matrix_synapse_auto_compressor_database_name: "{{ matrix_synapse_database_database if matrix_synapse_enabled else '' }}" -matrix_synapse_auto_compressor_systemd_required_services_list: | +matrix_synapse_auto_compressor_systemd_required_services_list_auto: | {{ - ['docker.service'] - + - ([devture_postgres_identifier ~ '.service'] if devture_postgres_enabled else []) + ([devture_postgres_identifier ~ '.service'] if (matrix_synapse_auto_compressor_container_network == devture_postgres_container_network) else []) }} ###################################################################### diff --git a/roles/custom/matrix-synapse-auto-compressor/defaults/main.yml b/roles/custom/matrix-synapse-auto-compressor/defaults/main.yml index 4ad7887bd..20f52008b 100644 --- a/roles/custom/matrix-synapse-auto-compressor/defaults/main.yml +++ b/roles/custom/matrix-synapse-auto-compressor/defaults/main.yml @@ -31,7 +31,10 @@ matrix_synapse_auto_compressor_container_additional_networks: [] matrix_synapse_auto_compressor_container_extra_arguments: [] # List of systemd services that matrix-synapse-auto-compressor.service depends on -matrix_synapse_auto_compressor_systemd_required_services_list: ['docker.service'] +matrix_synapse_auto_compressor_systemd_required_services_list: "{{ matrix_synapse_auto_compressor_systemd_required_services_list_default + matrix_synapse_auto_compressor_systemd_required_services_list_auto + matrix_synapse_auto_compressor_systemd_required_services_list_custom }}" +matrix_synapse_auto_compressor_systemd_required_services_list_default: ['docker.service'] +matrix_synapse_auto_compressor_systemd_required_services_list_auto: [] +matrix_synapse_auto_compressor_systemd_required_services_list_custom: [] # List of systemd services that matrix-synapse-auto-compressor.service wants matrix_synapse_auto_compressor_systemd_wanted_services_list: []