Browse Source

add auto proxy synapse worker metrics

when matrix_nginx_proxy_proxy_synapse_metrics is enabled
pull/1311/head
HarHarLinks 4 years ago
parent
commit
d9fa2f7ed4
2 changed files with 19 additions and 1 deletions
  1. +1
    -1
      roles/matrix-nginx-proxy/defaults/main.yml
  2. +18
    -0
      roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-synapse.conf.j2

+ 1
- 1
roles/matrix-nginx-proxy/defaults/main.yml View File

@@ -222,7 +222,7 @@ matrix_nginx_proxy_proxy_matrix_client_api_forwarded_location_prefix_regexes: |
+ +
(['/_synapse/admin'] if matrix_nginx_proxy_proxy_matrix_client_api_forwarded_location_synapse_admin_api_enabled else []) (['/_synapse/admin'] if matrix_nginx_proxy_proxy_matrix_client_api_forwarded_location_synapse_admin_api_enabled else [])
+ +
(['/_synapse/metrics'] if matrix_nginx_proxy_proxy_synapse_metrics else [])
(['/_synapse.*/metrics'] if matrix_nginx_proxy_proxy_synapse_metrics else [])
}} }}


# Specifies where requests for the root URI (`/`) on the `matrix.` domain should be redirected. # Specifies where requests for the root URI (`/`) on the `matrix.` domain should be redirected.


+ 18
- 0
roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-synapse.conf.j2 View File

@@ -153,6 +153,24 @@ server {
} }
{% endif %} {% endif %}


{% if matrix_nginx_proxy_enabled and matrix_nginx_proxy_proxy_synapse_metrics %}
{% for worker in matrix_prometheus_scraper_synapse_workers_enabled_list %}
{% if worker.metrics_port != 0 %}
location /_synapse-worker-{{ worker.type }}-{{ worker.instanceId }}/metrics {
resolver 127.0.0.11 valid=5s;
set $backend "matrix-synapse-worker-{{ worker.type }}-{{ worker.instanceId }}:{{ worker.metrics_port }}";
proxy_pass http://$backend/_synapse/metrics;
proxy_set_header Host $host;

{% if matrix_nginx_proxy_proxy_synapse_metrics_basic_auth_enabled %}
auth_basic "protected";
auth_basic_user_file /nginx-data/matrix-synapse-metrics-htpasswd;
{% endif %}
}
{% endif %}
{% endfor %}
{% endif %}

{# Everything else just goes to the API server ##} {# Everything else just goes to the API server ##}
location / { location / {
{% if matrix_nginx_proxy_enabled %} {% if matrix_nginx_proxy_enabled %}


Loading…
Cancel
Save