Files
appRobotWebcam/docker-compose.yaml
2026-06-04 17:56:40 +02:00

91 lines
4.1 KiB
YAML
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.
name: approbotwebcam
# ════════════════════════════════════════════════════════════════════════════
# MJPEG-AUFBAU go2rtc (Streaming) + Node.js (Viewer/Proxy/API)
# ════════════════════════════════════════════════════════════════════════════
#
# Portainer: Stack → Web editor → dieses YAML einfügen → Deploy.
# Vorher in Portainer → "Environment variables":
# APP_PATH = /absoluter/pfad/zum/appRobotWebcam (Code muss dort liegen)
#
# WICHTIG: Vor jedem Redeploy sicherstellen, dass server.js / public/ / src/
# auf dem Server unter APP_PATH aktuell sind (Synology-Sync abwarten).
#
# Firewall (Internet): TCP 8444 (Viewer+API)
# Port 1984 (go2rtc) NICHT nach aussen läuft nur intern via localhost.
# UDP 8555 (WebRTC) wird NICHT verwendet Viewer läuft im MJPEG-Modus.
#
# Zugriff:
# Viewer: http://<host>:8444/
# Snapshot (Homing) http://<host>:8444/api/snapshot/cam0
# go2rtc-Debug-UI http://<host>:1984/ (nur intern/LAN)
# ════════════════════════════════════════════════════════════════════════════
configs:
go2rtc_yaml:
content: |
streams:
# 640x480 MJPEG, Re-Encode in go2rtc (~50% CPU für 2 Kameras mit Clients).
# Viewer läuft im MJPEG-Modus (MODE='mjpeg' in viewer.js) → keine Freezes, ~200ms.
# NICHT #video=copy: am 2026-06-04 getestet → CPU 50% → 107% (schlechter). Verworfen.
cam0: "ffmpeg:device?video=/dev/video0&input_format=mjpeg&video_size=640x480&framerate=30#video=mjpeg"
cam1: "ffmpeg:device?video=/dev/video2&input_format=mjpeg&video_size=640x480&framerate=30#video=mjpeg"
webrtc:
listen: ":8555"
candidates:
- stun:8555
api:
listen: ":1984"
origin: "*"
log:
level: info
services:
# ── go2rtc: Kamera-Capture · MJPEG Re-Encode · Streaming ──────────────────
go2rtc:
image: ghcr.io/alexxit/go2rtc
container_name: AppRobotGo2RTC
restart: unless-stopped
network_mode: host
devices:
- /dev/video0:/dev/video0
- /dev/video2:/dev/video2
group_add:
- video
configs:
- source: go2rtc_yaml
target: /config/go2rtc.yaml
# ── webcam: Node.js (Viewer · /api/ws-Proxy · Snapshot-API) ──────────────
webcam:
build:
context: /tmp
dockerfile_inline: |
FROM node:lts-bookworm-slim
WORKDIR /usr/src/app
EXPOSE 8444
image: approbotwebcam:latest
container_name: AppRobotWebcam
restart: unless-stopped
network_mode: host
command: sh -c "npm install --omit=dev && node server.js"
volumes:
- ${APP_PATH:-.}:/usr/src/app
environment:
- NODE_ENV=production
- PORT=8444
- GO2RTC_URL=http://localhost:1984
depends_on:
- go2rtc
# ── FALLBACK ──────────────────────────────────────────────────────────────────
# Meckert Portainer beim Deploy über "configs content" (sehr alte Compose-Version)?
# → den configs-Block oben löschen und stattdessen beim go2rtc-Service mounten:
# volumes:
# - ${APP_PATH:-.}/go2rtc.yaml:/config/go2rtc.yaml:ro
#
# Bleibt eine Kamera schwarz? → in der Config oben die Quelle ersetzen durch die
# simple, bestätigte Form (ohne Auflösung): "ffmpeg:/dev/video0#video=mjpeg"
# ────────────────────────────────────────────────────────────────────────────────