feat: Add Uptime Kuma monitoring service

This commit is contained in:
pazpi 2024-11-29 16:15:54 +01:00
parent 15ce2146e3
commit 57ac788c6f
2 changed files with 61 additions and 0 deletions

View file

@ -3,5 +3,6 @@
./grafana.nix ./grafana.nix
./loki.nix ./loki.nix
./prometheus.nix ./prometheus.nix
./uptime-kuma.nix
]; ];
} }

View file

@ -0,0 +1,60 @@
{
lib,
config,
pkgs,
...
}:
let
cfg = config.my.monitoring.uptime-kuma;
port = 3001;
in
{
options.my.monitoring.uptime-kuma = {
enable = lib.mkEnableOption "Enable Uptime Kuma module";
proxy = {
enable = lib.mkEnableOption "Set the proxy entry for this service";
domain = lib.mkOption {
default = "example.com";
type = lib.types.str;
description = ''
The domain where Caddy is reachable
'';
};
host = lib.mkOption {
default = "localhost";
type = lib.types.str;
description = ''
host name where the service is running
'';
};
};
};
config = lib.mkMerge [
(lib.mkIf cfg.enable {
services.uptime-kuma = {
enable = true;
settings = {
HOST = "::";
PORT = toString port;
};
};
})
(lib.mkIf cfg.proxy.enable {
services.caddy = with cfg.proxy; {
virtualHosts."up.${domain}".extraConfig = ''
reverse_proxy http://${host}:${port}
import cloudflare
'';
};
})
];
}