ci: align deployment on Kuby (Docker + rsync + SSH key + healthcheck + rollback)
- Add HTTP /health endpoint (aiohttp) for Docker healthcheck + post-deploy check - Dockerfile HEALTHCHECK hits /health; docker-compose exposes 1890, container vision-bot - scripts/deploy_runner.sh runs on .117 (docker compose build/restart) - .forgejo/workflows/deploy.yml: single job on omhk-deploy runner (clone, syntax test, rsync, deploy, health check, auto-rollback) like Kuby - .forgejo/workflows/ci.yml: single job (ruff + pytest) on dev/PR
This commit is contained in:
parent
e32ca9c8fb
commit
e22a98a4a3
8 changed files with 308 additions and 48 deletions
27
health.py
Normal file
27
health.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import logging
|
||||
|
||||
from aiohttp import web
|
||||
|
||||
logger = logging.getLogger("vision")
|
||||
|
||||
|
||||
async def start_health_server(port: int, host: str = "0.0.0.0"):
|
||||
"""Demarre un mini serveur HTTP expose par le conteneur Docker.
|
||||
|
||||
Le runner de deploiement interroge /health pour valider le demarrage
|
||||
(health check post-deploy, comme Kuby).
|
||||
"""
|
||||
|
||||
async def health(_request: web.Request) -> web.Response:
|
||||
return web.Response(text='{"status":"ok"}', content_type="application/json")
|
||||
|
||||
app = web.Application()
|
||||
app.router.add_get("/health", health)
|
||||
app.router.add_get("/api/health", health)
|
||||
|
||||
runner = web.AppRunner(app)
|
||||
await runner.setup()
|
||||
site = web.TCPSite(runner, host, port)
|
||||
await site.start()
|
||||
logger.info("Health server demarre sur %s:%s", host, port)
|
||||
return runner
|
||||
Loading…
Add table
Add a link
Reference in a new issue