90 lines
4.2 KiB
YAML
90 lines
4.2 KiB
YAML
name: approbotwebcam
|
||
|
||
# ════════════════════════════════════════════════════════════════════════════
|
||
# FINALER WebRTC-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+Signaling) · UDP 8555 (WebRTC-Media)
|
||
# Port 1984 (go2rtc) NICHT nach aussen – läuft nur intern via localhost.
|
||
#
|
||
# 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:
|
||
# Komplette go2rtc-Config eingebettet – keine separate Datei nötig.
|
||
content: |
|
||
streams:
|
||
cam0: "ffmpeg:device?video=/dev/video0&video_size=640x480#video=h264#video=mjpeg"
|
||
cam1: "ffmpeg:device?video=/dev/video2&video_size=640x480#video=h264#video=mjpeg"
|
||
webrtc:
|
||
listen: ":8555"
|
||
candidates:
|
||
# stun:8555 → go2rtc erkennt die öffentliche IP automatisch (für Internet).
|
||
# Falls das nicht klappt: feste IP/Domain eintragen, z.B.
|
||
# - robot.example.com:8555
|
||
- stun:8555
|
||
api:
|
||
listen: ":1984"
|
||
log:
|
||
level: info
|
||
|
||
services:
|
||
|
||
# ── go2rtc: Kamera-Capture · H.264-Encoding · WebRTC ──────────────────────
|
||
go2rtc:
|
||
image: ghcr.io/alexxit/go2rtc
|
||
container_name: AppRobotGo2RTC
|
||
restart: unless-stopped
|
||
network_mode: host # echte Host-IP als WebRTC-ICE-Kandidat
|
||
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 # Leerer Build-Context – Code kommt per Bind-Mount
|
||
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 # erreicht go2rtc via localhost:1984
|
||
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=h264#video=mjpeg"
|
||
# ────────────────────────────────────────────────────────────────────────────────
|