fix(reboot): enable podman-restart.service at startup (--restart reboot-survival)

Orchestrator-installed backends (immich, btcpay-db, …) run as plain podman
`--restart=unless-stopped` containers until the Phase-3 Quadlet rollout flips
use_quadlet_backends on. Nothing in the codebase enabled the user's
podman-restart.service, so those containers had NO reboot-survival mechanism.
Enable it (idempotent, best-effort) at orchestrator startup so unless-stopped
containers come back after a reboot. Already applied manually on .228 (covers
31 containers incl. immich + btcpay); this codifies it fleet-wide.

The deeper fix (render Quadlet for all orchestrator installs) remains the gated
Phase-3 Quadlet-everywhere rollout.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
archipelago 2026-06-21 08:23:19 -04:00
parent d5ef45731a
commit f160e0c404

View File

@ -206,6 +206,27 @@ async fn main() -> Result<()> {
tracing::error!(error = %e, "prod orchestrator: load_manifests failed at startup");
}
}
// Reboot-survival safety net for the podman `--restart` path: ensure the
// user's podman-restart.service is enabled so `unless-stopped` containers
// come back after a reboot even when the Quadlet backend path is off
// (orchestrator-installed backends like immich/btcpay run as plain podman
// containers until the Phase-3 Quadlet rollout). Idempotent + best-effort.
{
let out = tokio::process::Command::new("systemctl")
.args(["--user", "enable", "--now", "podman-restart.service"])
.output()
.await;
match out {
Ok(o) if o.status.success() => {
info!("🔁 podman-restart.service enabled (reboot-survival for --restart containers)")
}
Ok(o) => tracing::debug!(
"podman-restart.service enable skipped: {}",
String::from_utf8_lossy(&o.stderr).trim()
),
Err(e) => tracing::debug!("podman-restart.service enable skipped: {e}"),
}
}
// Adoption pass: link existing podman containers back to their
// manifests so the reconciler doesn't recreate them.
match tokio::time::timeout(Duration::from_secs(35), prod.adopt_existing()).await {