add uptime-kuma to public01

This commit is contained in:
Kiara Grouwstra 2024-09-28 22:14:42 +02:00
parent 1f05410770
commit cdfe405e96
2 changed files with 58 additions and 44 deletions

View file

@ -9,6 +9,11 @@
# TODO: make it the default # TODO: make it the default
networking.domain = "infra.forkos.org"; networking.domain = "infra.forkos.org";
bagel.uptime-kuma = {
enable = true;
domain = "status.forkos.org";
};
bagel.sysadmin.enable = true; bagel.sysadmin.enable = true;
# Newsletter is proxied. # Newsletter is proxied.
bagel.raito.v6-proxy-awareness.enable = true; bagel.raito.v6-proxy-awareness.enable = true;

View file

@ -5,6 +5,7 @@
... ...
}: }:
let let
cfg = config.bagel.uptime-kuma;
subdomains = [ subdomains = [
"cl" "cl"
"netbox" "netbox"
@ -25,61 +26,69 @@ let
# "postgres" # "postgres"
# "news" # "news"
]; ];
host = "status.forkos.org";
port = 3001; port = 3001;
in in
{ {
imports = [ "${inputs.stateless-uptime-kuma}/nixos/module.nix" ]; imports = [ "${inputs.stateless-uptime-kuma}/nixos/module.nix" ];
nixpkgs.overlays = [ (import "${inputs.stateless-uptime-kuma}/overlay.nix") ];
services.uptime-kuma.enable = true; options.bagel.uptime-kuma = {
enable = lib.mkEnableOption "the status page service (uptime-kuma)";
services.nginx = { domain = lib.mkOption {
enable = true; type = lib.types.str;
virtualHosts.${host} = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://127.0.0.1:${builtins.toString port}";
proxyWebsockets = true;
};
}; };
}; };
networking.firewall.allowedTCPPorts = [ config = lib.mkIf cfg.enable {
80 nixpkgs.overlays = [ (import "${inputs.stateless-uptime-kuma}/overlay.nix") ];
443
];
statelessUptimeKuma = { services.uptime-kuma.enable = true;
probesConfig = {
monitors = lib.genAttrs subdomains (name: { services.nginx = {
type = "http"; enable = true;
url = "https://${name}.forkos.org/"; virtualHosts.${cfg.domain} = {
tags = []; enableACME = true;
}); forceSSL = true;
status_pages = { locations."/" = {
"forkos" = { proxyPass = "http://127.0.0.1:${builtins.toString port}";
title = "ForkOS"; proxyWebsockets = true;
description = "health of the ForkOS infra";
showTags = true;
publicGroupList = [
{
name = "Services";
weight = 1;
monitorList = lib.genAttrs subdomains (id: {
inherit id;
});
}
];
}; };
}; };
}; };
extraFlags = [ "-s" ];
host = "http://localhost:${builtins.toString port}/"; networking.firewall.allowedTCPPorts = [
username = "forkos"; 80
passwordFile = config.age.secrets."stateless-uptime-kuma-password".path; 443
enableService = true; ];
statelessUptimeKuma = {
probesConfig = {
monitors = lib.genAttrs subdomains (name: {
type = "http";
url = "https://${name}.forkos.org/";
tags = [];
});
status_pages = {
"forkos" = {
title = "ForkOS";
description = "health of the ForkOS infra";
showTags = true;
publicGroupList = [
{
name = "Services";
weight = 1;
monitorList = lib.genAttrs subdomains (id: {
inherit id;
});
}
];
};
};
};
extraFlags = [ "-s" ];
host = "http://localhost:${builtins.toString port}/";
username = "forkos";
passwordFile = config.age.secrets."stateless-uptime-kuma-password".path;
enableService = true;
};
}; };
} }