Files
operating-room-monitor-server/backend/.env.example
Kevin 30e6acea70 Replace chain 1 with RTSP slice batch pipeline and add 24h segment TTL.
Route live recording through ffmpeg MP4 segments and the 5.15 batch subprocess, remove simulated RTSP chain 2, purge expired slices on startup and hourly, and expose TTL settings to the demo client.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-25 10:24:25 +08:00

111 lines
5.5 KiB
Plaintext
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 复制为 `backend/.env` 并按环境填写。在 `backend/` 目录执行:`docker compose up -d --build`
# 详细说明见 docs/Docker部署.md 与 docs/video-backends.md。
# 算法、管线、归档路径、视觉/语音日志等非部署项见 `app/baked/algorithm.py` 与 `app/baked/pipeline.py`。
#
# 5-6 ActionFormer 实时算法(默认开启):
# - app/resources/actionformer_epoch_045.pth.tar 必须存在(离线下发,~110MB未入 git
# - VideoSwin Swin3D-T 走 torchvision Kinetics-400 预训练,**首次运行需联网下载**
# 可设 TORCH_HOME 指向持久化目录(容器中已默认 /root/.cache/torch或将权重
# 提前预热到该目录避免开录时拉取。
# - Linux GPU 机:镜像内 torch / torchvision / torchaudio 为 cu130 wheel
# 宿主机需 NVIDIA 驱动 + NVIDIA Container Toolkit`api` 服务已配置 `gpus: all`。
# 启动后可验证docker compose exec api python -c "import torch; print(torch.cuda.is_available())"
# --- PostgreSQL ---
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=operation_room
# 以下两项供宿主机工具连库调试API 容器内使用 POSTGRES_HOST=db、POSTGRES_PORT=5432由 compose 注入)。
POSTGRES_HOST=localhost
POSTGRES_PORT=45432
# 可选:整串 async DSN会覆盖与默认一致的 POSTGRES_* 组合时的逻辑,见 Settings
# DATABASE_URL=postgresql+asyncpg://postgres:postgres@localhost:45432/operation_room
# 可选:映射 PostgreSQL 到宿主机端口(默认 45432仅 DBA/调试用途
# DOCKER_POSTGRES_PUBLISH_PORT=45432
# --- HTTPAPI 对外端口)---
# 局域网语音确认终端 / Demo 客户端访问 API 时,填写
# http://<GPU服务器局域网IP>:38080 作为服务端 Base URL。
# API_PORT=38080
# --- GPU 推理(可选覆盖,默认自动选 cuda:0---
# CONSUMABLE_CLASSIFIER_DEVICE=cuda:0
# HAND_DETECTION_DEVICE=cuda:0
# --- VideoRTSP 与按路后端(须与客户端 camera_ids 一致)---
# 单路 RTSP 首次打开超时(秒);四路须在「该值 + 5」秒内全部就绪穿透/公网链路可调大(默认 45
# VIDEO_OPEN_TIMEOUT_SEC=45
# VIDEO_DEFAULT_BACKEND=rtsp
# VIDEO_CAMERA_BACKEND_OVERRIDES_JSON={"or-cam-01":"rtsp","or-cam-02":"hikvision_sdk"}
# 站点 JSON术间↔摄像头↔语音终端只在这里维护voice_or_room_bindings须同时含 video_rtsp_urls可为 []。
# 见 app/resources/or_site_config.sample.json
# OR_SITE_CONFIG_JSON_FILE=app/resources/or_site_config.sample.json
# VIDEO_RTSP_URL_TEMPLATE=rtsp://user:pass@host:554/path/{camera_id}
#
# 语音终端 ID 在站点 JSON 的 voice_or_room_bindings 中配置浏览器语音确认页clients/voice-confirmation/)在页面内填写本机终端 ID。
#
# API 在 Docker 内访问宿主机 RTSP 时使用 host.docker.internalcompose 已配置 extra_hosts
# OpenCV/FFmpeg 拉 RTSP 默认使用 TCP仅当必须让 FFmpeg 自选传输时在 .env 中设空覆盖:
# OPENCV_FFMPEG_CAPTURE_OPTIONS=
# --- 海康 SDKLinux x86_64二进制勿提交仓库---
# HIKVISION_LIB_DIR=/opt/hikvision/lib
# 可选:单一路径,见 app/services/video/hikvision_runtime.py 直读 HIKVISION_LIB_PATH
# HIKVISION_LIB_PATH=
# HIKVISION_SDK_ENABLED=false
# HIKVISION_DEVICE_IP=
# HIKVISION_USER=
# HIKVISION_PASSWORD=
# HIKVISION_CHANNEL=1
# HIKVISION_PREVIEW_RTSP_TEMPLATE=rtsp://{user}:{password}@{ip}:554/Streaming/Channels/101
# HIKVISION_CAMERA_RTSP_URLS_JSON={}
# HIKVISION_SDK_FALLBACK_TO_RTSP=true
# --- 百度(语音:短语音识别 AipSpeech + 在线合成;控制台开通对应能力)---
# BAIDU_APP_ID=
# BAIDU_API_KEY=
# BAIDU_SECRET_KEY=
# 可选
# BAIDU_CONNECTION_TIMEOUT_MS=
# BAIDU_SOCKET_TIMEOUT_MS=
# BAIDU_ASR_DEV_PID=1537
# --- MinIO语音 WAV---
# 容器内 API 默认通过 DOCKER_MINIO_ENDPOINT=minio:9000 访问;以下为 compose 默认值。
# MINIO_ENDPOINT=127.0.0.1:19000
# MINIO_ACCESS_KEY=minioadmin
# MINIO_SECRET_KEY=minioadmin
# MINIO_BUCKET=operation-room-voice
# MINIO_SECURE=false
# MINIO_REGION=
# MINIO_PORT=19000
# MINIO_CONSOLE_PORT=19001
# --- 视频RTSP 切片 + batch链路 1---
# RTSP_PRIMARY_CAMERA_ID=or-cam-03
# RTSP_RECORD_ALL_CAMERAS=false
# RTSP_SEGMENT_DURATION_SEC=120
# RTSP_SEGMENT_MIN_SEC=10
# RTSP_SEGMENT_TTL_HOURS=24
# RTSP_SLICE_BATCH_MAX_CONCURRENT=1
# RTSP_SLICE_BATCH_DRAIN_TIMEOUT_SEC=900
# --- Demo 客户端 / 语音确认客户端 ---
# 独立部署的 Demo 客户端 / 语音确认页访问 API 时需放行 CORS正式部署建议收窄 origins。
# DEMO_CORS_ENABLED=true
# 跨主机语音页访问 API 时,可先用 * 联调;生产建议改成具体语音页来源,如 http://192.168.1.100:8080
# DEMO_CORS_ORIGINS=*
# 链路 3离线 batchDemo 需开启;链路 1 真 RTSP 开录不依赖此项
# DEMO_ORCHESTRATOR_ENABLED=false
# 联调台 HLSCompose先 docker compose up -d mediamtx-hls api
# Compose 内 api 反代侧车DEMO_HLS_PREVIEW_UPSTREAM=http://mediamtx-hls:8888
# 本机 uvicorn 直连 published 端口DEMO_HLS_PREVIEW_UPSTREAM=http://127.0.0.1:18888
# 本机 uvicorn 且无 mediamtx-hls 侧车时改为DEMO_HLS_PREVIEW_UPSTREAM=ephemeral
# DEMO_HLS_PREVIEW_PORT=18888
# HLS 预览 MediaMTX 镜像Compose mediamtx-hls 与 ensure 临时容器共用)
# MEDIAMTX_DOCKER_IMAGE=m.daocloud.io/docker.io/bluenviron/mediamtx:latest
# --- 语音确认静态页clients/voice-confirmation/start.sh---
# 默认 0.0.0.0 供局域网内语音终端访问;仅本机调试时可设 127.0.0.1
# VOCH_HTTP_BIND=0.0.0.0