feat: auto-start stopped containers on boot, add failure recovery tests

Added start_stopped_containers() to crash_recovery.rs that starts all
exited/created containers on backend startup, fixing the issue where
containers didn't come back after clean reboot (PID marker removed by
systemd stop). Created test-failure-recovery.sh covering 5 failure
scenarios: container crash, backend restart, Tor restart, full reboot,
and Tor traffic block (UPTIME-02).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-13 03:55:14 +00:00
co-authored by Claude Opus 4.6
parent 4500e949d8
commit 3e121b525f
4 changed files with 232 additions and 1 deletions
+9
View File
@@ -76,6 +76,15 @@ async fn main() -> Result<()> {
);
}
// Start any stopped containers (handles clean reboot where PID was removed)
let boot_report = crash_recovery::start_stopped_containers().await;
if boot_report.total > 0 {
info!(
"🔄 Boot startup: {}/{} containers started (failed: {:?})",
boot_report.recovered, boot_report.total, boot_report.failed
);
}
// Write PID marker so we can detect crashes on next startup
crash_recovery::write_pid_marker(&config.data_dir).await?;