ansible-taler-exchange

Ansible playbook to deploy a production Taler Exchange
Log | Files | Refs | Submodules | README | LICENSE

commit 4334fc80d205bc20c17d71a986ff93858ef95568
parent a9c3b64214a1d2f443b253772c525fe8c2c60bb4
Author: Christian Grothoff <christian@grothoff.org>
Date:   Wed, 29 Jan 2025 20:59:54 +0100

-syntax fixes

Diffstat:
Mroles/exchange/templates/etc/nginx/sites-available/exchange-nginx.conf.j2 | 2--
Mroles/monitoring/templates/etc/alloy/config.alloy | 39++++++++++++++++++++-------------------
2 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/roles/exchange/templates/etc/nginx/sites-available/exchange-nginx.conf.j2 b/roles/exchange/templates/etc/nginx/sites-available/exchange-nginx.conf.j2 @@ -23,8 +23,6 @@ server { keepalive_requests 1000000; keepalive_timeout 6500s; - if ($http_user_agent ~* "Bytedance|bytespider|Amazonbot|Claude|Anthropic|AI|GPT|acebook") { return 451 ; } - error_log /var/log/nginx/exchange.{{ DOMAIN_NAME }}.err; access_log /var/log/nginx/exchange.{{ DOMAIN_NAME }}.log apm; diff --git a/roles/monitoring/templates/etc/alloy/config.alloy b/roles/monitoring/templates/etc/alloy/config.alloy @@ -97,70 +97,71 @@ loki.process "perf_logs" { # https://grafana.com/docs/alloy/latest/reference/components/loki/loki.process/#stageregex-block stage.regex { - expression = "uri=/(?P<ep>[a-zA-Z]+)(?:/\w+)?(?:/(?P<act>[a-zA-Z-]+))? s=(?P<status>\d{3}).*urt=(?P<urt>\d+\.\d+|-) rt=(?P<response_time>\d+\.\d+) rl=(?P<request_length>\d+) bs=(?P<bytes_sent>\d+)" + expression = "uri=/(?P<ep>[a-zA-Z]+)(?:/\\w+)?(?:/(?P<act>[a-zA-Z-]+))? s=(?P<status>\\d{3}).*urt=(?P<urt>\\d+\\.\\d+|-) rt=(?P<response_time>\\d+\\.\\d+) rl=(?P<request_length>\\d+) bs=(?P<bytes_sent>\\d+)" } # # https://grafana.com/docs/alloy/latest/reference/components/loki/loki.process/#stagetemplate-block stage.template { source = "endpoint" - template = '{{ '{{' }} printf "%s-%s" .ep .act | trimSuffix "-" {{ '}}' }}' + template = "{{ '{{' }} printf \"%s-%s\" .ep .act | trimSuffix "-" {{ '}}' }}" } stage.template { - source = upstream_response_time - template = '{{ '{{' }} .urt | replace "-" "0" {{ '}}' }}' + source = "upstream_response_time" + template = "{{ '{{' }} .urt | replace \"-\" \"0\" {{ '}}' }}" } stage.metrics { # https://grafana.com/docs/alloy/latest/reference/components/loki/loki.process/#metriccounter-block metric.counter { - name = 'total_requests' - prefix = 'taler_requests_' + name = "total_requests" + prefix = "taler_requests_" description = "Total Requests" match_all = true - action = inc + action = "inc" } metric.gauge { - name = 'response_time' - prefix = 'taler_requests_' + name = "response_time" + prefix = "taler_requests_" description = "Time taken for Nginx to respond" - source = 'response_time' + source = "response_time" max_idle_duration = "24h" - action = set + action = "set" } + # https://grafana.com/docs/alloy/latest/reference/components/loki/loki.process/#metrichistogram-block # https://www.robustperception.io/how-does-a-prometheus-histogram-work metric.histogram { name = "request_length_hist" - prefix = 'taler_requests_' + prefix = "taler_requests_" description = "Request Length reported from Nginx" - source = 'request_length' + source = "request_length" max_idle_duration = "24h" buckets = [1,10,50,100,200,500,1000,2000,5000] } metric.histogram { name = "bytes_sent_hist" - prefix = 'taler_requests_' + prefix = "taler_requests_" description = "Number of bytes sent, reported from Nginx" - source = 'bytes_sent' + source = "bytes_sent" max_idle_duration = "24h" buckets = [1,10,50,100,200,500,1000,2000,5000] } metric.histogram { name = "response_time_hist" - prefix = 'taler_requests_' + prefix = "taler_requests_" description = "Time taken for Nginx to respond" - source = 'response_time' + source = "response_time" max_idle_duration = "24h" buckets = [0.001,0.0025,0.005,0.010,0.025,0.050,0.1,0.25,0.5,1,2,5] } metric.histogram { name = "upstream_response_time_hist" - prefix = 'taler_requests_' + prefix = "taler_requests_" description = "Time taken for the Exchange to respond to Nginx" - source = 'upstream_response_time' + source = "upstream_response_time" max_idle_duration = "24h" buckets = [0.001,0.0025,0.005,0.010,0.025,0.050,0.1,0.25,0.5,1,2,5] }