From 4bb16fef54379374a3807b93dfde70b61b9825f0 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Thu, 14 Nov 2024 15:48:41 +0200 Subject: [PATCH] Increase default Traefik readTimeout for web/web-secure/matrix-federation entrypoints (60s -> 300s) to accommodate large/slow file uploads --- group_vars/matrix_servers | 4 +++ roles/custom/matrix-base/defaults/main.yml | 33 ++++++++++++++++++++-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers index 5cd5c200e..110f5cdc4 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -5942,6 +5942,10 @@ traefik_base_path: "{{ matrix_base_data_path }}/traefik" traefik_uid: "{{ matrix_user_uid }}" traefik_gid: "{{ matrix_user_gid }}" +# It's common for setups to deal with large file uploads which may take longer than the default readTimeout (60s). +# This override (for the `web` entrypoint) also cascades to overriding the `web-secure` entrypoint and the `matrix-federation` entrypoint. +traefik_config_entrypoint_web_transport_respondingTimeouts_readTimeout: 300s + traefik_additional_entrypoints_auto: | {{ ([matrix_playbook_public_matrix_federation_api_traefik_entrypoint_definition] if matrix_playbook_public_matrix_federation_api_traefik_entrypoint_enabled else []) diff --git a/roles/custom/matrix-base/defaults/main.yml b/roles/custom/matrix-base/defaults/main.yml index 13d52ced2..e7c7d8dac 100644 --- a/roles/custom/matrix-base/defaults/main.yml +++ b/roles/custom/matrix-base/defaults/main.yml @@ -267,11 +267,38 @@ matrix_playbook_public_matrix_federation_api_traefik_entrypoint_host_bind_port_u matrix_playbook_public_matrix_federation_api_traefik_entrypoint_config: "{{ (matrix_playbook_public_matrix_federation_api_traefik_entrypoint_config_default | combine (matrix_playbook_public_matrix_federation_api_traefik_entrypoint_config_auto)) | combine(matrix_playbook_public_matrix_federation_api_traefik_entrypoint_config_custom, recursive=True) }}" matrix_playbook_public_matrix_federation_api_traefik_entrypoint_config_http3_enabled: true matrix_playbook_public_matrix_federation_api_traefik_entrypoint_config_http3_advertisedPort: "{{ matrix_playbook_public_matrix_federation_api_traefik_entrypoint_port }}" # noqa var-naming +matrix_playbook_public_matrix_federation_api_traefik_entrypoint_config_transport_respondingTimeouts_readTimeout: "{{ traefik_config_entrypoint_web_secure_transport_respondingTimeouts_readTimeout }}" # noqa var-naming +matrix_playbook_public_matrix_federation_api_traefik_entrypoint_config_transport_respondingTimeouts_writeTimeout: "{{ traefik_config_entrypoint_web_secure_transport_respondingTimeouts_writeTimeout }}" # noqa var-naming +matrix_playbook_public_matrix_federation_api_traefik_entrypoint_config_transport_respondingTimeouts_idleTimeout: "{{ traefik_config_entrypoint_web_secure_transport_respondingTimeouts_idleTimeout }}" # noqa var-naming matrix_playbook_public_matrix_federation_api_traefik_entrypoint_config_default: | {{ - ({'http3': {'advertisedPort': matrix_playbook_public_matrix_federation_api_traefik_entrypoint_config_http3_advertisedPort | int}}) - if matrix_playbook_public_matrix_federation_api_traefik_entrypoint_config_http3_enabled - else {} + {} + + | combine( + ( + ( + { + 'http3': { + 'advertisedPort': matrix_playbook_public_matrix_federation_api_traefik_entrypoint_config_http3_advertisedPort | int + } + } + ) + if matrix_playbook_public_matrix_federation_api_traefik_entrypoint_config_http3_enabled + else {} + ) + ) + + | combine( + { + 'transport': { + 'respondingTimeouts': { + 'readTimeout': matrix_playbook_public_matrix_federation_api_traefik_entrypoint_config_transport_respondingTimeouts_readTimeout, + 'writeTimeout': matrix_playbook_public_matrix_federation_api_traefik_entrypoint_config_transport_respondingTimeouts_writeTimeout, + 'idleTimeout': matrix_playbook_public_matrix_federation_api_traefik_entrypoint_config_transport_respondingTimeouts_idleTimeout, + } + } + } + ) }} matrix_playbook_public_matrix_federation_api_traefik_entrypoint_config_auto: {} matrix_playbook_public_matrix_federation_api_traefik_entrypoint_config_custom: {}