Add _metrics_proxying_enabled variables to mautrix bridges

Related to https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/2427

`metrics_enabled` should only expose the metrics locally, on the
container network, so that a local Prometheus can consume them.

Exposing them publicly should be done via a separate toggle (`metrics_proxying_enabled`).
This is how all other roles work, so this makes these mautrix roles consistent with the rest.
This commit is contained in:
Slavi Pantaleev 2023-01-30 08:50:57 +02:00
parent cad83ddca6
commit d82d0ad84b
10 changed files with 150 additions and 107 deletions

View File

@ -47,8 +47,15 @@ matrix_mautrix_facebook_homeserver_token: ''
matrix_mautrix_facebook_federate_rooms: true matrix_mautrix_facebook_federate_rooms: true
# Whether or not metrics endpoint should be enabled. # 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_mautrix_facebook_metrics_proxying_enabled`.
matrix_mautrix_facebook_metrics_enabled: false matrix_mautrix_facebook_metrics_enabled: false
# Controls whether metrics should be proxied (exposed) on `matrix.DOMAIN/metrics/mautrix-facebook`.
# This will only work take effect if `matrix_nginx_proxy_proxy_matrix_metrics_enabled: true`.
# See the `matrix-nginx-proxy` role for details about enabling `matrix_nginx_proxy_proxy_matrix_metrics_enabled`.
matrix_mautrix_facebook_metrics_proxying_enabled: false
matrix_mautrix_facebook_bridge_permissions: | matrix_mautrix_facebook_bridge_permissions: |
{{ {{
{matrix_mautrix_facebook_homeserver_domain: 'user'} {matrix_mautrix_facebook_homeserver_domain: 'user'}

View File

@ -43,7 +43,9 @@
You can expose the container's port using the `matrix_mautrix_facebook_container_http_host_bind_port` variable. You can expose the container's port using the `matrix_mautrix_facebook_container_http_host_bind_port` variable.
when: "not matrix_nginx_proxy_enabled | default(False) | bool" when: "not matrix_nginx_proxy_enabled | default(False) | bool"
- name: Generate mautrix-facebook metrics proxying configuration for matrix-nginx-proxy (matrix.DOMAIN/metrics/mautrix-facebook) - when: matrix_mautrix_facebook_metrics_proxying_enabled | bool
block:
- name: Generate mautrix-facebook metrics proxying configuration for matrix-nginx-proxy (matrix.DOMAIN/metrics/mautrix-facebook)
ansible.builtin.set_fact: ansible.builtin.set_fact:
matrix_mautrix_facebook_nginx_metrics_configuration_block: | matrix_mautrix_facebook_nginx_metrics_configuration_block: |
location /metrics/mautrix-facebook { location /metrics/mautrix-facebook {
@ -56,9 +58,8 @@
return 404 "matrix-nginx-proxy is disabled and no host port was bound to the container, so metrics are unavailable"; return 404 "matrix-nginx-proxy is disabled and no host port was bound to the container, so metrics are unavailable";
{% endif %} {% endif %}
} }
when: matrix_mautrix_facebook_metrics_enabled | bool
- name: Register mautrix-facebook metrics proxying configuration with matrix-nginx-proxy (matrix.DOMAIN/metrics/mautrix-facebook) - name: Register mautrix-facebook metrics proxying configuration with matrix-nginx-proxy (matrix.DOMAIN/metrics/mautrix-facebook)
ansible.builtin.set_fact: ansible.builtin.set_fact:
matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks: | matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks: |
{{ {{
@ -66,4 +67,3 @@
+ +
[matrix_mautrix_facebook_nginx_metrics_configuration_block] [matrix_mautrix_facebook_nginx_metrics_configuration_block]
}} }}
when: matrix_mautrix_facebook_metrics_enabled | bool

View File

@ -48,8 +48,15 @@ matrix_mautrix_instagram_homeserver_token: ''
matrix_mautrix_instagram_federate_rooms: true matrix_mautrix_instagram_federate_rooms: true
# Whether or not metrics endpoint should be enabled. # 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_mautrix_instagram_metrics_proxying_enabled`.
matrix_mautrix_instagram_metrics_enabled: false matrix_mautrix_instagram_metrics_enabled: false
# Controls whether metrics should be proxied (exposed) on `matrix.DOMAIN/metrics/mautrix-instagram`.
# This will only work take effect if `matrix_nginx_proxy_proxy_matrix_metrics_enabled: true`.
# See the `matrix-nginx-proxy` role for details about enabling `matrix_nginx_proxy_proxy_matrix_metrics_enabled`.
matrix_mautrix_instagram_metrics_proxying_enabled: false
# Database-related configuration fields. # Database-related configuration fields.
# #
# To use Postgres: # To use Postgres:

View File

@ -9,7 +9,9 @@
so that the matrix-nginx-proxy role would run after the matrix-bridge-mautrix-instagram role. so that the matrix-nginx-proxy role would run after the matrix-bridge-mautrix-instagram role.
when: matrix_nginx_proxy_role_executed | default(False) | bool when: matrix_nginx_proxy_role_executed | default(False) | bool
- name: Generate mautrix-instagram metrics proxying configuration for matrix-nginx-proxy (matrix.DOMAIN/metrics/mautrix-instagram) - when: matrix_mautrix_instagram_metrics_proxying_enabled | bool
block:
- name: Generate mautrix-instagram metrics proxying configuration for matrix-nginx-proxy (matrix.DOMAIN/metrics/mautrix-instagram)
ansible.builtin.set_fact: ansible.builtin.set_fact:
matrix_mautrix_instagram_nginx_metrics_configuration_block: | matrix_mautrix_instagram_nginx_metrics_configuration_block: |
location /metrics/mautrix-instagram { location /metrics/mautrix-instagram {
@ -23,7 +25,7 @@
{% endif %} {% endif %}
} }
- name: Register mautrix-instagram metrics proxying configuration with matrix-nginx-proxy (matrix.DOMAIN/metrics/mautrix-instagram) - name: Register mautrix-instagram metrics proxying configuration with matrix-nginx-proxy (matrix.DOMAIN/metrics/mautrix-instagram)
ansible.builtin.set_fact: ansible.builtin.set_fact:
matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks: | matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks: |
{{ {{

View File

@ -71,8 +71,15 @@ matrix_mautrix_signal_logging_level: WARNING
matrix_mautrix_signal_federate_rooms: true matrix_mautrix_signal_federate_rooms: true
# Whether or not metrics endpoint should be enabled. # 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_mautrix_signal_metrics_proxying_enabled`.
matrix_mautrix_signal_metrics_enabled: false matrix_mautrix_signal_metrics_enabled: false
# Controls whether metrics should be proxied (exposed) on `matrix.DOMAIN/metrics/mautrix-signal`.
# This will only work take effect if `matrix_nginx_proxy_proxy_matrix_metrics_enabled: true`.
# See the `matrix-nginx-proxy` role for details about enabling `matrix_nginx_proxy_proxy_matrix_metrics_enabled`.
matrix_mautrix_signal_metrics_proxying_enabled: false
# Database-related configuration fields # Database-related configuration fields
# #
# This bridge only supports postgres. # This bridge only supports postgres.

View File

@ -9,7 +9,9 @@
so that the matrix-nginx-proxy role would run after the matrix-bridge-mautrix-signal role. so that the matrix-nginx-proxy role would run after the matrix-bridge-mautrix-signal role.
when: matrix_nginx_proxy_role_executed | default(False) | bool when: matrix_nginx_proxy_role_executed | default(False) | bool
- name: Generate mautrix-signal metrics proxying configuration for matrix-nginx-proxy (matrix.DOMAIN/metrics/mautrix-signal) - when: matrix_mautrix_signal_metrics_proxying_enabled | bool
block:
- name: Generate mautrix-signal metrics proxying configuration for matrix-nginx-proxy (matrix.DOMAIN/metrics/mautrix-signal)
ansible.builtin.set_fact: ansible.builtin.set_fact:
matrix_mautrix_signal_nginx_metrics_configuration_block: | matrix_mautrix_signal_nginx_metrics_configuration_block: |
location /metrics/mautrix-signal { location /metrics/mautrix-signal {
@ -23,7 +25,7 @@
{% endif %} {% endif %}
} }
- name: Register mautrix-signal metrics proxying configuration with matrix-nginx-proxy (matrix.DOMAIN/metrics/mautrix-signal) - name: Register mautrix-signal metrics proxying configuration with matrix-nginx-proxy (matrix.DOMAIN/metrics/mautrix-signal)
ansible.builtin.set_fact: ansible.builtin.set_fact:
matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks: | matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks: |
{{ {{

View File

@ -79,8 +79,15 @@ matrix_mautrix_twitter_appservice_bot_username: twitterbot
matrix_mautrix_twitter_logging_level: WARNING matrix_mautrix_twitter_logging_level: WARNING
# Whether or not metrics endpoint should be enabled. # 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_mautrix_twitter_metrics_proxying_enabled`.
matrix_mautrix_twitter_metrics_enabled: false matrix_mautrix_twitter_metrics_enabled: false
# Controls whether metrics should be proxied (exposed) on `matrix.DOMAIN/metrics/mautrix-twitter`.
# This will only work take effect if `matrix_nginx_proxy_proxy_matrix_metrics_enabled: true`.
# See the `matrix-nginx-proxy` role for details about enabling `matrix_nginx_proxy_proxy_matrix_metrics_enabled`.
matrix_mautrix_twitter_metrics_proxying_enabled: false
# Default configuration template which covers the generic use case. # Default configuration template which covers the generic use case.
# You can customize it by controlling the various variables inside it. # You can customize it by controlling the various variables inside it.
# #

View File

@ -9,7 +9,9 @@
so that the matrix-nginx-proxy role would run after the matrix-bridge-mautrix-twitter role. so that the matrix-nginx-proxy role would run after the matrix-bridge-mautrix-twitter role.
when: matrix_nginx_proxy_role_executed | default(False) | bool when: matrix_nginx_proxy_role_executed | default(False) | bool
- name: Generate mautrix-twitter metrics proxying configuration for matrix-nginx-proxy (matrix.DOMAIN/metrics/mautrix-twitter) - when: matrix_mautrix_twitter_metrics_proxying_enabled | bool
block:
- name: Generate mautrix-twitter metrics proxying configuration for matrix-nginx-proxy (matrix.DOMAIN/metrics/mautrix-twitter)
ansible.builtin.set_fact: ansible.builtin.set_fact:
matrix_mautrix_twitter_nginx_metrics_configuration_block: | matrix_mautrix_twitter_nginx_metrics_configuration_block: |
location /metrics/mautrix-twitter { location /metrics/mautrix-twitter {
@ -23,7 +25,7 @@
{% endif %} {% endif %}
} }
- name: Register mautrix-twitter metrics proxying configuration with matrix-nginx-proxy (matrix.DOMAIN/metrics/mautrix-twitter) - name: Register mautrix-twitter metrics proxying configuration with matrix-nginx-proxy (matrix.DOMAIN/metrics/mautrix-twitter)
ansible.builtin.set_fact: ansible.builtin.set_fact:
matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks: | matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks: |
{{ {{

View File

@ -48,8 +48,15 @@ matrix_mautrix_whatsapp_logging_level: 'warn'
matrix_mautrix_whatsapp_federate_rooms: true matrix_mautrix_whatsapp_federate_rooms: true
# Whether or not metrics endpoint should be enabled. # 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_mautrix_whatsapp_metrics_proxying_enabled`.
matrix_mautrix_whatsapp_metrics_enabled: false matrix_mautrix_whatsapp_metrics_enabled: false
# Controls whether metrics should be proxied (exposed) on `matrix.DOMAIN/metrics/mautrix-whatsapp`.
# This will only work take effect if `matrix_nginx_proxy_proxy_matrix_metrics_enabled: true`.
# See the `matrix-nginx-proxy` role for details about enabling `matrix_nginx_proxy_proxy_matrix_metrics_enabled`.
matrix_mautrix_whatsapp_metrics_proxying_enabled: false
# Database-related configuration fields. # Database-related configuration fields.
# #
# To use SQLite, stick to these defaults. # To use SQLite, stick to these defaults.

View File

@ -9,7 +9,9 @@
so that the matrix-nginx-proxy role would run after the matrix-bridge-mautrix-whatsapp role. so that the matrix-nginx-proxy role would run after the matrix-bridge-mautrix-whatsapp role.
when: matrix_nginx_proxy_role_executed | default(False) | bool when: matrix_nginx_proxy_role_executed | default(False) | bool
- name: Generate mautrix-whatsapp metrics proxying configuration for matrix-nginx-proxy (matrix.DOMAIN/metrics/mautrix-whatsapp) - when: matrix_mautrix_whatsapp_metrics_proxying_enabled | bool
block:
- name: Generate mautrix-whatsapp metrics proxying configuration for matrix-nginx-proxy (matrix.DOMAIN/metrics/mautrix-whatsapp)
ansible.builtin.set_fact: ansible.builtin.set_fact:
matrix_mautrix_whatsapp_nginx_metrics_configuration_block: | matrix_mautrix_whatsapp_nginx_metrics_configuration_block: |
location /metrics/mautrix-whatsapp { location /metrics/mautrix-whatsapp {
@ -23,7 +25,7 @@
{% endif %} {% endif %}
} }
- name: Register mautrix-whatsapp metrics proxying configuration with matrix-nginx-proxy (matrix.DOMAIN/metrics/mautrix-whatsapp) - name: Register mautrix-whatsapp metrics proxying configuration with matrix-nginx-proxy (matrix.DOMAIN/metrics/mautrix-whatsapp)
ansible.builtin.set_fact: ansible.builtin.set_fact:
matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks: | matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks: |
{{ {{