- Replace central sentinel with watcher: each node polls peers discovered via a single DNS name with multiple A records (e.g. peers.sentinella.com) - Auto-detect own IPs via hostname -I; SELF env var available as optional override for NAT/floating-IP setups - Fix Basic Auth bug in router.sh: compare tok against AUTH_TOKENS instead of unset $USER/$PASS - Rename sentinel binary to watcher; drop unused shellplot dep - Add inetutils to watcher runtime deps for hostname -I - Update NixOS module: replace sentinel options with watcher p2p options (peersDns, self, peersPort, peersScheme, pollingIntervalSec) - Add sentinèlla test suite: probe-status-empty, probe-disk, watcher-state-file
49 lines
1.1 KiB
Nix
49 lines
1.1 KiB
Nix
{ symlinkJoin, writeTextFile, socat, dash, hectic, curl, gawk, jq, inetutils }:
|
|
let
|
|
shell = "${dash}/bin/dash";
|
|
bashOptions = [
|
|
"errexit"
|
|
"nounset"
|
|
];
|
|
|
|
base64 = hectic.writeShellApplication {
|
|
inherit shell bashOptions;
|
|
name = "base64";
|
|
runtimeInputs = [ ];
|
|
text = builtins.readFile ./base64.sh;
|
|
};
|
|
|
|
probe = hectic.writeShellApplication {
|
|
inherit shell bashOptions;
|
|
name = "probe";
|
|
runtimeInputs = [ socat dash router ];
|
|
text = builtins.readFile ./probe.sh;
|
|
};
|
|
|
|
router = hectic.writeShellApplication {
|
|
inherit shell bashOptions;
|
|
name = "router";
|
|
runtimeInputs = [ base64 gawk ];
|
|
text = ''
|
|
${builtins.readFile ./log.sh}
|
|
${builtins.readFile ./colors.sh}
|
|
${builtins.readFile ./router.sh}
|
|
'';
|
|
};
|
|
|
|
watcher = hectic.writeShellApplication {
|
|
inherit shell bashOptions;
|
|
name = "watcher";
|
|
runtimeInputs = [ curl jq inetutils ];
|
|
text = ''
|
|
${builtins.readFile ./log.sh}
|
|
${builtins.readFile ./colors.sh}
|
|
${builtins.readFile ./watcher.sh}
|
|
'';
|
|
};
|
|
in
|
|
symlinkJoin {
|
|
name = "sentinèlla";
|
|
paths = [ probe watcher ];
|
|
}
|