From 0625b16e509d76d4d242baf9fdaacc9a60a2bf06 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Thu, 11 Apr 2024 10:47:49 +0200 Subject: [PATCH] WIP: gitea metrics --- hosts/bekkalokk/services/gitea/default.nix | 10 ++++++++++ hosts/ildkule/services/metrics/prometheus/gitea.nix | 12 ++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 hosts/ildkule/services/metrics/prometheus/gitea.nix diff --git a/hosts/bekkalokk/services/gitea/default.nix b/hosts/bekkalokk/services/gitea/default.nix index b02d3aa..48c9541 100644 --- a/hosts/bekkalokk/services/gitea/default.nix +++ b/hosts/bekkalokk/services/gitea/default.nix @@ -45,6 +45,7 @@ in { DISABLE_GRAVATAR = true; ENABLE_FEDERATED_AVATAR = false; }; + metrics.ENABLED = true; actions.ENABLED = true; }; }; @@ -61,6 +62,15 @@ in { client_max_body_size 512M; ''; }; + + locations."/metrics" = { + proxyPass = "http://unix:${cfg.settings.server.HTTP_ADDR}"; + extraConfig = '' + allow ${values.hosts.ildkule.ipv4}; + allow ${values.hosts.ildkule.ipv6}; + deny all; + ''; + }; }; networking.firewall.allowedTCPPorts = [ sshPort ]; diff --git a/hosts/ildkule/services/metrics/prometheus/gitea.nix b/hosts/ildkule/services/metrics/prometheus/gitea.nix new file mode 100644 index 0000000..72af799 --- /dev/null +++ b/hosts/ildkule/services/metrics/prometheus/gitea.nix @@ -0,0 +1,12 @@ +{ values, ... }: +{ + # Gitea already exports at /metrics + services.prometheus.scrapeConfigs = [{ + job_name = "gitea"; + scrape_interval = "15s"; + metrics_path = "/metrics/gitea"; + static_configs = [{ + targets = [ "git.pvv.ntnu.no:443" ]; + }]; + }]; +}