feat: Docker, health check, schema migrations y webhook opt-in
- migrations/001_initial_schema.sql: DDL idempotente con CREATE TABLE/INDEX IF NOT EXISTS - database.py: run_migrations() aplica .sql pendientes en orden; init_db() queda como alias - health.py: servidor aiohttp en puerto 8080 — GET /health, GET /health/history, POST /webhook Watcher loop alerta al admin por Telegram si el poller no actualiza en N horas - config.py: webhook_url, webhook_secret, health_port, health_alert_hours - poller.py: on_poll_done callback (conecta con health.record_poll) - main.py: arranca HealthServer, llama run_migrations, modo webhook opt-in via WEBHOOK_URL - Dockerfile + docker-compose.yml + .dockerignore - pyproject.toml: aiohttp>=3.9 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
20
docker-compose.yml
Normal file
20
docker-compose.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
services:
|
||||
pedrito:
|
||||
build: .
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
ports:
|
||||
- "8080:8080" # health check (y webhook si está configurado)
|
||||
volumes:
|
||||
- ./data:/app/data # snapshot y DB persistentes entre reinicios
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-sf", "http://localhost:8080/health"]
|
||||
interval: 60s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 15s
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
Reference in New Issue
Block a user