Prepare for remote push metrics

This commit is contained in:
Ilya K 2024-07-07 17:58:51 +03:00
parent c144d76613
commit 31ee302ec9
5 changed files with 13 additions and 6 deletions

View file

@ -12,8 +12,8 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
age.secrets = { age.secrets = {
loki-htpasswd = { metrics-push-htpasswd = {
file = ../../../secrets/loki-htpasswd.age; file = ../../../secrets/metrics-push-htpasswd.age;
owner = "nginx"; owner = "nginx";
}; };
loki-environment.file = ../../../secrets/loki-environment.age; loki-environment.file = ../../../secrets/loki-environment.age;
@ -93,7 +93,7 @@ in
forceSSL = true; forceSSL = true;
locations."/loki/api/v1/push" = { locations."/loki/api/v1/push" = {
proxyPass = "http://localhost:${toString config.services.loki.configuration.server.http_listen_port}"; proxyPass = "http://localhost:${toString config.services.loki.configuration.server.http_listen_port}";
basicAuthFile = config.age.secrets.loki-htpasswd.path; basicAuthFile = config.age.secrets.metrics-push-htpasswd.path;
}; };
}; };
}; };

View file

@ -34,7 +34,13 @@ in
options.bagel.services.prometheus.enable = mkEnableOption "Prometheus scraper"; options.bagel.services.prometheus.enable = mkEnableOption "Prometheus scraper";
config = mkIf cfg.enable { config = mkIf cfg.enable {
age.secrets.mimir-environment.file = ../../../secrets/mimir-environment.age; age.secrets = {
metrics-push-htpasswd = {
file = ../../../secrets/metrics-push-htpasswd.age;
owner = "nginx";
};
mimir-environment.file = ../../../secrets/mimir-environment.age;
};
services.prometheus = { services.prometheus = {
enable = true; enable = true;
@ -109,8 +115,9 @@ in
services.nginx.virtualHosts."mimir.forkos.org" = { services.nginx.virtualHosts."mimir.forkos.org" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
locations."/" = { locations."/api/v1/push" = {
proxyPass = "http://localhost:${toString mimirPort}"; proxyPass = "http://localhost:${toString mimirPort}";
basicAuthFile = config.age.secrets.metrics-push-htpasswd.path;
}; };
}; };
}; };

View file

@ -12,7 +12,7 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
age.secrets.promtail-password = { age.secrets.promtail-password = {
file = ../../secrets/promtail-password.age; file = ../../secrets/metrics-push-password.age;
owner = "promtail"; owner = "promtail";
}; };