mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 21:01:34 +01:00
Simplify config for gatus endpoints
This commit is contained in:
parent
f65bf51905
commit
6c0ff3393b
9 changed files with 29 additions and 61 deletions
|
|
@ -25,7 +25,5 @@ in
|
|||
inherit (cfg) port;
|
||||
};
|
||||
};
|
||||
|
||||
custom.services.gatus.endpoints."Actual Budget".url = "https://${cfg.domain}/";
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,13 +93,5 @@ in
|
|||
"d ${config.services.forgejo.customDir}/public 750 ${user} ${group} - -"
|
||||
"L+ ${config.services.forgejo.customDir}/public/robots.txt 750 - - - ${disallow-all-robots}"
|
||||
];
|
||||
|
||||
custom.services.gatus.endpoints = {
|
||||
"Forgejo" = {
|
||||
url = "https://${cfg.domain}/api/healthz";
|
||||
extraConditions = [ "[BODY].status == pass" ];
|
||||
};
|
||||
"Forgejo SSH".url = "ssh://${cfg.domain}";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,4 @@
|
|||
{
|
||||
config,
|
||||
self,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.custom.services.gatus;
|
||||
in
|
||||
|
|
@ -36,6 +31,10 @@ in
|
|||
type = lib.types.nonEmptyStr;
|
||||
default = "";
|
||||
};
|
||||
appendPath = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
};
|
||||
extraConditions = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.nonEmptyStr;
|
||||
default = [ ];
|
||||
|
|
@ -58,6 +57,14 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
custom.services.gatus.endpoints =
|
||||
let
|
||||
getSubdomain = domain: domain |> lib.splitString "." |> lib.head;
|
||||
in
|
||||
config.meta.domains.globalList
|
||||
|> lib.map (domain: lib.nameValuePair (getSubdomain domain) { url = "https://${domain}"; })
|
||||
|> lib.listToAttrs;
|
||||
|
||||
services.gatus = {
|
||||
enable = true;
|
||||
environmentFile = config.sops.templates."gatus.env".path;
|
||||
|
|
@ -99,6 +106,7 @@ in
|
|||
name,
|
||||
group,
|
||||
url,
|
||||
appendPath,
|
||||
extraConditions,
|
||||
}:
|
||||
let
|
||||
|
|
@ -106,9 +114,9 @@ in
|
|||
deducedGroup = if isPrivate then "Private" else "Public";
|
||||
in
|
||||
{
|
||||
inherit name url;
|
||||
group = if group == null then deducedGroup else group;
|
||||
interval = "30s";
|
||||
inherit name;
|
||||
group = if group != null then group else deducedGroup;
|
||||
url = url + appendPath;
|
||||
alerts = [ { type = "ntfy"; } ];
|
||||
ssh = lib.mkIf (lib.hasPrefix "ssh" url) {
|
||||
username = "";
|
||||
|
|
@ -125,20 +133,14 @@ in
|
|||
in
|
||||
[
|
||||
{
|
||||
name = "Healthchecks.io";
|
||||
name = "healthchecks.io";
|
||||
group = "Monitoring";
|
||||
url = "https://hc-ping.com/\${HEALTHCHECKS_PING_KEY}/gatus-uptime?create=1";
|
||||
url = "https://hc-ping.com/\${HEALTHCHECKS_PING_KEY}/${config.networking.hostName}-gatus-uptime?create=1";
|
||||
interval = "2h";
|
||||
conditions = [ "[STATUS] == 200" ];
|
||||
}
|
||||
]
|
||||
++ (
|
||||
self.nixosConfigurations
|
||||
|> lib.mapAttrsToList (_: value: value.config.custom.services.gatus.endpoints)
|
||||
|> lib.map (entry: lib.mapAttrsToList (_: value: value) entry)
|
||||
|> lib.concatLists
|
||||
|> lib.map (entry: mkEndpoint entry)
|
||||
);
|
||||
++ (cfg.endpoints |> lib.mapAttrsToList (_: value: value) |> lib.map (entry: mkEndpoint entry));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -79,10 +79,5 @@ in
|
|||
};
|
||||
|
||||
environment.shellAliases.hedgedoc-manage-users = "sudo --user=${user} ${manage_users}";
|
||||
|
||||
custom.services.gatus.endpoints."Hedgedoc" = {
|
||||
url = "https://${cfg.domain}/_health";
|
||||
extraConditions = [ "[BODY].ready == true" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,10 +29,5 @@ in
|
|||
root = "${pkgs.it-tools}/lib";
|
||||
configuration.general.health = true;
|
||||
};
|
||||
|
||||
custom.services.gatus.endpoints."IT Tools" = {
|
||||
url = "https://${cfg.domain}/health";
|
||||
extraConditions = [ "[BODY] == OK" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,14 +72,5 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
custom.services.gatus.endpoints."Nextcloud" = {
|
||||
url = "https://${cfg.domain}/status.php";
|
||||
extraConditions = [
|
||||
"[BODY].installed == true"
|
||||
"[BODY].maintenance == false"
|
||||
"[BODY].needsDbUpgrade == false"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,11 +27,5 @@ in
|
|||
web-root = "disable";
|
||||
};
|
||||
};
|
||||
|
||||
custom.services.gatus.endpoints."Ntfy" = {
|
||||
group = "Monitoring";
|
||||
url = "https://${cfg.domain}/v1/health";
|
||||
extraConditions = [ "[BODY].healthy == true" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,13 +97,5 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
custom.services.gatus.endpoints = lib.mkIf cfg.isServer {
|
||||
"Syncthing".url = "tcp://${config.networking.hostName}.${tailscaleCfg.domain}:22000";
|
||||
"Syncthing GUI" = {
|
||||
url = "https://${cfg.gui.domain}/rest/noauth/health";
|
||||
extraConditions = [ "[BODY].status == OK" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue