Преглед изворни кода

avoid referencing variables from other roles, handover info using group_vars/matrix_servers

pull/2315/head
ikkemaniac пре 3 година
родитељ
комит
b4b363cbeb
7 измењених фајлова са 27 додато и 16 уклоњено
  1. +10
    -0
      group_vars/matrix_servers
  2. +6
    -6
      roles/custom/matrix-nginx-proxy/templates/nginx/nginx.conf.j2
  3. +1
    -0
      roles/custom/matrix-prometheus-nginxlog-exporter/defaults/main.yml
  4. +1
    -1
      roles/custom/matrix-prometheus-nginxlog-exporter/templates/prometheus-nginxlog-exporter.yaml.j2
  5. +1
    -1
      roles/custom/matrix-prometheus-nginxlog-exporter/templates/systemd/matrix-prometheus-nginxlog-exporter.service.j2
  6. +2
    -2
      roles/custom/matrix-prometheus/templates/prometheus.yml.j2
  7. +6
    -6
      roles/custom/matrix-synapse-reverse-proxy-companion/templates/nginx/nginx.conf.j2

+ 10
- 0
group_vars/matrix_servers Прегледај датотеку

@@ -2237,6 +2237,9 @@ matrix_ssl_architecture: "{{


matrix_ssl_pre_obtaining_required_service_name: "{{ 'matrix-dynamic-dns' if matrix_dynamic_dns_enabled else '' }}" matrix_ssl_pre_obtaining_required_service_name: "{{ 'matrix-dynamic-dns' if matrix_dynamic_dns_enabled else '' }}"


matrix_nginx_proxy_access_log_syslog_integration_enabled: "{{ matrix_prometheus_nginxlog_exporter_enabled }}"
matrix_nginx_proxy_access_log_syslog_integration_server_port: "{{ (matrix_prometheus_nginxlog_exporter_container_hostname | string +':'+ matrix_prometheus_nginxlog_exporter_container_syslog_port | string) | default('') }}"

###################################################################### ######################################################################
# #
# /matrix-nginx-proxy # /matrix-nginx-proxy
@@ -2822,6 +2825,9 @@ matrix_synapse_reverse_proxy_companion_synapse_stream_writer_presence_stream_wor
matrix_synapse_reverse_proxy_companion_synapse_media_repository_locations: "{{matrix_synapse_workers_media_repository_endpoints|default([]) }}" matrix_synapse_reverse_proxy_companion_synapse_media_repository_locations: "{{matrix_synapse_workers_media_repository_endpoints|default([]) }}"
matrix_synapse_reverse_proxy_companion_synapse_user_dir_locations: "{{ matrix_synapse_workers_user_dir_worker_client_server_endpoints|default([]) }}" matrix_synapse_reverse_proxy_companion_synapse_user_dir_locations: "{{ matrix_synapse_workers_user_dir_worker_client_server_endpoints|default([]) }}"


matrix_synapse_reverse_proxy_companion_access_log_syslog_integration_enabled: "{{ matrix_prometheus_nginxlog_exporter_enabled }}"
matrix_synapse_reverse_proxy_companion_access_log_syslog_integration_server_port: "{{ (matrix_prometheus_nginxlog_exporter_container_hostname | string +':'+ matrix_prometheus_nginxlog_exporter_container_syslog_port | string) | default('') }}"

###################################################################### ######################################################################
# #
# /matrix-synapse-reverse-proxy-companion # /matrix-synapse-reverse-proxy-companion
@@ -2904,6 +2910,10 @@ matrix_prometheus_scraper_postgres_targets: "{{ ['matrix-prometheus-postgres-exp
matrix_prometheus_scraper_hookshot_enabled: "{{ matrix_hookshot_metrics_enabled|default(false) }}" matrix_prometheus_scraper_hookshot_enabled: "{{ matrix_hookshot_metrics_enabled|default(false) }}"
matrix_prometheus_scraper_hookshot_targets: "{{ [matrix_hookshot_container_url | string +':'+ matrix_hookshot_metrics_port | string] if matrix_hookshot_metrics_enabled else [] }}" matrix_prometheus_scraper_hookshot_targets: "{{ [matrix_hookshot_container_url | string +':'+ matrix_hookshot_metrics_port | string] if matrix_hookshot_metrics_enabled else [] }}"


