feat: declarative probes for uptime-kuma
All checks were successful
Check meta / check_meta (push) Successful in 24s
Check meta / check_meta (pull_request) Successful in 26s
Check meta / check_dns (push) Successful in 52s
Check meta / check_dns (pull_request) Successful in 53s
build configuration / build_vault01 (pull_request) Successful in 59s
build configuration / build_storage01 (pull_request) Successful in 1m9s
build configuration / build_compute01 (pull_request) Successful in 1m16s
build configuration / build_web02 (pull_request) Successful in 57s
build configuration / build_web01 (pull_request) Successful in 1m39s
build configuration / build_rescue01 (pull_request) Successful in 1m1s
build configuration / push_to_cache (pull_request) Successful in 2m42s
build configuration / build_vault01 (push) Successful in 1m9s
build configuration / build_storage01 (push) Successful in 1m10s
build configuration / build_compute01 (push) Successful in 1m16s
build configuration / build_web02 (push) Successful in 53s
build configuration / build_rescue01 (push) Successful in 57s
lint / check (push) Successful in 25s
build configuration / build_web01 (push) Successful in 1m35s
build configuration / push_to_cache (push) Successful in 2m12s

This commit is contained in:
sinavir 2024-04-20 14:37:31 +02:00
parent c4154e0a35
commit 20d3354a4d
5 changed files with 225 additions and 42 deletions

View file

@ -2,4 +2,4 @@ let
lib = import ../../../lib { };
publicKeys = lib.getNodeKeys "rescue01";
in
lib.setDefault { inherit publicKeys; } [ ]
lib.setDefault { inherit publicKeys; } [ "stateless-uptime-kuma-password" ]

View file

@ -0,0 +1,28 @@
age-encryption.org/v1
-> ssh-ed25519 jIXfPA wZdqi7vBlMEOJiY1VvbsmqyBSO/jl6SWLRGw+0ylKWo
UvKyh4Jh608Z9i9+6WuPu3mwnlC98aAr6jiV38JJGzk
-> ssh-ed25519 QlRB9Q +DUjR2Wqwg2SevBY+YgvLEDkcnoWGRTfcVFbl27CQT4
poWQnP4cOQGc5Xhgrgz2KKEOJ8dB+iCcqME5D/zJv5c
-> ssh-ed25519 r+nK/Q GsidIKDaPJmx8igrgoAbWGywJQB0nV/cY8Zm0CIByho
m4HrxUhPkp7gahyLO2gfQUnglkB715jaCrADg77ns34
-> ssh-rsa krWCLQ
VwNy3N6+l3Vg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+͸Z‰ñjá×=Ï<Ï%Út뮪

View file

@ -1,9 +1,116 @@
{
lib,
nodes,
config,
sources,
...
}:
let
inherit (config.statelessUptimeKuma.lib)
pingProbesFromHive
fromHive
httpProbesFromConfig
probesWithTag
;
host = "status.dgnum.eu";
port = 3001;
httpExcludes = [
"localhost"
"ens.cal.dgnum.eu"
"luj-current.cal.dgnum.eu"
"s3.dgnum.eu"
"cdn.dgnum.eu"
"saml-idp.dgnum.eu"
"status.dgnum.eu"
] ++ nodes.web01.config.dgn-redirections.retired;
extraProbes = {
monitors = {
"prometheus.dgnum.eu" = {
type = lib.mkForce "http";
accepted_statuscodes = [ "401" ];
};
"api.meet.dgnum.eu" = {
keyword = "Crab Fit API";
};
};
};
status_pages = {
"dgnum" = {
title = "DGNum";
description = "Etat de l'infra de la DGNum";
showTags = true;
publicGroupList = [
{
name = "Services";
weight = 1;
monitorList = builtins.attrNames (
probesWithTag { name = "Service"; } config.statelessUptimeKuma.probesConfig
);
}
{
name = "Serveurs";
weight = 2;
monitorList = builtins.attrNames (
probesWithTag { name = "Ping"; } config.statelessUptimeKuma.probesConfig
);
}
{
name = "VPN Interne";
weight = 2;
monitorList = builtins.attrNames (
probesWithTag { name = "VPN"; } config.statelessUptimeKuma.probesConfig
);
}
];
};
};
pingProbes = pingProbesFromHive {
inherit nodes;
mkHost = _: config: config.networking.fqdn;
tags = [ { name = "Ping"; } ];
excludes = [
"geo01"
"geo02"
"rescue01"
];
};
vpnProbes = pingProbesFromHive {
inherit nodes;
prefix = "VPN - ";
mkHost = node: _: "${node}.dgnum";
tags = [ { name = "VPN"; } ];
excludes = [
"rescue01"
"web02"
];
};
httpProbes = fromHive {
inherit nodes;
builder =
_: module:
httpProbesFromConfig {
inherit (module) config;
tags = [
{
name = "Host";
value = module.config.networking.fqdn;
}
{ name = "Service"; }
];
excludes = httpExcludes;
};
};
in
{
imports = [ (sources.stateless-uptime-kuma + "/nixos/module.nix") ];
nixpkgs.overlays = [ (import (sources.stateless-uptime-kuma + "/overlay.nix")) ];
services.uptime-kuma.enable = true;
services.nginx = {
@ -23,4 +130,22 @@ in
80
443
];
statelessUptimeKuma = {
probesConfig = lib.mkMerge [
pingProbes
httpProbes
extraProbes
vpnProbes
{ inherit status_pages; }
];
extraFlags = [
"-v DEBUG"
"-s"
];
host = "http://localhost:${builtins.toString port}/";
username = "dgnum";
passwordFile = config.age.secrets."stateless-uptime-kuma-password".path;
enableService = true;
};
}

