From 8f9f91cbd548c190e390d0c876cb077f657cc6ca Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Tue, 4 Aug 2026 17:01:55 +0300 Subject: [PATCH] Remove dead metrics support from the rustpush bridge Bridges based on bridgev2 no longer expose a metrics endpoint, so the playbook was publishing a Traefik route which could only ever yield an HTTP 502. Related to https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/5487 --- group_vars/matrix_servers | 9 ----- .../matrix-bridge-rustpush/defaults/main.yml | 21 ----------- .../tasks/validate_config.yml | 22 ++++++++++-- .../templates/labels.j2 | 36 ------------------- 4 files changed, 20 insertions(+), 68 deletions(-) diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers index 2fd1fbbfa..2c237a194 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -1542,9 +1542,6 @@ matrix_bridge_rustpush_container_labels_traefik_docker_network: "{{ matrix_playb matrix_bridge_rustpush_container_labels_traefik_entrypoints: "{{ traefik_entrypoint_primary }}" matrix_bridge_rustpush_container_labels_traefik_tls_certResolver: "{{ traefik_certResolver_primary }}" -matrix_bridge_rustpush_container_labels_metrics_middleware_basic_auth_enabled: "{{ matrix_metrics_exposure_http_basic_auth_enabled }}" -matrix_bridge_rustpush_container_labels_metrics_middleware_basic_auth_users: "{{ matrix_metrics_exposure_http_basic_auth_users }}" - matrix_bridge_rustpush_appservice_token: "{{ (matrix_homeserver_generic_secret_key + ':imsg.as.token') | hash('sha512') | to_uuid }}" matrix_bridge_rustpush_homeserver_address: "{{ matrix_addons_homeserver_client_api_url }}" @@ -1563,12 +1560,6 @@ matrix_bridge_rustpush_double_puppet_secrets_auto: |- else {} }} -matrix_bridge_rustpush_metrics_enabled: "{{ prometheus_enabled or matrix_metrics_exposure_enabled }}" - -matrix_bridge_rustpush_metrics_proxying_enabled: "{{ matrix_bridge_rustpush_metrics_enabled and matrix_metrics_exposure_enabled }}" -matrix_bridge_rustpush_metrics_proxying_hostname: "{{ matrix_metrics_exposure_hostname }}" -matrix_bridge_rustpush_metrics_proxying_path_prefix: "{{ matrix_metrics_exposure_path_prefix }}/rustpush-bridge" - matrix_bridge_rustpush_database_hostname: "{{ postgres_connection_hostname if postgres_enabled else '' }}" matrix_bridge_rustpush_database_password: "{{ (matrix_homeserver_generic_secret_key + ':mau.imsg.db') | hash('sha512') | to_uuid if postgres_enabled else '' }}" diff --git a/roles/custom/matrix-bridge-rustpush/defaults/main.yml b/roles/custom/matrix-bridge-rustpush/defaults/main.yml index a6ecd1c4e..1299c75d6 100644 --- a/roles/custom/matrix-bridge-rustpush/defaults/main.yml +++ b/roles/custom/matrix-bridge-rustpush/defaults/main.yml @@ -77,17 +77,6 @@ matrix_bridge_rustpush_container_labels_traefik_docker_network: "{{ matrix_bridg matrix_bridge_rustpush_container_labels_traefik_entrypoints: web-secure matrix_bridge_rustpush_container_labels_traefik_tls_certResolver: default # noqa var-naming -# Controls whether labels will be added that expose metrics -matrix_bridge_rustpush_container_labels_metrics_enabled: "{{ matrix_bridge_rustpush_metrics_enabled and matrix_bridge_rustpush_metrics_proxying_enabled }}" -matrix_bridge_rustpush_container_labels_metrics_traefik_rule: "Host(`{{ matrix_bridge_rustpush_metrics_proxying_hostname }}`) && PathPrefix(`{{ matrix_bridge_rustpush_metrics_proxying_path_prefix }}`)" -matrix_bridge_rustpush_container_labels_metrics_traefik_priority: 0 -matrix_bridge_rustpush_container_labels_metrics_traefik_entrypoints: "{{ matrix_bridge_rustpush_container_labels_traefik_entrypoints }}" -matrix_bridge_rustpush_container_labels_metrics_traefik_tls: "{{ matrix_bridge_rustpush_container_labels_metrics_traefik_entrypoints != 'web' }}" -matrix_bridge_rustpush_container_labels_metrics_traefik_tls_certResolver: "{{ matrix_bridge_rustpush_container_labels_traefik_tls_certResolver }}" # noqa var-naming -matrix_bridge_rustpush_container_labels_metrics_middleware_basic_auth_enabled: false -# See: https://doc.traefik.io/traefik/middlewares/http/basicauth/#users -matrix_bridge_rustpush_container_labels_metrics_middleware_basic_auth_users: '' - # matrix_bridge_rustpush_container_labels_additional_labels contains a multiline string with additional labels to add to the container label file. # See `../templates/labels.j2` for details. # @@ -183,16 +172,6 @@ matrix_bridge_rustpush_provisioning_shared_secret: disable # Valid values: fatal, error, warn, info, debug, trace matrix_bridge_rustpush_logging_level: 'warn' -# Whether or not metrics endpoint should be enabled. -# Enabling them is usually enough for a local (in-container) Prometheus to consume them. -# If metrics need to be consumed by another (external) Prometheus server, consider exposing them via `matrix_bridge_rustpush_metrics_proxying_enabled`. -matrix_bridge_rustpush_metrics_enabled: false - -# Controls whether metrics should be exposed on a public URL. -matrix_bridge_rustpush_metrics_proxying_enabled: false -matrix_bridge_rustpush_metrics_proxying_hostname: '' -matrix_bridge_rustpush_metrics_proxying_path_prefix: '' - # Default configuration template which covers the generic use case. # You can customize it by controlling the various variables inside it. # diff --git a/roles/custom/matrix-bridge-rustpush/tasks/validate_config.yml b/roles/custom/matrix-bridge-rustpush/tasks/validate_config.yml index af7ab1ced..c74bc5884 100644 --- a/roles/custom/matrix-bridge-rustpush/tasks/validate_config.yml +++ b/roles/custom/matrix-bridge-rustpush/tasks/validate_config.yml @@ -5,6 +5,26 @@ --- +- name: (Deprecation) Catch and report renamed settings + ansible.builtin.fail: + msg: >- + Your configuration contains a variable, which now has a different name. + Please rename the variable (`{{ item.old }}` -> `{{ item.new }}`) on your configuration file (vars.yml). + when: "lookup('ansible.builtin.varnames', ('^' + item.old + '$'), wantlist=True) | length > 0" + with_items: + - {'old': 'matrix_bridge_rustpush_metrics_enabled', 'new': ' (the rustpush bridge does not support metrics)'} + - {'old': 'matrix_bridge_rustpush_metrics_proxying_enabled', 'new': ' (the rustpush bridge does not support metrics)'} + - {'old': 'matrix_bridge_rustpush_metrics_proxying_hostname', 'new': ' (the rustpush bridge does not support metrics)'} + - {'old': 'matrix_bridge_rustpush_metrics_proxying_path_prefix', 'new': ' (the rustpush bridge does not support metrics)'} + - {'old': 'matrix_bridge_rustpush_container_labels_metrics_enabled', 'new': ' (the rustpush bridge does not support metrics)'} + - {'old': 'matrix_bridge_rustpush_container_labels_metrics_traefik_rule', 'new': ' (the rustpush bridge does not support metrics)'} + - {'old': 'matrix_bridge_rustpush_container_labels_metrics_traefik_priority', 'new': ' (the rustpush bridge does not support metrics)'} + - {'old': 'matrix_bridge_rustpush_container_labels_metrics_traefik_entrypoints', 'new': ' (the rustpush bridge does not support metrics)'} + - {'old': 'matrix_bridge_rustpush_container_labels_metrics_traefik_tls', 'new': ' (the rustpush bridge does not support metrics)'} + - {'old': 'matrix_bridge_rustpush_container_labels_metrics_traefik_tls_certResolver', 'new': ' (the rustpush bridge does not support metrics)'} + - {'old': 'matrix_bridge_rustpush_container_labels_metrics_middleware_basic_auth_enabled', 'new': ' (the rustpush bridge does not support metrics)'} + - {'old': 'matrix_bridge_rustpush_container_labels_metrics_middleware_basic_auth_users', 'new': ' (the rustpush bridge does not support metrics)'} + - name: Fail if required RustPush settings not defined ansible.builtin.fail: msg: >- @@ -16,5 +36,3 @@ - {'name': 'matrix_bridge_rustpush_homeserver_token', when: true} - {'name': 'matrix_bridge_rustpush_database_hostname', when: "{{ matrix_bridge_rustpush_database_engine == 'postgres' }}"} - {'name': 'matrix_bridge_rustpush_container_network', when: true} - - {'name': 'matrix_bridge_rustpush_metrics_proxying_hostname', when: "{{ matrix_bridge_rustpush_metrics_proxying_enabled }}"} - - {'name': 'matrix_bridge_rustpush_metrics_proxying_path_prefix', when: "{{ matrix_bridge_rustpush_metrics_proxying_enabled }}"} diff --git a/roles/custom/matrix-bridge-rustpush/templates/labels.j2 b/roles/custom/matrix-bridge-rustpush/templates/labels.j2 index aef81b995..3fa11540a 100644 --- a/roles/custom/matrix-bridge-rustpush/templates/labels.j2 +++ b/roles/custom/matrix-bridge-rustpush/templates/labels.j2 @@ -12,42 +12,6 @@ traefik.enable=true traefik.docker.network={{ matrix_bridge_rustpush_container_labels_traefik_docker_network }} {% endif %} -traefik.http.services.matrix-rustpush-bridge-metrics.loadbalancer.server.port=8000 - -{% if matrix_bridge_rustpush_container_labels_metrics_enabled %} -############################################################ -# # -# Metrics # -# # -############################################################ - -{% if matrix_bridge_rustpush_container_labels_metrics_middleware_basic_auth_enabled %} -traefik.http.middlewares.matrix-rustpush-bridge-metrics-basic-auth.basicauth.users={{ matrix_bridge_rustpush_container_labels_metrics_middleware_basic_auth_users }} -traefik.http.routers.matrix-rustpush-bridge-metrics.middlewares=matrix-rustpush-bridge-metrics-basic-auth -{% endif %} - -traefik.http.routers.matrix-rustpush-bridge-metrics.rule={{ matrix_bridge_rustpush_container_labels_metrics_traefik_rule }} - -{% if matrix_bridge_rustpush_container_labels_metrics_traefik_priority | int > 0 %} -traefik.http.routers.matrix-rustpush-bridge-metrics.priority={{ matrix_bridge_rustpush_container_labels_metrics_traefik_priority }} -{% endif %} - -traefik.http.routers.matrix-rustpush-bridge-metrics.service=matrix-rustpush-bridge-metrics -traefik.http.routers.matrix-rustpush-bridge-metrics.entrypoints={{ matrix_bridge_rustpush_container_labels_metrics_traefik_entrypoints }} - -traefik.http.routers.matrix-rustpush-bridge-metrics.tls={{ matrix_bridge_rustpush_container_labels_metrics_traefik_tls | to_json }} -{% if matrix_bridge_rustpush_container_labels_metrics_traefik_tls %} -traefik.http.routers.matrix-rustpush-bridge-metrics.tls.certResolver={{ matrix_bridge_rustpush_container_labels_metrics_traefik_tls_certResolver }} -{% endif %} - -############################################################ -# # -# /Metrics # -# # -############################################################ -{% endif %} - - {% endif %} {{ matrix_bridge_rustpush_container_labels_additional_labels }}