mirror of
https://github.com/JulienMalka/snowfield.git
synced 2025-03-25 21:30:52 +01:00
feat: finish stateless uptime kuma monitors configuration
This commit is contained in:
parent
305070d9b1
commit
04f9dd2d7c
5 changed files with 27 additions and 3 deletions
|
@ -121,6 +121,9 @@
|
||||||
|
|
||||||
security.acme.certs."ca.luj".server = lib.mkForce "https://127.0.0.1:8444/acme/acme/directory";
|
security.acme.certs."ca.luj".server = lib.mkForce "https://127.0.0.1:8444/acme/acme/directory";
|
||||||
|
|
||||||
|
machine.meta.monitors."ca.luj - IPv4".url = lib.mkForce "https://100.100.45.14/health";
|
||||||
|
machine.meta.monitors."ca.luj - IPv6".url = lib.mkForce "https://[fd7a:115c:a1e0::e]/health";
|
||||||
|
|
||||||
systemd.services."step-ca".after = [ "keycloak.service" ];
|
systemd.services."step-ca".after = [ "keycloak.service" ];
|
||||||
|
|
||||||
# TODO: Remove when keycloak is update in stable channel
|
# TODO: Remove when keycloak is update in stable channel
|
||||||
|
|
|
@ -1,9 +1,17 @@
|
||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
|
lib,
|
||||||
|
nixosConfigurations,
|
||||||
config,
|
config,
|
||||||
inputs,
|
inputs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
let
|
||||||
|
|
||||||
|
probesFromConfig = lib.mkMerge (
|
||||||
|
lib.mapAttrsToList (_: value: value.config.machine.meta.monitors) nixosConfigurations
|
||||||
|
);
|
||||||
|
in
|
||||||
{
|
{
|
||||||
|
|
||||||
services.uptime-kuma = {
|
services.uptime-kuma = {
|
||||||
|
@ -30,6 +38,7 @@
|
||||||
|
|
||||||
statelessUptimeKuma = {
|
statelessUptimeKuma = {
|
||||||
enableService = true;
|
enableService = true;
|
||||||
|
probesConfig.monitors = probesFromConfig;
|
||||||
extraFlags = [
|
extraFlags = [
|
||||||
"-s"
|
"-s"
|
||||||
"-v DEBUG"
|
"-v DEBUG"
|
||||||
|
|
|
@ -133,6 +133,9 @@
|
||||||
root = "/home/gitlab-runner/artifacts";
|
root = "/home/gitlab-runner/artifacts";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
machine.meta.monitors."phd.julienmalka.me - IPv4".accepted_statuscodes = [ "401" ];
|
||||||
|
machine.meta.monitors."phd.julienmalka.me - IPv6".accepted_statuscodes = [ "401" ];
|
||||||
|
|
||||||
systemd.services.nginx.serviceConfig.ProtectHome = "read-only";
|
systemd.services.nginx.serviceConfig.ProtectHome = "read-only";
|
||||||
systemd.services.nginx.serviceConfig.ReadWritePaths = [ "/home/gitlab-runner/artifacts" ];
|
systemd.services.nginx.serviceConfig.ReadWritePaths = [ "/home/gitlab-runner/artifacts" ];
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
{ lib, profiles, ... }:
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
profiles,
|
||||||
|
...
|
||||||
|
}:
|
||||||
{
|
{
|
||||||
options.machine.meta = lib.mkOption {
|
options.machine.meta = lib.mkOption {
|
||||||
description = "Machine metadata";
|
description = "Machine metadata";
|
||||||
|
@ -38,6 +43,11 @@
|
||||||
default = with profiles; [ base ];
|
default = with profiles; [ base ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
monitors = mkOption {
|
||||||
|
default = { };
|
||||||
|
type = types.attrsOf (pkgs.formats.json { }).type;
|
||||||
|
};
|
||||||
|
|
||||||
defaultInterface = mkOption {
|
defaultInterface = mkOption {
|
||||||
description = "default interface of the machine";
|
description = "default interface of the machine";
|
||||||
default = "ens18";
|
default = "ens18";
|
||||||
|
|
|
@ -59,7 +59,7 @@ in
|
||||||
'';
|
'';
|
||||||
|
|
||||||
systemConfig = _: {
|
systemConfig = _: {
|
||||||
statelessUptimeKuma.probesConfig.monitors = lib.mkIf (name != "default") {
|
machine.meta.monitors = lib.mkIf (name != "default") {
|
||||||
"${name} - IPv4" = {
|
"${name} - IPv4" = {
|
||||||
url = "https://${
|
url = "https://${
|
||||||
if (hasSuffix "luj" name) then
|
if (hasSuffix "luj" name) then
|
||||||
|
@ -167,7 +167,6 @@ in
|
||||||
];
|
];
|
||||||
|
|
||||||
machine = mergeSub (c: c.machine);
|
machine = mergeSub (c: c.machine);
|
||||||
statelessUptimeKuma = mergeSub (c: c.statelessUptimeKuma);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue