parent
e26d4dd255
commit
6796f8daa6
@ -0,0 +1,70 @@ |
|||||||
|
{ config, lib, pkgs, domain, ... }: |
||||||
|
|
||||||
|
with lib; |
||||||
|
|
||||||
|
let |
||||||
|
cfg = config.infra.gatus; |
||||||
|
in { |
||||||
|
options.infra.gatus = { |
||||||
|
enable = mkEnableOption "Gatus status page behind nginx"; |
||||||
|
|
||||||
|
hostname = mkOption { |
||||||
|
type = types.str; |
||||||
|
default = "status.${domain}"; |
||||||
|
description = "Virtual host name serving the Gatus status page"; |
||||||
|
}; |
||||||
|
|
||||||
|
port = mkOption { |
||||||
|
type = types.port; |
||||||
|
default = 8081; |
||||||
|
description = "Port Gatus listens on locally"; |
||||||
|
}; |
||||||
|
|
||||||
|
title = mkOption { |
||||||
|
type = types.str; |
||||||
|
default = "Status"; |
||||||
|
description = "Title shown in the Gatus UI"; |
||||||
|
}; |
||||||
|
|
||||||
|
endpoints = mkOption { |
||||||
|
type = types.listOf types.attrs; |
||||||
|
default = [ ]; |
||||||
|
description = '' |
||||||
|
Gatus endpoint definitions. |
||||||
|
See https://gatus.io/docs/configure-endpoints |
||||||
|
''; |
||||||
|
}; |
||||||
|
|
||||||
|
extraSettings = mkOption { |
||||||
|
type = types.attrs; |
||||||
|
default = { }; |
||||||
|
description = "Extra settings merged into services.gatus.settings"; |
||||||
|
}; |
||||||
|
}; |
||||||
|
|
||||||
|
config = mkIf cfg.enable { |
||||||
|
services.gatus = { |
||||||
|
enable = true; |
||||||
|
settings = mkMerge [ |
||||||
|
{ |
||||||
|
web.port = cfg.port; |
||||||
|
storage = { |
||||||
|
type = "sqlite"; |
||||||
|
path = "/var/lib/gatus/data.db"; |
||||||
|
}; |
||||||
|
ui.title = cfg.title; |
||||||
|
endpoints = cfg.endpoints; |
||||||
|
} |
||||||
|
cfg.extraSettings |
||||||
|
]; |
||||||
|
}; |
||||||
|
|
||||||
|
services.nginx = { |
||||||
|
enable = true; |
||||||
|
virtualHosts.${cfg.hostname}.locations."/".proxyPass = |
||||||
|
"http://127.0.0.1:${toString cfg.port}"; |
||||||
|
}; |
||||||
|
|
||||||
|
networking.firewall.allowedTCPPorts = [ 80 443 ]; |
||||||
|
}; |
||||||
|
} |
||||||
Loading…
Reference in new issue