feat(pyroscope): add push API & reverse proxy

Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
This commit is contained in:
raito 2024-08-23 21:04:22 +02:00
parent 7cde6e92ae
commit 702867cd62

View file

@ -2,6 +2,7 @@
let let
inherit (lib) mkEnableOption mkIf; inherit (lib) mkEnableOption mkIf;
cfg = config.bagel.services.pyroscope; cfg = config.bagel.services.pyroscope;
pyroscopePort = config.services.pyroscope.settings.server.http_listen_port;
in in
{ {
options.bagel.services.pyroscope = { options.bagel.services.pyroscope = {
@ -15,6 +16,21 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
age.secrets.pyroscope-secrets.file = ../../../secrets/pyroscope-secrets.age; age.secrets.pyroscope-secrets.file = ../../../secrets/pyroscope-secrets.age;
services.nginx = {
upstreams.pyroscope = {
servers."127.0.0.1:${toString pyroscopePort}" = {};
extraConfig = "keepalive 16;";
};
virtualHosts."pyroscope.forkos.org" = {
enableACME = true;
forceSSL = true;
locations."/api/v1/push" = {
proxyPass = "http://pyroscope";
basicAuthFile = config.age.secrets.metrics-push-htpasswd.path;
};
};
};
services.pyroscope = { services.pyroscope = {
enable = true; enable = true;
secretFile = config.age.secrets.pyroscope-secrets.path; secretFile = config.age.secrets.pyroscope-secrets.path;
@ -37,6 +53,7 @@ in
}; };
}; };
server = { server = {
http_listen_port = 4040;
grpc_listen_port = 9097; grpc_listen_port = 9097;
grpc_server_max_recv_msg_size = 104857600; grpc_server_max_recv_msg_size = 104857600;
grpc_server_max_send_msg_size = 104857600; grpc_server_max_send_msg_size = 104857600;