From 51041d51e33357612ffbc29b8e2633e7fa55df9a Mon Sep 17 00:00:00 2001
From: Leonidas Spyropoulos <artafinde@archlinux.org>
Date: Tue, 18 Oct 2022 20:17:43 +0300
Subject: [PATCH] aurweb: enable goaurrpc metrics

Signed-off-by: Leonidas Spyropoulos <artafinde@archlinux.org>
---
 roles/aurweb/templates/goaurrpc.conf.j2 | 3 ++-
 roles/aurweb/templates/nginx.d.conf.j2  | 6 ++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/roles/aurweb/templates/goaurrpc.conf.j2 b/roles/aurweb/templates/goaurrpc.conf.j2
index a36e5f951..ab10b3d51 100644
--- a/roles/aurweb/templates/goaurrpc.conf.j2
+++ b/roles/aurweb/templates/goaurrpc.conf.j2
@@ -16,5 +16,6 @@
 	"KeyFile": "",
 	"EnableSearchCache": true,
 	"CacheCleanupInterval": 60,
-	"CacheExpirationTime": 180
+	"CacheExpirationTime": 180,
+	"EnableMetrics": true
 }
diff --git a/roles/aurweb/templates/nginx.d.conf.j2 b/roles/aurweb/templates/nginx.d.conf.j2
index 0ddfdea2a..3d1cfb6ac 100644
--- a/roles/aurweb/templates/nginx.d.conf.j2
+++ b/roles/aurweb/templates/nginx.d.conf.j2
@@ -118,6 +118,12 @@ server {
         proxy_set_header X-Forwarded-For $remote_addr;
     }
 
+    location /rpc/metrics {
+        rewrite ^/rpc.php /rpc last;
+        proxy_pass http://127.0.0.1:10666/metrics;
+        proxy_set_header X-Forwarded-For $remote_addr;
+    }
+
     location / {
         # Proxy over to aurweb's ASGI application.
         proxy_pass http://{{ aurweb_asgi_bind }};
-- 
GitLab