diff options
author | azahi <azat@bahawi.net> | 2025-03-12 20:17:13 +0300 |
---|---|---|
committer | azahi <azat@bahawi.net> | 2025-03-12 20:17:13 +0300 |
commit | c81dc5a13b469c511fac6fa2390b70422d1b4da5 (patch) | |
tree | 4dab5909006ab5c25da6bd9fde6a714c7719ded7 /modules/tempo.nix | |
parent | 2025-02-17 (diff) |
Diffstat (limited to '')
-rw-r--r-- | modules/tempo.nix | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/modules/tempo.nix b/modules/tempo.nix new file mode 100644 index 0000000..55beb4f --- /dev/null +++ b/modules/tempo.nix @@ -0,0 +1,74 @@ +{ + config, + inputs, + lib, + libNginx, + this, + ... +}: +let + cfg = config.nixfiles.modules.tempo; +in +{ + options.nixfiles.modules.tempo = { + enable = lib.mkEnableOption "Tempo"; + + port = lib.mkOption { + description = "Port."; + type = lib.types.port; + default = 30181; + }; + + domain = lib.mkOption { + description = "Domain name sans protocol scheme."; + type = lib.types.str; + default = "tempo.${config.networking.domain}"; + }; + }; + + config = lib.mkIf cfg.enable { + nixfiles.modules.nginx = { + enable = true; + upstreams.tempo.servers."127.0.0.1:${toString cfg.port}" = { }; + virtualHosts.${cfg.domain} = { + locations."/".proxyPass = "http://tempo"; + extraConfig = libNginx.config.internalOnly; + }; + }; + + services.tempo = { + enable = true; + settings = rec { + multitenancy_enabled = false; + + server = { + http_listen_address = "127.0.0.1"; + http_listen_port = cfg.port; + + grpc_listen_address = "0.0.0.0"; + grpc_listen_port = server.http_listen_port + 1; + + log_format = "logfmt"; + log_level = "warn"; + log_source_ips_enabled = true; + }; + + storage.trace.backend = "local"; + + memberlist = { + bind_port = 7947; + message_history_buffer_bytes = lib.pow 2 13; + }; + + compactor.compaction.block_retention = "168h"; + }; + }; + + topology.nodes.${this.hostname}.services.tempo = { + name = "Tempo"; + icon = "${inputs.homelab-svg-assets}/assets/tempo.svg"; + info = cfg.domain; + details.listen.text = "127.0.0.1:${toString cfg.port}"; + }; + }; +} |