FinanFut Watchtower
Plataforma interna de monitoritzacio d'errors per a l'ecosistema FinanFut.
La v1 esta enfocada en capturar excepcions, agrupar-les per fingerprint, crear issues, mantenir historic d'events, enviar alertes des d'un worker i oferir un SDK Python intern.
Estat Actual
Aquest primer tall implementa:
- Scaffold de backend FastAPI.
- Configuracio amb Pydantic Settings.
- SQLAlchemy 2.x, Alembic i models inicials.
GET /healthziGET /readyz.POST /api/v1/eventsamb HMAC.POST /api/v1/events/batchamb HMAC.- Project keys amb secret rotables i public key estable.
- Fingerprint inicial determinista.
- Scrubbing recursiu de claus sensibles.
- UI React interna per overview, llista d'issues, detall i accions d'estat.
- Retencio d'events antics conservant issues agrupades.
- Outbox d'alertes amb worker, Slack webhook, email via Microsoft Graph i retry amb backoff.
- Login amb sessio cookie
HttpOnlyi MFA TOTP configurable per usuari admin. - SDK Python amb captura manual, FastAPI middleware, logging handler i decorador de jobs.
- Frontend React intern a
frontend/; en produccio es compila dins el Docker de l'API. - Dockerfile, Docker Compose, Render config, GitHub Actions CI/CD, Makefile i tests.
Primer Setup
cp .env.example .env
make install
docker compose up -d postgres
make migrate
.venv/bin/watchtower-admin create-user \
--email admin@finanfut.local \
--password change-me \
--name "Local Admin" \
--alert-email admin@finanfut.local
docker compose up -d app worker frontend
PostgreSQL local de Watchtower es publica a localhost:55432 per evitar col·lisions amb altres serveis locals.
Amb Docker Compose:
- API:
http://localhost:8000 - Frontend React:
http://localhost:5173 - PostgreSQL:
localhost:55432
L'API queda a:
Healthcheck:
curl http://localhost:8000/healthz
Tests
make test
Lint i format:
make lint
make format
Worker
make worker
El worker processa notification_outbox, envia alertes pels canals configurats i reintenta fallades amb backoff.
Per reload automatic en entorns locals que ho suportin:
make dev-reload
Frontend React
docker compose up frontend
Vite queda a http://localhost:5173 i proxyeja /api, /healthz i /readyz al backend local. Per treballar fora de Docker tambe pots fer cd frontend && npm install && npm run dev.
En produccio, el Dockerfile compila frontend/ i FastAPI serveix el build React des del mateix domini que l'API.
Exemple D'Ingesta
Genera una request signada amb Python:
python - <<'PY'
import hashlib, hmac, json, time
secret = "sk_dev_watchtower_change_me"
payload = {
"event_id": "example-event-1",
"service": "billing-api",
"environment": "production",
"release": "billing@local",
"level": "error",
"event": "stripe_webhook_processing_failed",
"message": "Failed to process Stripe webhook",
"exception_type": "StripeSignatureVerificationError",
}
body = json.dumps(payload, separators=(",", ":"), sort_keys=True).encode()
timestamp = str(int(time.time()))
signature = hmac.new(secret.encode(), timestamp.encode() + b"." + body, hashlib.sha256).hexdigest()
print(body.decode())
print(timestamp)
print(signature)
PY
Despres envia el body amb els headers:
curl -X POST http://localhost:8000/api/v1/events \
-H "Content-Type: application/json" \
-H "X-Watchtower-Project-Key: pk_dev_watchtower" \
-H "X-Watchtower-Timestamp: <timestamp>" \
-H "X-Watchtower-Signature: <signature>" \
--data '<json-body>'
Variables Principals
Veure .env.example per la llista completa.
DATABASE_URLWATCHTOWER_SECRET_KEYWATCHTOWER_ADMIN_TOKENWATCHTOWER_SESSION_COOKIE_NAMEWATCHTOWER_SESSION_MAX_AGE_SECONDSWATCHTOWER_SESSION_COOKIE_SECUREWATCHTOWER_TRUSTED_DEVICE_COOKIE_NAMEWATCHTOWER_TRUSTED_DEVICE_MAX_AGE_DAYSWATCHTOWER_INGEST_PROJECT_KEYWATCHTOWER_INGEST_SECRET_KEYWATCHTOWER_MAX_PAYLOAD_BYTESWATCHTOWER_RATE_LIMIT_EVENTS_PER_MINUTEWATCHTOWER_EVENT_RETENTION_DAYSWATCHTOWER_SLACK_WEBHOOK_URLAZURE_TENANT_IDAZURE_CLIENT_IDAZURE_CLIENT_SECRETSMTP_USERSMTP_DEFAULT_FROMWATCHTOWER_ALERT_EMAIL_TO(legacy fallback; policy recipients are preferred)WATCHTOWER_SDK_ENDPOINTWATCHTOWER_SDK_PROJECT_KEYWATCHTOWER_SDK_SECRET_KEYWATCHTOWER_SDK_SERVICE
Documentacio
docs/architecture.mddocs/api-ingestion.mddocs/admin-operations.mddocs/admin-cli.mddocs/alerting.mddocs/sdk-python.mddocs/integrating-python-apps.mddocs/deploy-render.mddocs/security-privacy.mddocs/roadmap.mddocs/future-loki-grafana.md
Properes Tasques
- Primer deploy real a Render amb els secrets configurats i smoke post-deploy.
Metadata
Release files for finanfut-watchtower 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| finanfut_watchtower-0.1.0.tar.gz | 90.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| finanfut_watchtower-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 188.3 kB
Release files / finanfut_watchtower-0.1.0.tar.gz
| Download URL | finanfut_watchtower-0.1.0.tar.gz |
|---|---|
| Size | 90.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2ddf69fdb11efe90c8dea4a8cc7ab7e36d316f7189415e2432178f5691707d9b
|
|
BLAKE2b-256 checksum How to use checksums |
4e674aa1e2fc119c6f18df511ffcc5361e2cab03de4c3a98be59f9994c602a84
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / finanfut_watchtower-0.1.0-py3-none-any.whl
| Download URL | finanfut_watchtower-0.1.0-py3-none-any.whl |
|---|---|
| Size | 98.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
78ae4be39d2000177f80f9e6f79ab7dc10b6ea3adb75e5cbe6010ed2b2dbd7c6
|
|
BLAKE2b-256 checksum How to use checksums |
92d65d541bf873d0965aee1a926ced7d9f39e8870e7c59acc450b45ca7031a88
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Security for finanfut-watchtower 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.