fix(nixos): senttinèlla-probe: module args
This commit is contained in:
@@ -19,13 +19,15 @@ in {
|
||||
probe = {
|
||||
enable = lib.mkEnableOption "enable sentinèlla probe services, that provides endpoints for server status check";
|
||||
urls = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
type = with lib.types; listOf str;
|
||||
default = [];
|
||||
description = ''
|
||||
urls to check
|
||||
'';
|
||||
};
|
||||
authFile = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
type = with lib.types; nullOr path;
|
||||
default = null;
|
||||
example = ''
|
||||
config.sops.secrets."name-of-service/sentinèlla-probe".path
|
||||
'';
|
||||
@@ -34,19 +36,22 @@ in {
|
||||
'';
|
||||
};
|
||||
volumes = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
type = with lib.types; listOf str;
|
||||
default = [];
|
||||
description = ''
|
||||
volumes to check
|
||||
'';
|
||||
};
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 5988;
|
||||
description = ''
|
||||
service's port
|
||||
'';
|
||||
};
|
||||
environmentPath = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
type = with lib.types; nullOr path;
|
||||
default = null;
|
||||
example = ''
|
||||
config.sops.secrets."name-of-service/environment".path
|
||||
'';
|
||||
@@ -77,34 +82,36 @@ in {
|
||||
};
|
||||
config = lib.mkMerge [
|
||||
(lib.mkIf cfg.probe.enable {
|
||||
systemd.services."sentinèlla-probe" = {
|
||||
systemd.services."sentinella-probe" = {
|
||||
description = "Hectic server health check";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
ExecStart = "${self.packages.${system}."sentinèlla"}/bin/probe";
|
||||
EnvironmentFile = cfg.probe.environmentPath;
|
||||
Environment = (if cfg.probe.urls != null then [
|
||||
"URLS=${cfg.probe.urls}"
|
||||
] else []) ++ (if cfg.probe.volumes != null then [
|
||||
"VOLUMES=${cfg.volumes}"
|
||||
] else []) ++ (if cfg.probe.port != null then [
|
||||
"PORT=${builtins.toString cfg.probe.port}"
|
||||
] else []);
|
||||
Restart = "always";
|
||||
RestartSec = "5s";
|
||||
|
||||
# Shutdown configuration
|
||||
TimeoutStopSec = "30s";
|
||||
KillSignal = "SIGTERM";
|
||||
KillMode = "mixed";
|
||||
|
||||
# Security and process management
|
||||
RemainAfterExit = false;
|
||||
StandardOutput = "journal";
|
||||
StandardError = "journal";
|
||||
};
|
||||
serviceConfig = lib.mkMerge [
|
||||
{
|
||||
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";
|
||||
}
|
||||
(if cfg.probe.environmentPath != null then {
|
||||
EnvironmentFile = cfg.probe.environmentPath;
|
||||
} else {})
|
||||
];
|
||||
};
|
||||
})
|
||||
(lib.mkIf cfg.sentinel.enable {
|
||||
|
||||
Reference in New Issue
Block a user