Readiness, Electrum status, audit browsing and logs (B-92, API-37, API-46, API-47, AUD-34, AUD-41, ARC-02, ARC-09, ARC-61, ELC-29, SEC-48)

- GET /health/ready (Electrum connected, header < 1800s, scheduler heartbeat < 30s) is the
  container healthcheck; the scheduler beats on every tick and draw-wait iteration
- GET /admin/electrum and an Electrum indicator in /admin (server, header age, last rotation)
- GET /admin/audit-log: before_id, event_type, round_id, user_id, from, to; the panel gets filters
- registration writes user_registered in its transaction
- the app's own logs also go to stdout; uvicorn trusts X-Forwarded-For from Caddy's fixed
  address only, so the access log shows the client's IP

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
davideandClaude Sonnet 5.5 committed 2026-10-18 01:15:22 +02:00
1 parent 9520c80dcf
commit 575f1a5354
23 files changed
+478 -91

No files matched your search

+25
View File
@@ -20,6 +20,9 @@ services:
- DATABASE_URL=sqlite+aiosqlite:////app/db_data/plm_lottery.db
- MASTER_KEY_PATH=/app/key_data/master.xprv.enc
- XPRV_ENCRYPTION_KEY_FILE=/run/secrets/xprv_encryption_key
# B-92 (ARC-02): uvicorn trusts X-Forwarded-For from Caddy's fixed address only, so the access
# log records the client's IP instead of Caddy's.
- FORWARDED_ALLOW_IPS=172.28.0.10
secrets:
- xprv_encryption_key
volumes:
@@ -28,6 +31,18 @@ services:
- ./data/logs:/app/logs
expose:
- "8123"
# B-92 (ARC-61): ready = Electrum connected, a recent header, a live scheduler. Docker does not
# restart an unhealthy container (the process exiting does); the state is for monitoring.
healthcheck:
test:
- CMD
- python
- -c
- "import urllib.request as u; u.urlopen('http://127.0.0.1:8123/health/ready', timeout=4)"
interval: 30s
timeout: 5s
retries: 3
start_period: 60s
depends_on:
data-permissions:
condition: service_completed_successfully
@@ -44,9 +59,19 @@ services:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- caddy_data:/data
- caddy_config:/config
networks:
default:
ipv4_address: 172.28.0.10
depends_on:
- app
# A fixed subnet and a fixed address for Caddy, so uvicorn can trust exactly that one proxy (ARC-02).
networks:
default:
ipam:
config:
- subnet: 172.28.0.0/24
# The Fernet key that protects the master key lives in its own file, outside ./data (a backup of
# the data does not carry both) and in no environment variable (SEC-53).
secrets: