Remove Gatus monitoring

Update unstable and make kubenix follow unstable
This commit is contained in:
Pim Kunis 2024-06-07 21:41:03 +02:00
parent 6e88288658
commit 8dbb42f0ac
3 changed files with 18 additions and 85 deletions

View file

@ -270,21 +270,22 @@
"kubenix": { "kubenix": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_2", "flake-compat": "flake-compat_2",
"nixpkgs": "nixpkgs_2", "nixpkgs": [
"nixpkgs-unstable"
],
"systems": "systems_5", "systems": "systems_5",
"treefmt": "treefmt" "treefmt": "treefmt"
}, },
"locked": { "locked": {
"lastModified": 1715243831, "lastModified": 1717788185,
"narHash": "sha256-i9FA95HFCoaQgsXRJkEAbr0iaWwy1xwuOAsBPEuEgxc=", "narHash": "sha256-Uc6QSQqJa2lyv/1W4StwoKrjtq7cFjlKNhdrtanToGo=",
"owner": "pizzapim", "owner": "pizzapim",
"repo": "kubenix", "repo": "kubenix",
"rev": "79718967fafa379fd958224cb94d68f96da75ecd", "rev": "a9590abe23a2f7577bc3271d90955e9ccc2923fe",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "pizzapim", "owner": "pizzapim",
"ref": "servers",
"repo": "kubenix", "repo": "kubenix",
"type": "github" "type": "github"
} }
@ -398,22 +399,6 @@
} }
}, },
"nixpkgs-unstable": { "nixpkgs-unstable": {
"locked": {
"lastModified": 1716925596,
"narHash": "sha256-+iuYhP5k6PMjfhJjiEfBdaV95qejvGQPutthNpVhss8=",
"owner": "pizzapim",
"repo": "nixpkgs",
"rev": "9548d6e31291da38dc2c7b24a47730c25038a27e",
"type": "github"
},
"original": {
"owner": "pizzapim",
"ref": "gatus",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1717646450, "lastModified": 1717646450,
"narHash": "sha256-KE+UmfSVk5PG8jdKdclPVcMrUB8yVZHbsjo7ZT1Bm3c=", "narHash": "sha256-KE+UmfSVk5PG8jdKdclPVcMrUB8yVZHbsjo7ZT1Bm3c=",
@ -429,7 +414,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_3": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1717555607, "lastModified": 1717555607,
"narHash": "sha256-WZ1s48OODmRJ3DHC+I/DtM3tDRuRJlNqMvxvAPTD7ec=", "narHash": "sha256-WZ1s48OODmRJ3DHC+I/DtM3tDRuRJlNqMvxvAPTD7ec=",
@ -481,7 +466,7 @@
"kubenix": "kubenix", "kubenix": "kubenix",
"nixhelm": "nixhelm", "nixhelm": "nixhelm",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_3", "nixpkgs": "nixpkgs_2",
"nixpkgs-unstable": "nixpkgs-unstable" "nixpkgs-unstable": "nixpkgs-unstable"
} }
}, },

View file

@ -3,12 +3,10 @@
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
nixpkgs-unstable.url = "github:pizzapim/nixpkgs/gatus"; nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
deploy-rs.url = "github:serokell/deploy-rs"; deploy-rs.url = "github:serokell/deploy-rs";
nixos-hardware.url = "github:NixOS/nixos-hardware/master"; nixos-hardware.url = "github:NixOS/nixos-hardware/master";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
kubenix.url = "github:pizzapim/kubenix/servers";
disko = { disko = {
url = "github:nix-community/disko"; url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
@ -33,6 +31,11 @@
url = "git+https://git.kun.is/home/blog-pim"; url = "git+https://git.kun.is/home/blog-pim";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
kubenix = {
url = "github:pizzapim/kubenix";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
}; };
outputs = outputs =

View file

@ -1,13 +1,8 @@
{ lib, pkgs, nixpkgs-unstable, config, machines, ... }: { lib, config, machines, ... }:
let let
cfg = config.lab.monitoring; cfg = config.lab.monitoring;
in in
{ {
imports = [
"${nixpkgs-unstable}/nixos/modules/services/monitoring/gatus.nix"
./gatus-endpoints.nix
];
options = { options = {
lab.monitoring = { lab.monitoring = {
enable = lib.mkOption { enable = lib.mkOption {
@ -48,63 +43,13 @@ in
); );
}; };
services.gatus = lib.mkIf cfg.server.enable {
enable = true;
package = pkgs.unstable.gatus;
settings = {
storage = {
type = "sqlite";
path = "/srv/gatus/gatus.db";
};
alerting.email = {
from = "gatus@kun.is";
host = "mail.smtp2go.com";
port = 2525;
to = "pim@kunis.nl";
client.insecure = true;
default-alert = {
enabled = true;
failure-threshold = 2;
success-threshold = 1;
send-on-resolved = true;
};
};
};
};
users = {
users.gatus = {
isSystemUser = true;
group = "gatus";
};
groups.gatus = { };
};
system.activationScripts = lib.mkIf cfg.server.enable {
gatus = ''
mkdir -p /srv/gatus
chown gatus:gatus /srv/gatus
'';
};
services.nginx = lib.mkIf cfg.server.enable { services.nginx = lib.mkIf cfg.server.enable {
enable = true; enable = true;
virtualHosts."${config.networking.fqdn}" = { virtualHosts."${config.networking.fqdn}" = {
locations = { locations."/prometheus/" = {
"/" = { proxyPass = "http://127.0.0.1:${toString config.services.prometheus.port}";
proxyPass = "http://127.0.0.1:${toString config.services.gatus.settings.web.port}"; recommendedProxySettings = true;
recommendedProxySettings = true;
};
"/prometheus/" = {
proxyPass = "http://127.0.0.1:${toString config.services.prometheus.port}";
recommendedProxySettings = true;
};
}; };
}; };
}; };