4f415fb500
P0 fixes: - Admin API Bearer Token auth middleware - Encryption key missing -> CRITICAL log + sys.exit(1) - Prometheus metrics endpoint (:9191) - requirements.txt + Dockerfile + docker-compose.yml + systemd + nginx P1 fixes: - Dead code removed from _refresh_cooldowns() - Stream detection fixed (text/event-stream only) - Emergency passthrough (10% RPM retry before 503) - Active health probing for backends - SQLite daily backup loop with retention - Chart.js CDN fallback - Key rotation SOP document - JSON log format support - Deploy files: systemd unit + nginx config BIZ-52 review re-entry Co-authored-by: multica-agent <github@multica.ai>
46 lines
1.2 KiB
Docker
46 lines
1.2 KiB
Docker
# Sidecar V2 — Multi-Pool Provider Proxy
|
|
FROM python:3.12-slim AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Install dependencies
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir --upgrade pip && \
|
|
pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy application code
|
|
COPY config.py crypto.py main.py server.py proxy.py router.py \
|
|
pool_manager.py cooldown_manager.py rate_limiter.py __init__.py \
|
|
dashboard.html ./
|
|
COPY storage/ ./storage/
|
|
|
|
# Create data directory
|
|
RUN mkdir -p /app/data /app/data/backups
|
|
|
|
FROM python:3.12-slim
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy built artifacts
|
|
COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
|
|
COPY --from=builder /app /app
|
|
|
|
# Environment
|
|
ENV SIDECAR_HOST=0.0.0.0
|
|
ENV SIDECAR_PORT=9190
|
|
ENV SIDECAR_METRICS_PORT=9191
|
|
ENV SIDECAR_DB_PATH=/app/data/sidecar_v2.db
|
|
ENV SIDECAR_BACKUP_DIR=/app/data/backups
|
|
ENV SIDECAR_ENCRYPTION_KEY=
|
|
ENV SIDECAR_ADMIN_TOKEN=
|
|
ENV LOG_FORMAT=json
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
EXPOSE 9190 9191
|
|
|
|
VOLUME ["/app/data"]
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
|
|
CMD python3 -c "import urllib.request; urllib.request.urlopen('http://localhost:9190/health')" || exit 1
|
|
|
|
ENTRYPOINT ["python3", "main.py"] |