matrix_prometheus_scraper_nginxlog_enabled: "{{ matrix_prometheus_nginxlog_exporter_enabled }}"
matrix_prometheus_scraper_nginxlog_server_port: "{{ (matrix_prometheus_nginxlog_exporter_container_hostname | string +':'+ matrix_prometheus_nginxlog_exporter_container_syslog_port | string)
| default('') }}"

###################################################################### ######################################################################
# #
# /matrix-prometheus # /matrix-prometheus


+ 6
- 6
roles/custom/matrix-nginx-proxy/templates/nginx/nginx.conf.j2 Прегледај датотеку

@@ -41,16 +41,16 @@ http {
access_log /var/log/nginx/access.log main; access_log /var/log/nginx/access.log main;
{% endif %} {% endif %}


{% if matrix_prometheus_nginxlog_exporter_enabled %}
{% if matrix_nginx_proxy_access_log_syslog_integration_enabled %}
log_format prometheus_fmt 'matrix-nginx-proxy $server_name - $upstream_addr - $remote_addr - $remote_user [$time_local] ' log_format prometheus_fmt 'matrix-nginx-proxy $server_name - $upstream_addr - $remote_addr - $remote_user [$time_local] '
'$host "$request" '
'$status "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
'$host "$request" '
'$status "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';


access_log syslog:server={{ matrix_prometheus_nginxlog_exporter_container_hostname }}:6514,tag=matrix_nginx_proxy prometheus_fmt;
access_log syslog:server={{ matrix_nginx_proxy_access_log_syslog_integration_server_port }},tag=matrix_nginx_proxy prometheus_fmt;
{% endif %} {% endif %}


{% if not matrix_nginx_proxy_access_log_enabled and not matrix_prometheus_nginxlog_exporter_enabled %}
{% if not matrix_nginx_proxy_access_log_enabled and not matrix_nginx_proxy_access_log_syslog_integration_enabled %}
access_log off; access_log off;
{% endif %} {% endif %}




+ 1
- 0
roles/custom/matrix-prometheus-nginxlog-exporter/defaults/main.yml Прегледај датотеку

@@ -5,6 +5,7 @@
matrix_prometheus_nginxlog_exporter_enabled: true matrix_prometheus_nginxlog_exporter_enabled: true
matrix_prometheus_nginxlog_exporter_container_hostname: 'matrix-prometheus-nginxlog-exporter' matrix_prometheus_nginxlog_exporter_container_hostname: 'matrix-prometheus-nginxlog-exporter'
matrix_prometheus_nginxlog_exporter_container_metrics_port: '4040' matrix_prometheus_nginxlog_exporter_container_metrics_port: '4040'
matrix_prometheus_nginxlog_exporter_container_syslog_port: '6514'


matrix_prometheus_nginxlog_exporter_version: v1.10.0 matrix_prometheus_nginxlog_exporter_version: v1.10.0
matrix_prometheus_nginxlog_exporter_docker_image_name_prefix: "{{ 'ghcr.io/martin-helmich/' }}" matrix_prometheus_nginxlog_exporter_docker_image_name_prefix: "{{ 'ghcr.io/martin-helmich/' }}"


+ 1
- 1
roles/custom/matrix-prometheus-nginxlog-exporter/templates/prometheus-nginxlog-exporter.yaml.j2 Прегледај датотеку

@@ -13,7 +13,7 @@ namespaces:
# print_log: true # print_log: true
source: source:
syslog: syslog:
listen_address: "udp://0.0.0.0:6514"
listen_address: "udp://0.0.0.0:{{ matrix_prometheus_nginxlog_exporter_container_syslog_port }}"
# format options: "rfc3164" ,"rfc5424", "rfc6587", "auto" # format options: "rfc3164" ,"rfc5424", "rfc6587", "auto"
format: auto format: auto
tags: ["matrix_nginx_proxy", "matrix_nginx_proxy_companion"] tags: ["matrix_nginx_proxy", "matrix_nginx_proxy_companion"]


+ 1
- 1
roles/custom/matrix-prometheus-nginxlog-exporter/templates/systemd/matrix-prometheus-nginxlog-exporter.service.j2 Прегледај датотеку

@@ -27,7 +27,7 @@ ExecStart={{ devture_systemd_docker_base_host_command_docker }} run --rm --name
-p {{ matrix_prometheus_nginxlog_exporter_container_http_host_bind_port }}:{{ matrix_prometheus_nginxlog_exporter_container_metrics_port }} \ -p {{ matrix_prometheus_nginxlog_exporter_container_http_host_bind_port }}:{{ matrix_prometheus_nginxlog_exporter_container_metrics_port }} \
{% endif %} {% endif %}
{% if matrix_prometheus_nginxlog_exporter_container_syslog_host_bind_port %} {% if matrix_prometheus_nginxlog_exporter_container_syslog_host_bind_port %}
-p {{ matrix_prometheus_nginxlog_exporter_container_syslog_host_bind_port }}:6514/udp \
-p {{ matrix_prometheus_nginxlog_exporter_container_syslog_host_bind_port }}:{{ matrix_prometheus_nginxlog_exporter_container_syslog_port }}/udp \
{% endif %} {% endif %}
-v {{ matrix_prometheus_nginxlog_exporter_config_path }}:/etc/prometheus-nginxlog-exporter:z \ -v {{ matrix_prometheus_nginxlog_exporter_config_path }}:/etc/prometheus-nginxlog-exporter:z \
{% for arg in matrix_prometheus_nginxlog_exporter_container_extra_arguments %} {% for arg in matrix_prometheus_nginxlog_exporter_container_extra_arguments %}


+ 2
- 2
roles/custom/matrix-prometheus/templates/prometheus.yml.j2 Прегледај датотеку

@@ -65,9 +65,9 @@ scrape_configs:
- targets: {{ matrix_prometheus_scraper_hookshot_targets|to_json }} - targets: {{ matrix_prometheus_scraper_hookshot_targets|to_json }}
{% endif %} {% endif %}


{% if matrix_prometheus_nginxlog_exporter_enabled %}
{% if matrix_prometheus_scraper_nginxlog_enabled %}
- job_name: nginxlog - job_name: nginxlog
static_configs: static_configs:
- targets: - targets:
- {{ matrix_prometheus_nginxlog_exporter_container_hostname }}:{{ matrix_prometheus_nginxlog_exporter_container_metrics_port }}
- {{ matrix_prometheus_scraper_nginxlog_server_port}}
{% endif %} {% endif %}

+ 6
- 6
roles/custom/matrix-synapse-reverse-proxy-companion/templates/nginx/nginx.conf.j2 Прегледај датотеку

@@ -41,16 +41,16 @@ http {
access_log /var/log/nginx/access.log main; access_log /var/log/nginx/access.log main;
{% endif %} {% endif %}


{% if matrix_prometheus_nginxlog_exporter_enabled %}
{% if matrix_synapse_reverse_proxy_companion_access_log_syslog_integration_enabled %}
log_format prometheus_fmt 'matrix-synapse-reverse-proxy-companion $server_name - $upstream_addr - $remote_addr - $remote_user [$time_local] ' log_format prometheus_fmt 'matrix-synapse-reverse-proxy-companion $server_name - $upstream_addr - $remote_addr - $remote_user [$time_local] '
'$host "$request" '
'$status "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
'$host "$request" '
'$status "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';


access_log syslog:server={{ matrix_prometheus_nginxlog_exporter_container_hostname }}:6514,tag=matrix_nginx_proxy_companion prometheus_fmt;
access_log syslog:server={{ matrix_synapse_reverse_proxy_companion_access_log_syslog_integration_server_port }},tag=matrix_nginx_proxy_companion prometheus_fmt;
{% endif %} {% endif %}


{% if not matrix_synapse_reverse_proxy_companion_access_log_enabled and not matrix_prometheus_nginxlog_exporter_enabled %}
{% if not matrix_synapse_reverse_proxy_companion_access_log_enabled and not matrix_synapse_reverse_proxy_companion_access_log_syslog_integration_enabled %}
access_log off; access_log off;
{% endif %} {% endif %}




Loading…
Откажи
Сачувај