2d95ae50a5
- 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
56 lines
1.5 KiB
Plaintext
56 lines
1.5 KiB
Plaintext
# Sidecar V2 — Nginx reverse proxy config (reference)
|
|
# Place at /etc/nginx/sites-available/sidecar-v2.conf
|
|
# SSL certs managed by certbot or manually
|
|
|
|
upstream sidecar_v2_main {
|
|
server 127.0.0.1:9190;
|
|
}
|
|
|
|
upstream sidecar_v2_metrics {
|
|
server 127.0.0.1:9191;
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl http2;
|
|
server_name sidecar.example.com;
|
|
|
|
ssl_certificate /etc/ssl/certs/sidecar.pem;
|
|
ssl_certificate_key /etc/ssl/private/sidecar.key;
|
|
|
|
# Dashboard + Admin API (main port)
|
|
location / {
|
|
proxy_pass http://sidecar_v2_main;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
}
|
|
|
|
# SSE support for dashboard real-time data
|
|
location /dashboard/sse {
|
|
proxy_pass http://sidecar_v2_main;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Connection "";
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_buffering off;
|
|
proxy_cache off;
|
|
chunked_transfer_encoding off;
|
|
proxy_read_timeout 86400s;
|
|
}
|
|
|
|
# Prometheus metrics
|
|
location /metrics {
|
|
proxy_pass http://sidecar_v2_metrics;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
}
|
|
|
|
# Health check
|
|
location /health {
|
|
proxy_pass http://sidecar_v2_main;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
}
|
|
} |