Skip to content

Commit 597738e

Browse files
committed
# Conflicts: # setup.yml
2 parents cfca16f + ba04bac commit 597738e

File tree

32 files changed

+3396
-117
lines changed

32 files changed

+3396
-117
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
# 2024-07-25
2+
3+
## synapse-usage-exporter support
4+
5+
Thanks to [Michael Hollister](https://github.com/Michael-Hollister) from [FUTO](https://www.futo.org/), the creators of the [Circles app](https://circu.li/), the playbook can now set up [synapse-usage-exporter](https://github.com/loelkes/synapse-usage-exporter) - a small [Flask](https://flask.palletsprojects.com)-based webservice which can capture usage statistics from Synapse (via HTTP `PUT`) and then make them available for Prometheus to scrape.
6+
7+
To learn more see our [Enabling synapse-usage-exporter for Synapse usage statistics](docs/configuring-playbook-synapse-usage-exporter.md) documentation page.
8+
9+
110
# 2024-07-06
211

312
## matrix-alertmanager-receiver support

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ Services that help you in administrating and monitoring your matrix installation
157157
| Metrics and Graphs | x | Consists of the [Prometheus](https://prometheus.io) time-series database server, the Prometheus [node-exporter](https://prometheus.io/docs/guides/node-exporter/) host metrics exporter, and the [Grafana](https://grafana.com/) web UI | [Link](docs/configuring-playbook-prometheus-grafana.md) |
158158
| [Borg](https://borgbackup.org) | x | Backups | [Link](docs/configuring-playbook-backup-borg.md) |
159159
| [Rageshake](https://github.com/matrix-org/rageshake) | x | Bug report server | [Link](docs/configuring-playbook-rageshake.md) |
160+
| [synapse-usage-exporter](https://github.com/loelkes/synapse-usage-exporter) | x | Export the usage statistics of a Synapse homeserver to be scraped by Prometheus. | [Link](docs/configuring-playbook-synapse-usage-exporter.md) |
160161

161162
### Misc
162163

docs/configuring-playbook-matrix-media-repo.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ matrix_media_repo_enabled: true
2323
# matrix_media_repo_metrics_enabled: true
2424
```
2525

26-
The repo is pre-configured for integrating with the Postgres database, NGINX proxy and [Prometheus/Grafana](configuring-playbook-prometheus-grafana.md) (if metrics enabled) from this playbook for all the available homeserver roles. When the media repo is enabled, other media store roles should be disabled (if using Synapse with other media store roles).
26+
The repo is pre-configured for integrating with the Postgres database, Traefik proxy and [Prometheus/Grafana](configuring-playbook-prometheus-grafana.md) (if metrics enabled) from this playbook for all the available homeserver roles. When the media repo is enabled, other media store roles should be disabled (if using Synapse with other media store roles).
2727

28-
By default, the media-repo will use the local filesystem for data storage. Additional options include `s3` and `IPFS` (experimental). Access token caching is also enabled by default since the logout endpoints are proxied through the media repo.
28+
By default, the media-repo will use the local filesystem for data storage. You can alternatively use a `s3` cloud backend as well. Access token caching is also enabled by default since the logout endpoints are proxied through the media repo.
29+
30+
**Note:** If you want to use authenticated media endpoints ([MSC3916](https://github.com/matrix-org/matrix-spec-proposals/pull/3916)), you must configure a signing key for your MMR instance to authorize outbound federation requests. See https://docs.t2bot.io/matrix-media-repo/v1.3.5/installation/signing-key/ for more details on how to configure your server with a signing key.
2931

3032
## Configuring the media-repo
3133

docs/configuring-playbook-prometheus-grafana.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ scrape_configs:
121121

122122
## More information
123123

124+
- [Enabling synapse-usage-exporter for Synapse usage statistics](configuring-playbook-synapse-usage-exporter.md)
124125
- [Understanding Synapse Performance Issues Through Grafana Graphs](https://element-hq.github.io/synapse/latest/usage/administration/understanding_synapse_through_grafana_graphs.html) at the Synapse Github Wiki
125126
- [The Prometheus scraping rules](https://github.com/element-hq/synapse/tree/master/contrib/prometheus) (we use v2)
126127
- [The Synapse Grafana dashboard](https://github.com/element-hq/synapse/tree/master/contrib/grafana)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Setting up synapse-usage-exporter (optional)
2+
3+
[synapse-usage-exporter](https://github.com/loelkes/synapse-usage-exporter) allows you to export the usage statistics of a Synapse homeserver to this container service and for the collected metrics to later be scraped by Prometheus.
4+
5+
Synapse does not include usage statistics in its Prometheus metrics. They can be reported to an HTTP `PUT` endpoint 5 minutes after startup and from then on at a fixed interval of once every three hours. This role integrates a simple [Flask](https://flask.palletsprojects.com) project that offers an HTTP `PUT` endpoint and holds the most recent received record available to be scraped by Prometheus.
6+
7+
Enabling this service will automatically:
8+
9+
- install the synapse-usage-exporter service
10+
- re-configure Synapse to push (via HTTP `PUT`) usage statistics information to synapse-usage-exporter
11+
- re-configure [Prometheus](./configuring-playbook-prometheus-grafana.md) (if Prometheus is enabled), to periodically scrape metrics from synapse-usage-exporter
12+
- add a new [Grafana](./configuring-playbook-prometheus-grafana.md) dashboard (if Grafana is enabled) containing Synapse usage statistics
13+
14+
## Quickstart
15+
16+
Add the following configuration to your `inventory/host_vars/matrix.DOMAIN/vars.yml` file and [re-run the installation process](./installing.md) for the playbook:
17+
18+
```yaml
19+
matrix_synapse_usage_exporter_enabled: true
20+
21+
# (Optional) Expose endpoint if you want to collect statistics from outside (from other homeservers).
22+
# If enabled, synapse-usage-exporter will be exposed publicly at `matrix.DOMAIN/report-usage-stats/push`.
23+
# When collecting usage statistics for Synapse running on the same host, you don't need to enable this.
24+
# You can adjust the hostname and path via `matrix_synapse_usage_exporter_hostname` and `matrix_synapse_usage_exporter_path_prefix`.
25+
# matrix_synapse_usage_exporter_proxying_enabled: true
26+
```

docs/configuring-playbook-synapse.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,6 @@ Due to this, it's recommended to only store and maintain template files in your
161161

162162
This playbook allows you to enable Synapse metrics, which can provide insight into the performance and activity of Synapse.
163163

164-
To enable Synapse metrics see [`configuring-playbook-prometheus-grafana.md`](./configuring-playbook-prometheus-grafana.md)
164+
To enable Synapse runtime metrics see: [Enabling metrics and graphs (Prometheus, Grafana) for your Matrix server](configuring-playbook-prometheus-grafana.md)
165+
166+
To enable Synapse usage metrics, see: [Enabling synapse-usage-exporter for Synapse usage statistics](configuring-playbook-synapse-usage-exporter.md)

docs/configuring-playbook.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ When you're done with all the configuration you'd like to do, continue with [Ins
4242

4343
- [Enabling metrics and graphs (Prometheus, Grafana) for your Matrix server](configuring-playbook-prometheus-grafana.md) (optional)
4444

45+
- [Enabling synapse-usage-exporter for Synapse usage statistics](configuring-playbook-synapse-usage-exporter.md) (optional)
46+
4547
### Core service adjustments
4648

4749
- Homeserver configuration:

group_vars/matrix_servers

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,8 @@ devture_systemd_service_manager_services_list_auto: |
441441
+
442442
([{'name': 'matrix-synapse-admin.service', 'priority': 4000, 'groups': ['matrix', 'synapse-admin']}] if matrix_synapse_admin_enabled else [])
443443
+
444+
([{'name': (matrix_synapse_usage_exporter_identifier + '.service'), 'priority': 4000, 'groups': ['matrix', 'synapse-usage-exporter']}] if matrix_synapse_usage_exporter_enabled else [])
445+
+
444446
([{'name': 'matrix-synapse-reverse-proxy-companion.service', 'priority': 1500, 'groups': ['matrix', 'homeservers', 'synapse', 'synapse-reverse-proxy-companion', 'reverse-proxies']}] if matrix_synapse_reverse_proxy_companion_enabled else [])
445447
+
446448
([{'name': 'matrix-user-verification-service.service', 'priority': 800, 'groups': ['matrix', 'matrix-user-verification-service']}] if matrix_user_verification_service_enabled else [])
@@ -3611,6 +3613,12 @@ matrix_media_repo_container_labels_traefik_internal_media_entrypoints: "{{ matri
36113613
matrix_media_repo_container_labels_traefik_internal_matrix_client_media_enabled: "{{ matrix_playbook_internal_matrix_client_api_traefik_entrypoint_enabled }}"
36123614
matrix_media_repo_container_labels_traefik_internal_matrix_client_media_entrypoints: "{{ matrix_playbook_internal_matrix_client_api_traefik_entrypoint_name }}"
36133615

3616+
matrix_media_repo_metrics_proxying_enabled: "{{ matrix_media_repo_metrics_enabled and matrix_metrics_exposure_enabled }}"
3617+
matrix_media_repo_metrics_proxying_hostname: "{{ matrix_metrics_exposure_hostname }}"
3618+
matrix_media_repo_metrics_proxying_path: "{{ matrix_metrics_exposure_path_prefix }}/matrix-media-repo"
3619+
matrix_media_repo_container_labels_traefik_metrics_middleware_basic_auth_enabled: "{{ matrix_metrics_exposure_http_basic_auth_enabled }}"
3620+
matrix_media_repo_container_labels_traefik_metrics_middleware_basic_auth_users: "{{ matrix_metrics_exposure_http_basic_auth_users }}"
3621+
36143622
matrix_media_repo_database_hostname: "{{ devture_postgres_connection_hostname if devture_postgres_enabled else '' }}"
36153623
matrix_media_repo_database_username: matrix_media_repo
36163624
matrix_media_repo_database_password: "{{ '%s' | format(matrix_homeserver_generic_secret_key) | password_hash('sha512', 'mediarepo.db', rounds=655555) | to_uuid }}"
@@ -3644,6 +3652,11 @@ matrix_media_repo_homeservers_auto:
36443652
# to "matrix", most functionality requiring the admin API will not work.
36453653
adminApiKind: "{{ 'synapse' if matrix_homeserver_implementation == 'synapse' else ('dendrite' if matrix_homeserver_implementation == 'dendrite' else 'matrix') }}"
36463654

3655+
# The signing key to use for authorizing outbound federation requests. If not specified,
3656+
# requests will not be authorized. See https://docs.t2bot.io/matrix-media-repo/v1.3.5/installation/signing-key/
3657+
# for details.
3658+
signingKeyPath: ""
3659+
36473660
matrix_media_repo_homeserver_federation_enabled: "{{ matrix_homeserver_federation_enabled }}"
36483661

36493662
######################################################################
@@ -4454,6 +4467,10 @@ matrix_synapse_app_service_config_files_auto: "{{ matrix_homeserver_app_service_
44544467
# Disable creation of media repository Synapse worker when using media-repo
44554468
matrix_synapse_ext_media_repo_enabled: "{{ matrix_media_repo_enabled }}"
44564469

4470+
# Enable Synapse statistics reporting when using synapse-usage-exporter
4471+
matrix_synapse_report_stats: "{{ matrix_synapse_usage_exporter_enabled }}"
4472+
matrix_synapse_report_stats_endpoint: "http://{{ matrix_synapse_usage_exporter_identifier }}:{{ matrix_synapse_usage_exporter_container_port | string }}/report-usage-stats/push"
4473+
44574474
######################################################################
44584475
#
44594476
# /matrix-synapse
@@ -4586,6 +4603,28 @@ matrix_synapse_admin_container_labels_traefik_tls_certResolver: "{{ devture_trae
45864603
#
45874604
######################################################################
45884605

4606+
######################################################################
4607+
#
4608+
# matrix-synapse-usage-exporter
4609+
#
4610+
######################################################################
4611+
4612+
matrix_synapse_usage_exporter_enabled: false
4613+
4614+
matrix_synapse_usage_exporter_container_network: "{{ matrix_monitoring_container_network }}"
4615+
4616+
matrix_synapse_usage_exporter_container_additional_networks: "{{ [matrix_playbook_reverse_proxyable_services_additional_network] if matrix_playbook_reverse_proxyable_services_additional_network else [] }}"
4617+
4618+
matrix_synapse_usage_exporter_container_labels_traefik_enabled: "{{ matrix_synapse_usage_exporter_proxying_enabled }}"
4619+
matrix_synapse_usage_exporter_container_labels_traefik_docker_network: "{{ matrix_playbook_reverse_proxyable_services_additional_network }}"
4620+
matrix_synapse_usage_exporter_container_labels_traefik_entrypoints: "{{ devture_traefik_entrypoint_primary }}"
4621+
matrix_synapse_usage_exporter_container_labels_traefik_tls_certResolver: "{{ devture_traefik_certResolver_primary }}"
4622+
4623+
######################################################################
4624+
#
4625+
# /matrix-synapse-usage-exporter
4626+
#
4627+
######################################################################
45894628

45904629
######################################################################
45914630
#
@@ -4744,6 +4783,8 @@ prometheus_container_additional_networks_auto: |
47444783
([matrix_prometheus_nginxlog_exporter_container_network] if matrix_prometheus_services_connect_scraper_nginxlog_enabled and matrix_prometheus_nginxlog_exporter_container_network != prometheus_container_network else [])
47454784
+
47464785
([matrix_media_repo_container_network] if matrix_prometheus_services_connect_scraper_media_repo_enabled and matrix_media_repo_container_network != prometheus_container_network else [])
4786+
+
4787+
([matrix_synapse_usage_exporter_container_network] if matrix_prometheus_services_connect_scraper_synapse_usage_exporter_enabled and matrix_synapse_usage_exporter_container_network != prometheus_container_network else [])
47474788
) | unique
47484789
}}
47494790

@@ -4768,6 +4809,8 @@ prometheus_config_scrape_configs_auto: |
47684809
(matrix_prometheus_services_connect_scraper_nginxlog_scrape_configs if matrix_prometheus_services_connect_scraper_nginxlog_enabled else [])
47694810
+
47704811
(matrix_prometheus_services_connect_scraper_media_repo_scrape_configs if matrix_prometheus_services_connect_scraper_media_repo_enabled else [])
4812+
+
4813+
(matrix_prometheus_services_connect_scraper_synapse_usage_exporter_scrape_configs if matrix_prometheus_services_connect_scraper_synapse_usage_exporter_enabled else [])
47714814
}}
47724815

47734816
######################################################################
@@ -4806,6 +4849,9 @@ matrix_prometheus_services_connect_scraper_nginxlog_static_configs_target: "{{ m
48064849
matrix_prometheus_services_connect_scraper_media_repo_enabled: "{{ matrix_media_repo_enabled and matrix_media_repo_metrics_enabled }}"
48074850
matrix_prometheus_services_connect_scraper_media_repo_static_configs_target: "{{ matrix_media_repo_identifier }}:{{ matrix_media_repo_metrics_port }}"
48084851

4852+
matrix_prometheus_services_connect_scraper_synapse_usage_exporter_enabled: "{{ matrix_synapse_usage_exporter_enabled }}"
4853+
matrix_prometheus_services_connect_scraper_synapse_usage_exporter_static_configs_target: "{{ matrix_synapse_usage_exporter_identifier }}:{{ matrix_synapse_usage_exporter_container_port | string }}"
4854+
48094855
######################################################################
48104856
#
48114857
# /matrix-prometheus-services-connect
@@ -4872,6 +4918,8 @@ grafana_dashboard_download_urls: |
48724918
(matrix_prometheus_nginxlog_exporter_dashboard_urls if matrix_prometheus_nginxlog_exporter_enabled else [])
48734919
+
48744920
(matrix_media_repo_dashboard_urls if matrix_media_repo_metrics_enabled else [])
4921+
+
4922+
(matrix_synapse_usage_exporter_dashboard_urls if matrix_synapse_usage_exporter_enabled else [])
48754923
}}
48764924

48774925
grafana_provisioning_dashboard_template_files: |
@@ -4880,11 +4928,6 @@ grafana_provisioning_dashboard_template_files: |
48804928
'path': 'roles/custom/matrix-prometheus-nginxlog-exporter/templates/grafana/nginx-proxy.json',
48814929
'name': 'nginx-proxy.json',
48824930
}] if matrix_prometheus_nginxlog_exporter_enabled else [])
4883-
+
4884-
([{
4885-
'path': 'roles/custom/matrix-media-repo/templates/grafana/media-repo.json',
4886-
'name': 'media-repo.json',
4887-
}] if matrix_media_repo_metrics_enabled else [])
48884931
}}
48894932

48904933
grafana_default_home_dashboard_path: |-

requirements.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
version: v4.98-r0-0-0
2323
name: exim_relay
2424
- src: git+https://gitlab.com/etke.cc/roles/grafana.git
25-
version: v11.1.0-0
25+
version: v11.1.3-1
2626
name: grafana
2727
- src: git+https://github.com/mother-of-all-self-hosting/ansible-role-jitsi.git
2828
version: v9584-1

roles/custom/matrix-bot-buscarron/defaults/main.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
matrix_bot_buscarron_enabled: true
77

88
# renovate: datasource=docker depName=registry.gitlab.com/etke.cc/buscarron
9-
matrix_bot_buscarron_version: v1.4.1
9+
matrix_bot_buscarron_version: v1.4.2
1010

1111
# The hostname at which Buscarron is served.
1212
matrix_bot_buscarron_hostname: ''
@@ -50,6 +50,17 @@ matrix_bot_buscarron_metrics_password: ''
5050
# /metrics allowed ips
5151
matrix_bot_buscarron_metrics_ips: []
5252

53+
# healthchecks.io integration
54+
matrix_bot_buscarron_hc_url: '' # default is https://hc-ping.com (healthchecks.io)
55+
matrix_bot_buscarron_hc_uuid: '' # check UUID
56+
57+
# redmine integration
58+
matrix_bot_buscarron_redmine_host: '' # e.g. https://redmine.example.com
59+
matrix_bot_buscarron_redmine_apikey: ''
60+
matrix_bot_buscarron_redmine_project: '' # project identifier (e.g., my-project)
61+
matrix_bot_buscarron_redmine_trackerid: '' # task tracker ID (e.g., 1)
62+
matrix_bot_buscarron_redmine_statusid: '' # task status ID (e.g., 1)
63+
5364

5465
# matrix_bot_buscarron_container_labels_traefik_enabled controls whether labels to assist a Traefik reverse-proxy will be attached to the container.
5566
# See `../templates/labels.j2` for details.

0 commit comments

Comments
 (0)