Merge pull request #245 from naturallaw777/copilot/fix-reboot-issue-in-sovran-hub

Decouple Hub-triggered reboot from `sovran-hub-web` cgroup via dedicated systemd unit
This commit is contained in:
Sovran_Systems
2026-04-15 10:40:37 -05:00
committed by GitHub
2 changed files with 21 additions and 3 deletions
+13 -3
View File
@@ -69,7 +69,7 @@ NJALLA_SCRIPT = "/var/lib/njalla/njalla.sh"
INTERNAL_IP_FILE = "/var/lib/secrets/internal-ip" INTERNAL_IP_FILE = "/var/lib/secrets/internal-ip"
ZEUS_CONNECT_FILE = "/var/lib/secrets/zeus-connect-url" ZEUS_CONNECT_FILE = "/var/lib/secrets/zeus-connect-url"
REBOOT_COMMAND = ["/run/current-system/sw/bin/systemctl", "reboot"] REBOOT_UNIT = "sovran-hub-reboot.service"
ONBOARDING_FLAG = "/var/lib/sovran/onboarding-complete" ONBOARDING_FLAG = "/var/lib/sovran/onboarding-complete"
AUTOLAUNCH_DISABLE_FLAG = "/var/lib/sovran/hub-autolaunch-disabled" AUTOLAUNCH_DISABLE_FLAG = "/var/lib/sovran/hub-autolaunch-disabled"
@@ -2036,7 +2036,12 @@ async def api_upgrade_to_server():
# Don't rebuild yet — the user needs to configure domains, SSL email, # Don't rebuild yet — the user needs to configure domains, SSL email,
# and ports first via the onboarding wizard. Reboot so onboarding runs. # and ports first via the onboarding wizard. Reboot so onboarding runs.
try: try:
await asyncio.create_subprocess_exec(*REBOOT_COMMAND) proc = await asyncio.create_subprocess_exec(
"/run/current-system/sw/bin/systemctl", "start", "--no-block", REBOOT_UNIT,
stdout=asyncio.subprocess.DEVNULL,
stderr=asyncio.subprocess.DEVNULL,
)
await proc.wait()
except Exception as exc: except Exception as exc:
raise HTTPException(status_code=500, detail=f"Failed to initiate reboot: {exc}") raise HTTPException(status_code=500, detail=f"Failed to initiate reboot: {exc}")
@@ -2860,7 +2865,12 @@ async def api_ping():
@app.post("/api/reboot") @app.post("/api/reboot")
async def api_reboot(): async def api_reboot():
try: try:
await asyncio.create_subprocess_exec(*REBOOT_COMMAND) proc = await asyncio.create_subprocess_exec(
"/run/current-system/sw/bin/systemctl", "start", "--no-block", REBOOT_UNIT,
stdout=asyncio.subprocess.DEVNULL,
stderr=asyncio.subprocess.DEVNULL,
)
await proc.wait()
except Exception: except Exception:
raise HTTPException(status_code=500, detail="Failed to initiate reboot") raise HTTPException(status_code=500, detail="Failed to initiate reboot")
return {"ok": True} return {"ok": True}
+8
View File
@@ -380,6 +380,14 @@ in
}; };
}; };
systemd.services.sovran-hub-reboot = {
description = "Sovran_SystemsOS Reboot";
serviceConfig = {
Type = "oneshot";
ExecStart = "/run/current-system/sw/bin/systemctl reboot";
};
};
environment.systemPackages = [ sovran-hub-web ]; environment.systemPackages = [ sovran-hub-web ];
networking.firewall.allowedTCPPorts = [ 8937 60847 ]; networking.firewall.allowedTCPPorts = [ 8937 60847 ];