blob: 55beb4fa4f541cd9d2f023e8da1a4f9d41ec5136 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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}";
};
};
}
|