service/gitea: add monitoring & dashboard

This commit is contained in:
Felix Buehler 2023-04-16 16:22:35 +02:00
parent 3569df7826
commit 9991dfaf47
3 changed files with 1292 additions and 1 deletions

View file

@ -1,5 +1,5 @@
# self-hosted git service # self-hosted git service
{ config, lib, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.my.services.gitea; cfg = config.my.services.gitea;
domain = config.networking.domain; domain = config.networking.domain;
@ -25,6 +25,7 @@ in
service.DISABLE_REGISTRATION = true; service.DISABLE_REGISTRATION = true;
ui.DEFAULT_THEME = "arc-green"; ui.DEFAULT_THEME = "arc-green";
log.LEVEL = "Warn"; log.LEVEL = "Warn";
metrics.ENABLED = config.services.prometheus.enable;
}; };
lfs.enable = true; lfs.enable = true;
}; };
@ -44,6 +45,31 @@ in
]; ];
}; };
services.prometheus = {
scrapeConfigs = [
{
job_name = "gitea";
static_configs = [
{
targets = [ "127.0.0.1:${toString cfg.port}" ];
labels = {
instance = config.networking.hostName;
};
}
];
}
];
};
services.grafana.provision = {
dashboards.settings.providers = [
{
name = "Gitea";
options.path = pkgs.grafana-dashboards.gitea;
disableDeletion = true;
}
];
};
webapps.apps.gitea = { webapps.apps.gitea = {
dashboard = { dashboard = {
name = "Code"; name = "Code";

View file

@ -54,4 +54,13 @@ in
version = "5"; version = "5";
hash = "sha256-9vfUGpypFNKm9T1F12Cqh8TIl0x3jSwv2fL9HVRLt3o="; hash = "sha256-9vfUGpypFNKm9T1F12Cqh8TIl0x3jSwv2fL9HVRLt3o=";
}; };
gitea = (buildGrafanaDashboard {
id = 13192;
pname = "gitea";
version = "1";
hash = "sha256-IAaI/HvMxcWE3PGQFK8avNjgj88DgcDvkWRcDAWSejM=";
}).overrideAttrs (self: super: {
src = ./gitea.json; # sadly not yet updated to latest grafana
});
}) })

File diff suppressed because it is too large Load diff