Files
vf-cuda-grid/controller/Dockerfile
T
gx 155038aabb controller: stream watchdog (Phase 1 resilience, issue #3)
StreamWatchdog (watchdog.py) — polls mediamtx /v3/paths/list каждые N sec.
Если ожидаемый path missing > threshold → emit MQTT event stream_lost +
показывает text overlay 'OFFLINE'. При восстановлении — stream_restored +
remove overlay.

Config:
  watchdog:
    enabled: true
    mediamtx_api_url: http://cuda-grid-mediamtx:9997
    poll_interval_sec: 5.0
    lost_threshold_sec: 15.0
    paths:
      - mediamtx_path: live-audio
        instance: tv_grid
        label: Audio
        overlay_when_lost: true

httpx добавлен в Dockerfile.

Сегодняшний incident (audio sidecar потерял connection с mediamtx →
pipeline restart loop) — watchdog обнаружит missing live-audio через
15 sec + покажет TV-side warning. Manual restart audio sidecar still
needed (watchdog auto-restart — Phase 2).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-21 10:07:12 +01:00

42 lines
1.1 KiB
Docker

# cuda-grid-controller — Python sidecar для vf_cuda_grid filter.
FROM python:3.11-slim AS base
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1
WORKDIR /app
# ffmpeg для snapshot endpoint — нужен basic CPU build (RTSP read + PNG output).
# Размер: ~120 MB additional (ffmpeg + libs); приемлемо для controller image.
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*
# Install deps первым layer — пересборка только при изменении pyproject.toml
COPY pyproject.toml ./
RUN pip install --no-cache-dir \
fastapi \
"uvicorn[standard]" \
pydantic \
pydantic-settings \
aiomqtt \
pyzmq \
pyyaml \
structlog \
typer \
sse-starlette \
pillow \
httpx
# Source code
COPY cuda_grid_controller ./cuda_grid_controller
COPY examples ./examples
RUN pip install --no-cache-dir -e .
EXPOSE 8080
ENTRYPOINT ["cuda-grid-controller"]
CMD ["--config", "/app/controller.yaml"]