From 5cad57129632bca297a0c4e905dabb21cda1263b Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Thu, 14 Nov 2024 15:51:03 +0200 Subject: [PATCH] Add variables & wiring to support Traefik's compression middleware This merely hooks the playbook to the Traefik role's compression middleware configuration (`traefik_config_http_middlewares_compression_*`) The Traefik role enables the `compression` middleware by default. Actual usage will land in a future commit. --- group_vars/matrix_servers | 3 +++ roles/custom/matrix-base/defaults/main.yml | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers index 110f5cdc4..d5ff7483d 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -35,6 +35,9 @@ matrix_playbook_traefik_labels_enabled: "{{ matrix_playbook_reverse_proxy_type i matrix_playbook_reverse_proxy_container_network: "{{ traefik_container_network if traefik_enabled else 'traefik' }}" matrix_playbook_reverse_proxy_hostname: "{{ traefik_identifier if traefik_enabled else 'traefik' }}" +matrix_playbook_reverse_proxy_traefik_middleware_compession_enabled: "{{ traefik_config_http_middlewares_compression_enabled if (traefik_enabled and traefik_config_http_middlewares_compression_enabled) else false }}" +matrix_playbook_reverse_proxy_traefik_middleware_compession_name: "{{ (traefik_config_http_middlewares_compression_middleware_name + '@file') if traefik_enabled else '' }}" + # A separate Matrix Federation entrypoint is always enabled, unless the federation port matches one of the ports for existing (default) entrypoints matrix_playbook_public_matrix_federation_api_traefik_entrypoint_enabled: "{{ matrix_federation_public_port not in [traefik_config_entrypoint_web_port, traefik_config_entrypoint_web_secure_port] }}" diff --git a/roles/custom/matrix-base/defaults/main.yml b/roles/custom/matrix-base/defaults/main.yml index e7c7d8dac..e3152edb4 100644 --- a/roles/custom/matrix-base/defaults/main.yml +++ b/roles/custom/matrix-base/defaults/main.yml @@ -239,6 +239,13 @@ matrix_playbook_reverse_proxy_container_network: 'traefik' # Specifies the hostname that the reverse-proxy is available at matrix_playbook_reverse_proxy_hostname: 'matrix-traefik' +# Specifies whether the Traefik reverse-proxy (if `matrix_playbook_reverse_proxy_type` indicates that Traefik is being used) defines a compression middleware. +matrix_playbook_reverse_proxy_traefik_middleware_compession_enabled: false + +# Specifies the name of the compression middleware defined for the Traefik reverse-proxy (if `matrix_playbook_reverse_proxy_type` indicates that Traefik is being used). +# It's better to use a fully-qualified middleware name (e.g. `compression@docker` or `compression@file`) here to prevent ambiguity. +matrix_playbook_reverse_proxy_traefik_middleware_compession_name: '' + # Controls the additional network that reverse-proxyable services will be connected to. matrix_playbook_reverse_proxyable_services_additional_network: "{{ matrix_playbook_reverse_proxy_container_network }}"