From 4d9de7d58a4392252d528c4575baa50a4bd56eb6 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Thu, 25 Jul 2024 20:24:04 +0300 Subject: [PATCH] Add `matrix_synapse_usage_exporter_hostname` and `matrix_synapse_usage_exporter_path_prefix` Related to https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/3442 --- .../configuring-playbook-synapse-usage-exporter.md | 3 ++- .../defaults/main.yml | 14 +++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/docs/configuring-playbook-synapse-usage-exporter.md b/docs/configuring-playbook-synapse-usage-exporter.md index 9f962a7c5..a67becdf4 100644 --- a/docs/configuring-playbook-synapse-usage-exporter.md +++ b/docs/configuring-playbook-synapse-usage-exporter.md @@ -8,7 +8,7 @@ Enabling this service will automatically: - install the synapse-usage-exporter service - re-configure Synapse to push (via HTTP `PUT`) usage statistics information to synapse-usage-exporter -- re-configure [Prometheus](./configuring-playbook-prometheus-grafana.md) (if Grafana is enabled), to periodically scrape metrics from synapse-usage-exporter +- re-configure [Prometheus](./configuring-playbook-prometheus-grafana.md) (if Prometheus is enabled), to periodically scrape metrics from synapse-usage-exporter - add a new [Grafana](./configuring-playbook-prometheus-grafana.md) dashboard (if Grafana is enabled) containing Synapse usage statistics ## Quickstart @@ -21,5 +21,6 @@ matrix_synapse_usage_exporter_enabled: true # (Optional) Expose endpoint if you want to collect statistics from outside (from other homeservers). # If enabled, synapse-usage-exporter will be exposed publicly at `matrix.DOMAIN/report-usage-stats/push`. # When collecting usage statistics for Synapse running on the same host, you don't need to enable this. +# You can adjust the hostname and path via `matrix_synapse_usage_exporter_hostname` and `matrix_synapse_usage_exporter_path_prefix`. # matrix_synapse_usage_exporter_proxying_enabled: true ``` diff --git a/roles/custom/matrix-synapse-usage-exporter/defaults/main.yml b/roles/custom/matrix-synapse-usage-exporter/defaults/main.yml index 991218645..c207e4b1c 100644 --- a/roles/custom/matrix-synapse-usage-exporter/defaults/main.yml +++ b/roles/custom/matrix-synapse-usage-exporter/defaults/main.yml @@ -5,6 +5,11 @@ matrix_synapse_usage_exporter_enabled: false +# Controls the hostname and path that this component exposes its web services on. +# Only used if `matrix_synapse_usage_exporter_proxying_enabled` is true. +matrix_synapse_usage_exporter_hostname: "{{ matrix_server_fqn_matrix }}" +matrix_synapse_usage_exporter_path_prefix: /report-usage-stats/push + # matrix_synapse_usage_exporter_identifier controls the identifier of this synapse-usage-exporter instance, which influences: # - the default storage path # - the names of systemd services and containers @@ -44,7 +49,10 @@ matrix_synapse_usage_exporter_container_additional_networks: [] # Extra arguments for the Docker container matrix_synapse_usage_exporter_container_extra_arguments: [] -# Controls whether the synapse usage exporter should be proxied (exposed) on `matrix.DOMAIN/report-usage-stats/push` +# Controls whether the synapse-usage-exporter's web services should be proxied (exposed publicly). +# +# Exposure happens on `matrix.DOMAIN/report-usage-stats/push` by default. +# See: `matrix_synapse_usage_exporter_hostname` and `matrix_synapse_usage_exporter_path_prefix`. matrix_synapse_usage_exporter_proxying_enabled: false # matrix_synapse_usage_exporter_container_labels_traefik_enabled controls whether labels to assist a Traefik reverse-proxy will be attached to the container. @@ -54,8 +62,8 @@ matrix_synapse_usage_exporter_proxying_enabled: false matrix_synapse_usage_exporter_container_labels_traefik_enabled: "{{ matrix_synapse_usage_exporter_proxying_enabled }}" matrix_synapse_usage_exporter_container_labels_traefik_docker_network: "{{ matrix_synapse_usage_exporter_container_network }}" -matrix_synapse_usage_exporter_container_labels_traefik_path_prefix: "/report-usage-stats/push" -matrix_synapse_usage_exporter_container_labels_traefik_rule: "Host(`{{ matrix_server_fqn_matrix }}`) && PathPrefix(`{{ matrix_synapse_usage_exporter_container_labels_traefik_path_prefix | quote }}`)" +matrix_synapse_usage_exporter_container_labels_traefik_path_prefix: "{{ matrix_synapse_usage_exporter_path_prefix }}" +matrix_synapse_usage_exporter_container_labels_traefik_rule: "Host(`{{ matrix_synapse_usage_exporter_hostname }}`) && PathPrefix(`{{ matrix_synapse_usage_exporter_container_labels_traefik_path_prefix }}`)" matrix_synapse_usage_exporter_container_labels_traefik_priority: 0 matrix_synapse_usage_exporter_container_labels_traefik_entrypoints: "web-secure" matrix_synapse_usage_exporter_container_labels_traefik_tls: "{{ matrix_synapse_usage_exporter_container_labels_traefik_entrypoints != 'web' }}"