fix: configure gitea webhook auto-deploy, fix NVS CRC, and improve flash UI
- Add deploy-host.sh for webhook-triggered docker redeploy - Update docker-compose.yml and nginx.conf for auto-pull setup - Fix vite.config.js and admin router for deployment environment - Fix NVS CRC seed to use 0xFFFFFFFF to match esp_rom_crc32_le - Add dual-panel flash UI: esptool log + live 115200 serial monitor - Auto-reset device via RTS after flash (no manual power cycle needed) - Clean up Header.jsx debug title text Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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"}
|
||||
|
||||
@@ -60,7 +60,8 @@ ENTRY_TYPE_STRING = 0x21
|
||||
|
||||
|
||||
def _crc32(data: bytes) -> int:
|
||||
return binascii.crc32(data) & 0xFFFFFFFF
|
||||
# ESP-IDF uses 0xFFFFFFFF as the initial CRC seed (matches esp_rom_crc32_le)
|
||||
return binascii.crc32(data, 0xFFFFFFFF) & 0xFFFFFFFF
|
||||
|
||||
|
||||
def _page_header_crc(seq: int, version: int) -> int:
|
||||
|
||||
Reference in New Issue
Block a user