modules/prometheus: add basic auth

This commit is contained in:
xinyangli 2024-11-30 17:35:46 +08:00
parent 97fcdefc2b
commit 74b67e1854
Signed by: xin
SSH key fingerprint: SHA256:UU5pRTl7NiLFJbWJZa+snLylZSXIz5rgHmwjzv8v4oE
10 changed files with 184 additions and 194 deletions

View file

@ -46,6 +46,21 @@ in
);
};
# gotosocial
sops.templates."gotosocial_metrics.env" = {
content = ''
GTS_METRICS_AUTH_ENABLED=true
GTS_METRICS_AUTH_USERNAME=${config.sops.placeholder."prometheus/metrics_username"}
GTS_METRICS_AUTH_PASSWORD=${config.sops.placeholder."prometheus/metrics_password"}
'';
group = "prometheus-auth";
mode = "0440";
};
systemd.services.gotosocial.serviceConfig = {
EnvironmentFile = [ config.sops.templates."gotosocial_metrics.env".path ];
SupplementaryGroups = [ "prometheus-auth" ];
};
services.gotosocial.settings = {
metrics-enabled = true;
};
@ -55,7 +70,24 @@ in
};
services.restic.server.prometheus = true;
systemd.services.miniflux.environment.METRICS_COLLECTOR = "1";
# miniflux
sops.templates."miniflux_metrics_env" = {
content = ''
METRICS_COLLECTOR=1
LOG_LEVEL=debug
METRICS_USERNAME=${config.sops.placeholder."prometheus/metrics_username"}
METRICS_PASSWORD=${config.sops.placeholder."prometheus/metrics_password"}
'';
group = "prometheus-auth";
mode = "0440";
};
systemd.services.miniflux.serviceConfig = {
EnvironmentFile = [ config.sops.templates."miniflux_metrics_env".path ];
SupplementaryGroups = [ "prometheus-auth" ];
};
services.ntfy-sh.settings.enable-metrics = true;
services.caddy.globalConfig = ''