fix: configure gitea webhook auto-deploy and fix provisioning NVS flash

- Add deploy-host.sh script for webhook-triggered docker redeploy
- Mark deploy-host.sh executable in .gitignore / git config
- Update docker-compose.yml and nginx.conf for auto-pull setup
- Fix vite.config.js and admin router for deployment environment
- Fix NVS generator CRC seed to match ESP-IDF esp_rom_crc32_le

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-27 09:14:58 +02:00
parent 57259c2c2f
commit 6eda151f06
7 changed files with 42 additions and 31 deletions

View File

@@ -42,23 +42,12 @@ async def deploy(request: Request):
logger.info("Auto-deploy triggered via Gitea webhook")
project_path = settings.deploy_project_path
cmd = f"cd {project_path} && git pull origin main && docker compose up -d --build"
try:
proc = await asyncio.create_subprocess_shell(
cmd,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.STDOUT,
)
stdout, _ = await asyncio.wait_for(proc.communicate(), timeout=300)
output = stdout.decode(errors="replace") if stdout else ""
# Write a trigger file to the host-mounted project path.
# A host-side watcher service (bellsystems-deploy-watcher) polls for this
# file and runs deploy-host.sh as the bellsystems user when it appears.
trigger_path = f"{settings.deploy_project_path}/.deploy-trigger"
with open(trigger_path, "w") as f:
f.write("deploy\n")
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 trigger file written")
return {"ok": True, "message": "Deploy started"}