feat: Sidecar V2 — multi-pool provider proxy with 429 cooldown

- proxy.py: Fix route path duplication (v1/v1 → v1) when upstream
  base URL already includes /v1 prefix
- proxy.py: Fix _emergency_count global variable for metrics tracking
- server.py: Add logging.basicConfig(level=logging.INFO) for structlog
  INFO-level log visibility
- Full multi-pool routing: primary → fallback → emergency passthrough
- Per-backend rate limiting with RPM-based token bucket
- 429 cooldown mechanism with automatic recovery
- Dashboard with SSE real-time monitoring
- Admin API for backend/pool/config management
- SQLite-backed persistence with encrypted API key storage
- Docker compose deployment

Deployed by opengineer 严维序 as BIZ-50 Step 4
This commit is contained in:
2026-06-25 21:20:32 +08:00
commit 2d95ae50a5
26 changed files with 3625 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
# Sidecar V2 — Multi-Pool Provider Proxy
services:
sidecar-v2:
build: .
container_name: sidecar-v2
restart: unless-stopped
ports:
- "9190:9190" # Main proxy + admin API + dashboard
- "9191:9191" # Prometheus metrics
env_file:
- .env
environment:
- SIDECAR_HOST=0.0.0.0
- SIDECAR_PORT=9190
- SIDECAR_METRICS_PORT=9191
- SIDECAR_DB_PATH=/app/data/sidecar_v2.db
- SIDECAR_BACKUP_DIR=/app/data/backups
volumes:
- sidecar-data:/app/data
volumes:
sidecar-data:
driver: local