diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers index f63b25809..a2d5da411 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -4465,6 +4465,12 @@ matrix_synapse_password_config_enabled: "{{ not matrix_synapse_matrix_authentica matrix_synapse_register_user_script_matrix_authentication_service_path: "{{ matrix_authentication_service_bin_path }}/register-user" +# After Synapse's systemd health check passes, the reverse proxy still needs time to +# discover the container and register its routes. We derive this delay from Traefik's +# providers.providersThrottleDuration setting (+1s grace for our healthcheck polling interval), +# so it stays in sync automatically. +matrix_synapse_systemd_service_post_start_delay_seconds: "{{ (traefik_config_providers_providersThrottleDuration_seconds | int + 1) if matrix_playbook_reverse_proxy_type in ['playbook-managed-traefik', 'other-traefik-container'] else 0 }}" + ###################################################################### # # /matrix-synapse diff --git a/roles/custom/matrix-synapse/defaults/main.yml b/roles/custom/matrix-synapse/defaults/main.yml index 703b0bf84..7a142fa3c 100644 --- a/roles/custom/matrix-synapse/defaults/main.yml +++ b/roles/custom/matrix-synapse/defaults/main.yml @@ -335,7 +335,8 @@ matrix_synapse_container_labels_additional_labels: '' # (see matrix_synapse_systemd_healthcheck_enabled) detect readiness faster at startup. # # For non-Traefik setups, we use the default healthcheck interval (15s) to decrease overhead. -matrix_synapse_container_health_interval: "{{ '5s' if matrix_synapse_container_labels_traefik_enabled else '15s' }}" +matrix_synapse_container_health_interval_seconds: "{{ 5 if matrix_synapse_container_labels_traefik_enabled else 15 }}" +matrix_synapse_container_health_interval: "{{ matrix_synapse_container_health_interval_seconds }}s" # A list of extra arguments to pass to the container # Also see `matrix_synapse_container_arguments` @@ -397,13 +398,13 @@ matrix_synapse_systemd_healthcheck_command: >- # Controls how long to sleep for after the systemd health check passes. # Even after Synapse is healthy, the reverse proxy (e.g. Traefik) needs time to discover -# the container and register its routes. Traefik's `providers.providersThrottleDuration` -# (default: 2s; see https://doc.traefik.io/traefik/providers/overview/#providersthrottleduration) -# adds a delay before applying new configuration from Docker events, meaning routes -# typically become available ~2-3 seconds after a container starts. +# the container and register its routes. Traefik waits `providers.providersThrottleDuration` +# (see https://doc.traefik.io/traefik/v3.3/providers/overview/#providersprovidersthrottleduration) +# before applying new configuration from Docker events. # Without this delay, services depending on Synapse may encounter 404 errors # when connecting through the reverse proxy. -matrix_synapse_systemd_service_post_start_delay_seconds: 10 +# This value is meant to be wired to the Traefik throttle duration by the playbook's group vars. +matrix_synapse_systemd_service_post_start_delay_seconds: 0 matrix_synapse_in_container_python_packages_path: "/usr/local/lib/python3.13/site-packages"