1 { config, lib, pkgs, ... }:
6 cfg = config.services.trickster;
10 (mkRenamedOptionModule [ "services" "trickster" "origin" ] [ "services" "trickster" "origin-url" ])
14 services.trickster = {
23 package = mkPackageOption pkgs "trickster" { };
25 configFile = mkOption {
26 type = types.nullOr types.path;
29 Path to configuration file.
33 instance-id = mkOption {
34 type = types.nullOr types.int;
37 Instance ID for when running multiple processes (default null).
41 log-level = mkOption {
45 Level of Logging to use (debug, info, warn, error) (default "info").
49 metrics-port = mkOption {
53 Port that the /metrics endpoint will listen on.
57 origin-type = mkOption {
58 type = types.enum [ "prometheus" "influxdb" ];
59 default = "prometheus";
61 Type of origin (prometheus, influxdb)
65 origin-url = mkOption {
67 default = "http://prometheus:9090";
69 URL to the Origin. Enter it like you would in grafana, e.g., http://prometheus:9090 (default http://prometheus:9090).
73 profiler-port = mkOption {
74 type = types.nullOr types.port;
77 Port that the /debug/pprof endpoint will listen on.
81 proxy-port = mkOption {
85 Port that the Proxy server will listen on.
92 config = mkIf cfg.enable {
93 systemd.services.trickster = {
94 description = "Reverse proxy cache and time series dashboard accelerator";
95 after = [ "network.target" ];
96 wantedBy = [ "multi-user.target" ];
100 ${cfg.package}/bin/trickster \
101 -log-level ${cfg.log-level} \
102 -metrics-port ${toString cfg.metrics-port} \
103 -origin-type ${cfg.origin-type} \
104 -origin-url ${cfg.origin-url} \
105 -proxy-port ${toString cfg.proxy-port} \
106 ${optionalString (cfg.configFile != null) "-config ${cfg.configFile}"} \
107 ${optionalString (cfg.profiler-port != null) "-profiler-port ${cfg.profiler-port}"} \
108 ${optionalString (cfg.instance-id != null) "-instance-id ${cfg.instance-id}"}
110 ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
116 meta.maintainers = with maintainers; [ _1000101 ];