Compare commits

...

6 commits

Author SHA1 Message Date
Kiara Grouwstra 660122477f re-enable sub-domains to monitor 2024-09-28 22:24:55 +02:00
Kiara Grouwstra 524b598b2c rename kuma option to status 2024-09-28 22:22:28 +02:00
Kiara Grouwstra be0863836d move kuma overlay to flake.nix 2024-09-28 22:20:34 +02:00
Kiara Grouwstra feebc56f97 add subdomain status to TF (dnsimple, gandi) 2024-09-28 22:18:05 +02:00
Kiara Grouwstra cdfe405e96 add uptime-kuma to public01 2024-09-28 22:14:42 +02:00
Kiara Grouwstra 1f05410770 feat(monitoring): add uptime-kuma for status page, see #97
Adds a config for a status page using uptime-kuma.
Open questions here included:
- what machine to run this on
(and if a new one how to configure their network bits);
- who could help set the secret in the age file;
- who could set up the application password (currently a manual step in
services.uptime-kuma), after which the stateless client can be re-built;
- what to monitor -- i for now commented some sub-domains i could not
publicly access to test.
2024-09-27 08:49:21 +02:00
7 changed files with 122 additions and 0 deletions

View file

@ -715,6 +715,7 @@
], ],
"nix-gerrit": "nix-gerrit", "nix-gerrit": "nix-gerrit",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs_2",
"stateless-uptime-kuma": "stateless-uptime-kuma",
"terranix": "terranix" "terranix": "terranix"
} }
}, },
@ -763,6 +764,22 @@
"type": "github" "type": "github"
} }
}, },
"stateless-uptime-kuma": {
"flake": false,
"locked": {
"lastModified": 1713725430,
"narHash": "sha256-e3a4/7bc3GO8/kfFndtDa4/6ob3+XjkOgrN8SfDec8c=",
"ref": "refs/heads/master",
"rev": "c6baf60295e4bee4e4c13cf5c628ccd3ab89b141",
"revCount": 22,
"type": "git",
"url": "https://git.dgnum.eu/DGNum/stateless-uptime-kuma.git"
},
"original": {
"type": "git",
"url": "https://git.dgnum.eu/DGNum/stateless-uptime-kuma.git"
}
},
"systems": { "systems": {
"locked": { "locked": {
"lastModified": 1681028828, "lastModified": 1681028828,

View file

@ -28,6 +28,9 @@
channel-scripts.url = "git+https://git.lix.systems/the-distro/channel-scripts.git"; channel-scripts.url = "git+https://git.lix.systems/the-distro/channel-scripts.git";
channel-scripts.inputs.nixpkgs.follows = "nixpkgs"; channel-scripts.inputs.nixpkgs.follows = "nixpkgs";
stateless-uptime-kuma.url = "git+https://git.dgnum.eu/DGNum/stateless-uptime-kuma.git";
stateless-uptime-kuma.flake = false;
lix.follows = "hydra/lix"; lix.follows = "hydra/lix";
grapevine = { grapevine = {
@ -55,6 +58,7 @@
inputs.lix.overlays.default inputs.lix.overlays.default
inputs.nix-gerrit.overlays.default inputs.nix-gerrit.overlays.default
inputs.channel-scripts.overlays.default inputs.channel-scripts.overlays.default
(import "${inputs.stateless-uptime-kuma}/overlay.nix")
]; ];
}; };
terraform = pkgs.opentofu; terraform = pkgs.opentofu;

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.status = {
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 @@
./hydra ./hydra
./matrix ./matrix
./monitoring ./monitoring
./uptime-kuma
./netbox ./netbox
./ofborg ./ofborg
./postgres ./postgres

View file

@ -0,0 +1,93 @@
{
inputs,
lib,
config,
...
}:
let
cfg = config.bagel.status;
# TODO: pull domains from a central place
subdomains = [
"cl"
"netbox"
"cache"
"grafana"
"hydra"
"loki"
"mimir"
"pyroscope"
"matrix"
"tempo"
"amqp"
"fodwatch"
"git"
"alerts"
"buildbot"
"b"
"postgres"
"news"
];
port = 3001;
in
{
imports = [ "${inputs.stateless-uptime-kuma}/nixos/module.nix" ];
options.bagel.status = {
enable = lib.mkEnableOption "the status page service (uptime-kuma)";
domain = lib.mkOption {
type = lib.types.str;
};
};
config = lib.mkIf cfg.enable {
services.uptime-kuma.enable = true;
services.nginx = {
enable = true;
virtualHosts.${cfg.domain} = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://127.0.0.1:${builtins.toString port}";
proxyWebsockets = true;
};
};
};
networking.firewall.allowedTCPPorts = [
80
443
];
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;
};
};
}

View file

@ -114,6 +114,7 @@ in
(record "b" 300 "CNAME" "public01.infra.p.forkos.org") (record "b" 300 "CNAME" "public01.infra.p.forkos.org")
(record "postgres" 300 "CNAME" "bagel-box.infra.p.forkos.org") (record "postgres" 300 "CNAME" "bagel-box.infra.p.forkos.org")
(record "news" 3600 "CNAME" "public01.infra.p.forkos.org") (record "news" 3600 "CNAME" "public01.infra.p.forkos.org")
(record "status" 3600 "CNAME" "public01.infra.p.forkos.org")
# S3 in delroth's basement # S3 in delroth's basement
(record "cache" 300 "AAAA" "2a02:168:6426::12") # smol.delroth.net (record "cache" 300 "AAAA" "2a02:168:6426::12") # smol.delroth.net

View file

@ -88,6 +88,7 @@ in
(record "b" 300 "CNAME" ["public01.infra.p"]) (record "b" 300 "CNAME" ["public01.infra.p"])
(record "postgres" 300 "CNAME" ["bagel-box.infra.p"]) (record "postgres" 300 "CNAME" ["bagel-box.infra.p"])
(record "news" 3600 "CNAME" ["public01.infra.p"]) (record "news" 3600 "CNAME" ["public01.infra.p"])
(record "status" 3600 "CNAME" ["public01.infra.p"])
# S3 in delroth's basement # S3 in delroth's basement
(record "cache" 300 "AAAA" ["2a02:168:6426::12"]) # smol.delroth.net (record "cache" 300 "AAAA" ["2a02:168:6426::12"]) # smol.delroth.net