feat: show why units failed, with their last journal lines
Failed jobs keep their kind: units that broke or timed out get a failure panel entry with the reason systemd reports (exit status, signal, timeout, start limit, status text) and their last journal lines read through libsystemd. Units that failed only through a dependency are dimmed and left out of the panel, and units that crash after starting count as failed. Restructure the repository around this: - move the library and binary into bootvine/ and the scripted demos into their own unpublished scripted-demos crate, with their VHS tapes - move the crane builds and NixOS module into nix/ - group each sample VM with its check under vm-tests/, adding text-console, scripted-initrd, encrypted-volume and failures machines and a vm-failures check - add docs/guide.md walking through the screen with every recording, keep one recording in the README, and re-render all recordings
This commit is contained in:
1 parent
f2544a964a
commit
7e95cbd8e9
96 files changed
+2027
-462
No files matched your search
@@ -0,0 +1,148 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
startedByHand = config.bootvineSample.startFailuresByHand;
|
||||
wantedAtBoot = target: lib.optional (!startedByHand) target;
|
||||
|
||||
failingService =
|
||||
{
|
||||
description,
|
||||
script,
|
||||
serviceConfig ? { },
|
||||
unitConfig ? { },
|
||||
extraAttributes ? { },
|
||||
}:
|
||||
{
|
||||
inherit description unitConfig;
|
||||
wantedBy = wantedAtBoot "multi-user.target";
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = pkgs.writeShellScript "failing-service" script;
|
||||
}
|
||||
// serviceConfig;
|
||||
}
|
||||
// extraAttributes;
|
||||
|
||||
initrdFirmwareScript = pkgs.writeShellScript "initrd-nic-firmware-load" ''
|
||||
echo "loading firmware for enp1s0 (r8169)"
|
||||
echo "firmware: rtl_nic/rtl8168h-2.fw not found" >&2
|
||||
exit 1
|
||||
'';
|
||||
in
|
||||
{
|
||||
options.bootvineSample.startFailuresByHand = lib.mkEnableOption ''
|
||||
leaving the failing sample units out of the boot targets, so a check can
|
||||
start them one at a time
|
||||
'';
|
||||
|
||||
config = {
|
||||
boot.initrd.systemd = {
|
||||
storePaths = [
|
||||
initrdFirmwareScript
|
||||
"${pkgs.bash}/bin/bash"
|
||||
];
|
||||
services.initrd-nic-firmware-load = {
|
||||
description = "Network card firmware";
|
||||
wantedBy = wantedAtBoot "initrd.target";
|
||||
before = [ "initrd.target" ];
|
||||
unitConfig.DefaultDependencies = false;
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${pkgs.bash}/bin/bash ${initrdFirmwareScript}";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services = {
|
||||
app-config-check = failingService {
|
||||
description = "Application configuration check";
|
||||
script = ''
|
||||
echo "reading /etc/app/app.toml"
|
||||
echo "config: /etc/app/app.toml: missing key 'listen'" >&2
|
||||
exit 2
|
||||
'';
|
||||
};
|
||||
|
||||
worker-pool = failingService {
|
||||
description = "Worker pool";
|
||||
script = ''
|
||||
echo "starting worker pool with 4 threads"
|
||||
kill -SEGV $$
|
||||
'';
|
||||
};
|
||||
|
||||
license-server-wait = failingService {
|
||||
description = "License server check";
|
||||
script = ''
|
||||
echo "waiting for license server at 10.0.0.9:27000"
|
||||
sleep infinity
|
||||
'';
|
||||
serviceConfig.TimeoutStartSec = 4;
|
||||
};
|
||||
|
||||
metrics-agent = {
|
||||
description = "Metrics agent";
|
||||
wantedBy = wantedAtBoot "multi-user.target";
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "/usr/bin/metrics-agent --listen :9100";
|
||||
};
|
||||
};
|
||||
|
||||
http-listener = failingService {
|
||||
description = "HTTP listener";
|
||||
script = ''
|
||||
echo "bind 0.0.0.0:8080: address already in use" >&2
|
||||
exit 1
|
||||
'';
|
||||
serviceConfig = {
|
||||
Restart = "on-failure";
|
||||
RestartSec = "200ms";
|
||||
};
|
||||
unitConfig = {
|
||||
StartLimitBurst = 3;
|
||||
StartLimitIntervalSec = 30;
|
||||
};
|
||||
};
|
||||
|
||||
database-client = failingService {
|
||||
description = "Database client";
|
||||
script = ''
|
||||
systemd-notify --status="Cannot reach database at db.internal:5432"
|
||||
echo "connect db.internal:5432: connection refused" >&2
|
||||
exit 1
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "notify";
|
||||
NotifyAccess = "all";
|
||||
};
|
||||
};
|
||||
|
||||
upstream-uplink = failingService {
|
||||
description = "Upstream uplink";
|
||||
script = ''
|
||||
echo "connected to upstream"
|
||||
sleep 3
|
||||
echo "lost connection to upstream, giving up" >&2
|
||||
exit 1
|
||||
'';
|
||||
serviceConfig.Type = "simple";
|
||||
};
|
||||
|
||||
failure-report = failingService {
|
||||
description = "Failure report";
|
||||
script = ''
|
||||
echo "all checks passed"
|
||||
'';
|
||||
extraAttributes = {
|
||||
requires = [ "app-config-check.service" ];
|
||||
after = [ "app-config-check.service" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user