fix: lib systems
This commit is contained in:
@@ -5,6 +5,20 @@
|
|||||||
|
|
||||||
envErrorMessage = varName: "Error: The ${varName} environment variable is not set.";
|
envErrorMessage = varName: "Error: The ${varName} environment variable is not set.";
|
||||||
|
|
||||||
|
AllSystems = [
|
||||||
|
"aarch64-darwin"
|
||||||
|
"aarch64-linux"
|
||||||
|
"armv5tel-linux"
|
||||||
|
"armv6l-linux"
|
||||||
|
"armv7l-linux"
|
||||||
|
"i686-linux"
|
||||||
|
"mipsel-linux"
|
||||||
|
"powerpc64le-linux"
|
||||||
|
"riscv64-linux"
|
||||||
|
"x86_64-darwin"
|
||||||
|
"x86_64-linux"
|
||||||
|
];
|
||||||
|
|
||||||
commonSystems = [
|
commonSystems = [
|
||||||
"x86_64-linux"
|
"x86_64-linux"
|
||||||
"aarch64-linux"
|
"aarch64-linux"
|
||||||
@@ -28,7 +42,7 @@
|
|||||||
) {}
|
) {}
|
||||||
supportedSystems;
|
supportedSystems;
|
||||||
|
|
||||||
forAllSystemsWithPkgs = pkgOverlays: f: forSystemsWithPkgs commonSystems pkgOverlays f;
|
forAllSystemsWithPkgs = pkgOverlays: f: forSystemsWithPkgs AllSystems pkgOverlays f;
|
||||||
|
|
||||||
parseEnv = import ./parse-env.nix;
|
parseEnv = import ./parse-env.nix;
|
||||||
|
|
||||||
@@ -44,10 +58,10 @@
|
|||||||
else {};
|
else {};
|
||||||
in {
|
in {
|
||||||
# -- For all systems --
|
# -- For all systems --
|
||||||
inherit dotEnv minorEnvironment parseEnv forAllSystemsWithPkgs forSystemsWithPkgs commonSystems;
|
inherit dotEnv minorEnvironment parseEnv forAllSystemsWithPkgs forSystemsWithPkgs commonSystems AllSystems;
|
||||||
|
|
||||||
forSystems = systems: nixpkgs.lib.genAttrs systems;
|
forSystems = systems: nixpkgs.lib.genAttrs systems;
|
||||||
forAllSystems = nixpkgs.lib.genAttrs commonSystems;
|
forAllSystems = nixpkgs.lib.genAttrs AllSystems;
|
||||||
|
|
||||||
shellModules = {
|
shellModules = {
|
||||||
logs = builtins.readFile ./shell/logs.sh;
|
logs = builtins.readFile ./shell/logs.sh;
|
||||||
|
|||||||
@@ -68,6 +68,15 @@ in {
|
|||||||
};
|
};
|
||||||
sentinel = {
|
sentinel = {
|
||||||
enable = lib.mkEnableOption "enable sentinèlla sentinel services, that reported servers statuses based on probe polls";
|
enable = lib.mkEnableOption "enable sentinèlla sentinel services, that reported servers statuses based on probe polls";
|
||||||
|
respondents = lib.mkOption {
|
||||||
|
type = lib.types.listOf lib.types.attrsOf (
|
||||||
|
lib.types.submodule {
|
||||||
|
options = {
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
environmentPath = lib.mkOption {
|
environmentPath = lib.mkOption {
|
||||||
type = lib.types.path;
|
type = lib.types.path;
|
||||||
example = ''
|
example = ''
|
||||||
@@ -115,7 +124,32 @@ in {
|
|||||||
};
|
};
|
||||||
})
|
})
|
||||||
(lib.mkIf cfg.sentinel.enable {
|
(lib.mkIf cfg.sentinel.enable {
|
||||||
|
systemd.services."sentinella-sentinel" = {
|
||||||
|
description = "Hectic server health check";
|
||||||
|
after = [ "network.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "simple";
|
||||||
|
ExecStart = "${self.packages.${system}."sentinèlla"}/bin/probe";
|
||||||
|
Environment = [
|
||||||
|
"URLS=${lib.concatStringsSep "," cfg.probe.urls}"
|
||||||
|
"VOLUMES=${lib.concatStringsSep "," cfg.probe.volumes}"
|
||||||
|
"PORT=${builtins.toString cfg.probe.port}"
|
||||||
|
];
|
||||||
|
Restart = "always";
|
||||||
|
RestartSec = "5s";
|
||||||
|
|
||||||
|
# Shutdown configuration
|
||||||
|
TimeoutStopSec = "30s";
|
||||||
|
KillSignal = "SIGTERM";
|
||||||
|
KillMode = "mixed";
|
||||||
|
|
||||||
|
# Security and process management
|
||||||
|
RemainAfterExit = false;
|
||||||
|
StandardOutput = "journal";
|
||||||
|
StandardError = "journal";
|
||||||
|
};
|
||||||
|
};
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ set -eu
|
|||||||
|
|
||||||
TIMEOUT=${TIMEOUT:-5}
|
TIMEOUT=${TIMEOUT:-5}
|
||||||
POLLING_INTERVAL_SEC=${POLLING_INTERVAL_SEC:-3}
|
POLLING_INTERVAL_SEC=${POLLING_INTERVAL_SEC:-3}
|
||||||
STATE_DIR=${STATE_DIR:-/tmp/sentinel}
|
STATE_DIR=${STATE_DIR:-$(mktemp -d)}
|
||||||
SERVERS=${SERVERS:-}
|
SERVERS=${SERVERS:-}
|
||||||
TOKENS=${TOKENS:-}
|
TOKENS=${TOKENS:-}
|
||||||
TOKEN=${TOKEN:-}
|
TOKEN=${TOKEN:-}
|
||||||
|
|||||||
Reference in New Issue
Block a user