1 { config, lib, pkgs, ... }:
6 cfg = config.services.trickster;
10 (mkRenamedOptionModule [ "services" "trickster" "origin" ] [ "services" "trickster" "origin-url" ])
14 services.trickster = {
18 description = lib.mdDoc ''
25 default = pkgs.trickster;
26 defaultText = literalExpression "pkgs.trickster";
27 description = lib.mdDoc ''
28 Package that should be used for trickster.
32 configFile = mkOption {
33 type = types.nullOr types.path;
35 description = lib.mdDoc ''
36 Path to configuration file.
40 instance-id = mkOption {
41 type = types.nullOr types.int;
43 description = lib.mdDoc ''
44 Instance ID for when running multiple processes (default null).
48 log-level = mkOption {
51 description = lib.mdDoc ''
52 Level of Logging to use (debug, info, warn, error) (default "info").
56 metrics-port = mkOption {
59 description = lib.mdDoc ''
60 Port that the /metrics endpoint will listen on.
64 origin-type = mkOption {
65 type = types.enum [ "prometheus" "influxdb" ];
66 default = "prometheus";
67 description = lib.mdDoc ''
68 Type of origin (prometheus, influxdb)
72 origin-url = mkOption {
74 default = "http://prometheus:9090";
75 description = lib.mdDoc ''
76 URL to the Origin. Enter it like you would in grafana, e.g., http://prometheus:9090 (default http://prometheus:9090).
80 profiler-port = mkOption {
81 type = types.nullOr types.port;
83 description = lib.mdDoc ''
84 Port that the /debug/pprof endpoint will listen on.
88 proxy-port = mkOption {
91 description = lib.mdDoc ''
92 Port that the Proxy server will listen on.
99 config = mkIf cfg.enable {
100 systemd.services.trickster = {
101 description = "Reverse proxy cache and time series dashboard accelerator";
102 after = [ "network.target" ];
103 wantedBy = [ "multi-user.target" ];
107 ${cfg.package}/bin/trickster \
108 -log-level ${cfg.log-level} \
109 -metrics-port ${toString cfg.metrics-port} \
110 -origin-type ${cfg.origin-type} \
111 -origin-url ${cfg.origin-url} \
112 -proxy-port ${toString cfg.proxy-port} \
113 ${optionalString (cfg.configFile != null) "-config ${cfg.configFile}"} \
114 ${optionalString (cfg.profiler-port != null) "-profiler-port ${cfg.profiler-port}"} \
115 ${optionalString (cfg.instance-id != null) "-instance-id ${cfg.instance-id}"}
117 ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
123 meta.maintainers = with maintainers; [ _1000101 ];