Make http_host_bind_port vars more useful (#1984)

* if variable to bind an exporter container to a host port is set, have matrix-domain.conf (nginx) support this

* manipulate some variables to account for just port numbers or 0.0.0.0 IPs

* Make sure to use the right variable in the init.yml files

* Update roles/matrix-prometheus-node-exporter/tasks/init.yml

Co-authored-by: Slavi Pantaleev <slavi@devture.com>

* Update roles/matrix-prometheus-postgres-exporter/tasks/init.yml

Co-authored-by: Slavi Pantaleev <slavi@devture.com>

* remove extraneous variables and whitespace

Co-authored-by: Luca Bilke <luca@gmail.com>
Co-authored-by: Slavi Pantaleev <slavi@devture.com>
This commit is contained in:
snailed
2022-07-28 13:11:42 +00:00
committed by GitHub
parent d65096cd82
commit c77f2b8a64
6 changed files with 30 additions and 8 deletions

View File

@ -23,10 +23,10 @@
resolver 127.0.0.11 valid=5s;
set $backend "matrix-prometheus-postgres-exporter:9187";
proxy_pass http://$backend/metrics;
{% elif matrix_prometheus_postgres_exporter_matrix_nginx_proxy_not_enabled_proxy_pass_host != '' %}
proxy_pass http://{{ matrix_prometheus_postgres_exporter_matrix_nginx_proxy_not_enabled_proxy_pass_host }}/metrics;
{% else %}
{# Generic configuration for use outside of our container setup #}
{# This may be implemented in the future. #}
return 404 "matrix-nginx-proxy is disabled, 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 %}
}