View file

@ -1,4 +1,4 @@
_:
{ lib, config, ... }:
let
retired_host = "retired.dgnum.eu";
@ -28,46 +28,65 @@ let
forceSSL = true;
};
redirections = {
"calendrier.eleves.ens.fr".to = "calendrier.dgnum.eu";
"docs.beta.rz.ens.wtf".to = "pads.dgnum.eu";
"git.rz.ens.wtf".to = "git.dgnum.eu";
"notion.rz.ens.wtf".to = "docs.dgnum.eu";
"nuage.beta.rz.ens.wtf".to = "cloud.dgnum.eu";
"rdv.dgnum.eu".to = "meet.dgnum.eu";
"www.bda.ens.fr".to = "bda.ens.fr";
"bda.wp.dgnum.eu".to = "bda.ens.fr";
"www.tuteurs.ens.fr".to = "tuteurs.ens.fr";
"www.interq.ens.fr".to = "interq.ens.fr";
"www.lanuit.ens.fr".to = "lanuit.ens.fr";
};
retired = mkSubs {
"ens.fr" = [
"alevins"
"www.climatenavigator"
];
"ens.wtf" = [ "photos" ];
"rz.ens.wtf" = [
"s3"
"cdn"
];
"beta.rz.ens.wtf" = [
"todo"
"minecraft"
"factorio"
"home"
"pads"
"api.pads"
"files.pads"
"sandbox.pads"
"jurisprudens"
"rstudio"
];
};
cfg = config.dgn-redirections;
in
{
services.nginx.virtualHosts = {
${retired_host}.default = true;
} // (builtins.mapAttrs mkRedirection redirections) // (mkRetired retired);
options.dgn-redirections = {
redirections = lib.mkOption {
type =
with lib.types;
attrsOf (submodule {
options.to = lib.mkOption { type = str; };
});
default = { };
};
retired = lib.mkOption {
type = with lib.types; listOf str;
default = [ ];
};
};
config = {
dgn-redirections = {
redirections = {
"calendrier.eleves.ens.fr".to = "calendrier.dgnum.eu";
"docs.beta.rz.ens.wtf".to = "pads.dgnum.eu";
"git.rz.ens.wtf".to = "git.dgnum.eu";
"notion.rz.ens.wtf".to = "docs.dgnum.eu";
"nuage.beta.rz.ens.wtf".to = "cloud.dgnum.eu";
"rdv.dgnum.eu".to = "meet.dgnum.eu";
"www.bda.ens.fr".to = "bda.ens.fr";
"bda.wp.dgnum.eu".to = "bda.ens.fr";
"www.tuteurs.ens.fr".to = "tuteurs.ens.fr";
"www.interq.ens.fr".to = "interq.ens.fr";
"www.lanuit.ens.fr".to = "lanuit.ens.fr";
};
retired = mkSubs {
"ens.fr" = [
"alevins"
"www.climatenavigator"
];
"ens.wtf" = [ "photos" ];
"rz.ens.wtf" = [
"s3"
"cdn"
];
"beta.rz.ens.wtf" = [
"todo"
"minecraft"
"factorio"
"home"
"pads"
"api.pads"
"files.pads"
"sandbox.pads"
"jurisprudens"
"rstudio"
];
};
};
services.nginx.virtualHosts = {
${retired_host}.default = true;
} // (builtins.mapAttrs mkRedirection cfg.redirections) // (mkRetired cfg.retired);
};
}

View file

@ -167,6 +167,17 @@
"url": "https://github.com/cachix/pre-commit-hooks.nix/archive/40e6053ecb65fcbf12863338a6dcefb3f55f1bf8.tar.gz",
"hash": "0xibcl3546fqv9g2wmjv6350glp61ld3m8n5yqjx0y5dn73apj4w"
},
"stateless-uptime-kuma": {
"type": "Git",
"repository": {
"type": "Git",
"url": "https://git.dgnum.eu/mdebray/stateless-uptime-kuma"
},
"branch": "master",
"revision": "c6baf60295e4bee4e4c13cf5c628ccd3ab89b141",
"url": null,
"hash": "1ivkvvq4jz5kh873jppypnhzm3vb8gdrvia7zsy67p6wnvzvhxkv"
},
"wp4nix": {
"type": "Git",
"repository": {