- Added support for limiting concurrent transcoding operations in the media API to prevent resource exhaustion. - Implemented functions to retrieve video duration and bitrate using ffprobe for improved streaming performance. - Enhanced the generate_transcoded_stream function to handle HTTP range requests, allowing for more efficient video playback. - Updated VideoModal component to disable fluid and responsive modes, ensuring proper container boundaries during video playback. - Improved logging throughout the transcoding process for better error tracking and debugging.
161 lines
4.2 KiB
YAML
161 lines
4.2 KiB
YAML
services:
|
|
api:
|
|
build:
|
|
context: ./camera-management-api
|
|
dockerfile: Dockerfile
|
|
working_dir: /app
|
|
volumes:
|
|
- ./camera-management-api:/app
|
|
- /mnt/nfs_share:/mnt/nfs_share
|
|
- /etc/localtime:/etc/localtime:ro
|
|
- /etc/timezone:/etc/timezone:ro
|
|
environment:
|
|
- PYTHONUNBUFFERED=1
|
|
- LD_LIBRARY_PATH=/usr/local/lib:/lib:/usr/lib
|
|
- PYTHONPATH=/app:/app/camera_sdk
|
|
- TZ=America/New_York
|
|
- MEDIAMTX_HOST=localhost
|
|
- MEDIAMTX_RTSP_PORT=8554
|
|
command: >
|
|
sh -lc "
|
|
apt-get update && apt-get install -y libusb-1.0-0-dev ffmpeg;
|
|
|
|
# Install camera SDK if not already installed
|
|
if [ ! -f /lib/libMVSDK.so ] && [ -f 'camera_sdk/linuxSDK_V2.1.0.49(250108)/install.sh' ]; then
|
|
echo 'Installing camera SDK...';
|
|
cd 'camera_sdk/linuxSDK_V2.1.0.49(250108)';
|
|
chmod +x install.sh;
|
|
./install.sh;
|
|
cd /app;
|
|
echo 'Camera SDK installed successfully';
|
|
else
|
|
echo 'Camera SDK already installed or install script not found';
|
|
fi;
|
|
|
|
# Install Python dependencies
|
|
if [ -f requirements.txt ]; then
|
|
pip install --no-cache-dir -r requirements.txt;
|
|
else
|
|
pip install --no-cache-dir -e .;
|
|
fi;
|
|
|
|
# Start the application
|
|
python main.py --config config.compose.json
|
|
"
|
|
network_mode: host
|
|
|
|
web:
|
|
image: node:20-alpine
|
|
working_dir: /app
|
|
env_file:
|
|
- ./management-dashboard-web-app/.env
|
|
volumes:
|
|
- ./management-dashboard-web-app:/app
|
|
environment:
|
|
- CHOKIDAR_USEPOLLING=true
|
|
- TZ=America/New_York
|
|
command: >
|
|
sh -lc "
|
|
npm install;
|
|
npm run dev -- --host 0.0.0.0 --port 8080
|
|
"
|
|
# Ensure the web container can resolve host.docker.internal on Linux
|
|
extra_hosts:
|
|
- "host.docker.internal:host-gateway"
|
|
ports:
|
|
- "8080:8080"
|
|
|
|
video-remote:
|
|
image: node:20-alpine
|
|
working_dir: /app
|
|
environment:
|
|
- CHOKIDAR_USEPOLLING=true
|
|
- TZ=America/New_York
|
|
- VITE_MEDIA_API_URL=http://exp-dash:8090
|
|
- VITE_VISION_API_URL=http://exp-dash:8000
|
|
volumes:
|
|
- ./video-remote:/app
|
|
command: >
|
|
sh -lc "
|
|
npm install;
|
|
npm run dev:watch
|
|
"
|
|
extra_hosts:
|
|
- "host.docker.internal:host-gateway"
|
|
ports:
|
|
- "3001:3001"
|
|
|
|
vision-system-remote:
|
|
image: node:20-alpine
|
|
working_dir: /app
|
|
environment:
|
|
- CHOKIDAR_USEPOLLING=true
|
|
- TZ=America/New_York
|
|
- VITE_VISION_API_URL=http://exp-dash:8000
|
|
volumes:
|
|
- ./vision-system-remote:/app
|
|
command: >
|
|
sh -lc "
|
|
npm install;
|
|
npm run dev:watch
|
|
"
|
|
extra_hosts:
|
|
- "host.docker.internal:host-gateway"
|
|
ports:
|
|
- "3002:3002"
|
|
|
|
scheduling-remote:
|
|
image: node:20-alpine
|
|
working_dir: /app
|
|
env_file:
|
|
- ./management-dashboard-web-app/.env
|
|
environment:
|
|
- CHOKIDAR_USEPOLLING=true
|
|
- TZ=America/New_York
|
|
volumes:
|
|
- ./scheduling-remote:/app
|
|
command: >
|
|
sh -lc "
|
|
npm install;
|
|
npm run dev:watch
|
|
"
|
|
extra_hosts:
|
|
- "host.docker.internal:host-gateway"
|
|
ports:
|
|
- "3003:3003"
|
|
|
|
media-api:
|
|
build:
|
|
context: ./media-api
|
|
dockerfile: Dockerfile
|
|
environment:
|
|
- MEDIA_VIDEOS_DIR=/mnt/nfs_share
|
|
- MEDIA_THUMBS_DIR=/mnt/nfs_share/.thumbnails
|
|
- MAX_CONCURRENT_TRANSCODING=2 # Limit concurrent transcoding operations
|
|
volumes:
|
|
- /mnt/nfs_share:/mnt/nfs_share
|
|
ports:
|
|
- "8090:8090"
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '4' # Limit to 4 CPU cores (adjust based on your system)
|
|
memory: 2G # Limit to 2GB RAM per container
|
|
reservations:
|
|
cpus: '1' # Reserve at least 1 CPU core
|
|
memory: 512M # Reserve at least 512MB RAM
|
|
# Alternative syntax for older Docker Compose versions:
|
|
# cpus: '4'
|
|
# mem_limit: 2g
|
|
# mem_reservation: 512m
|
|
|
|
mediamtx:
|
|
image: bluenviron/mediamtx:latest
|
|
volumes:
|
|
- ./mediamtx.yml:/mediamtx.yml:ro
|
|
- /mnt/nfs_share:/mnt/nfs_share:ro
|
|
ports:
|
|
- "8554:8554" # RTSP
|
|
- "8889:8889" # WebRTC HTTP API
|
|
- "8189:8189" # WebRTC UDP
|