ソースを参照

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
pull/5494/head
Slavi Pantaleev 2日前
コミット
8f9f91cbd5
4個のファイルの変更20行の追加68行の削除
  1. +0
    -9
      group_vars/matrix_servers
  2. +0
    -21
      roles/custom/matrix-bridge-rustpush/defaults/main.yml
  3. +20
    -2
      roles/custom/matrix-bridge-rustpush/tasks/validate_config.yml
  4. +0
    -36
      roles/custom/matrix-bridge-rustpush/templates/labels.j2

+ 0
- 9
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 '' }}"



+ 0
- 21
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.
#


+ 20
- 2
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': '<removed> (the rustpush bridge does not support metrics)'}
- {'old': 'matrix_bridge_rustpush_metrics_proxying_enabled', 'new': '<removed> (the rustpush bridge does not support metrics)'}
- {'old': 'matrix_bridge_rustpush_metrics_proxying_hostname', 'new': '<removed> (the rustpush bridge does not support metrics)'}
- {'old': 'matrix_bridge_rustpush_metrics_proxying_path_prefix', 'new': '<removed> (the rustpush bridge does not support metrics)'}
- {'old': 'matrix_bridge_rustpush_container_labels_metrics_enabled', 'new': '<removed> (the rustpush bridge does not support metrics)'}
- {'old': 'matrix_bridge_rustpush_container_labels_metrics_traefik_rule', 'new': '<removed> (the rustpush bridge does not support metrics)'}
- {'old': 'matrix_bridge_rustpush_container_labels_metrics_traefik_priority', 'new': '<removed> (the rustpush bridge does not support metrics)'}
- {'old': 'matrix_bridge_rustpush_container_labels_metrics_traefik_entrypoints', 'new': '<removed> (the rustpush bridge does not support metrics)'}
- {'old': 'matrix_bridge_rustpush_container_labels_metrics_traefik_tls', 'new': '<removed> (the rustpush bridge does not support metrics)'}
- {'old': 'matrix_bridge_rustpush_container_labels_metrics_traefik_tls_certResolver', 'new': '<removed> (the rustpush bridge does not support metrics)'}
- {'old': 'matrix_bridge_rustpush_container_labels_metrics_middleware_basic_auth_enabled', 'new': '<removed> (the rustpush bridge does not support metrics)'}
- {'old': 'matrix_bridge_rustpush_container_labels_metrics_middleware_basic_auth_users', 'new': '<removed> (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 }}"}

+ 0
- 36
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 }}

読み込み中…
キャンセル
保存