fix: trying to fix auto-pulls 13 !

This commit is contained in:
2026-02-27 05:45:18 +02:00
parent 96385d85a8
commit d341cccc8a

View File

@@ -50,21 +50,15 @@ async def deploy(request: Request):
f"git reset --hard origin/main && "
f"docker-compose up -d --build"
)
try:
proc = await asyncio.create_subprocess_shell(
# Fire and forget — run deploy in background so we can respond before
# the container restarts (which would kill this very process).
await asyncio.create_subprocess_shell(
cmd,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.STDOUT,
stdout=asyncio.subprocess.DEVNULL,
stderr=asyncio.subprocess.DEVNULL,
start_new_session=True,
)
stdout, _ = await asyncio.wait_for(proc.communicate(), timeout=300)
output = stdout.decode(errors="replace") if stdout else ""
if proc.returncode != 0:
logger.error(f"Deploy failed (exit {proc.returncode}):\n{output}")
raise HTTPException(status_code=500, detail=f"Deploy script failed:\n{output[-500:]}")
logger.info(f"Deploy succeeded:\n{output[-300:]}")
return {"ok": True, "output": output[-1000:]}
except asyncio.TimeoutError:
raise HTTPException(status_code=504, detail="Deploy timed out after 300 seconds")
logger.info("Auto-deploy started in background")
return {"ok": True, "message": "Deploy started"}