neolink can wedge with a full message channel: RTSP stays up but serves no frames, so Frigate shows e1 offline indefinitely. Probe 30 RTP buffers off the sub stream each minute; after 3 straight failures SIGKILL neolink so the container exits and restart: unless-stopped brings it back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
107 lines
4.3 KiB
YAML
107 lines
4.3 KiB
YAML
# cameras stack — Reolink E1 live view, 24/7 recording, detection snapshots, PTZ page.
|
|
#
|
|
# The E1 (192.168.1.99) has NO RTSP/RTMP/ONVIF: only Reolink's Baichuan protocol on its
|
|
# media port (9001 — set in the Reolink app; neolink breaks if it changes). neolink logs
|
|
# in over Baichuan and re-serves rtsp://neolink:8554/e1/{main,sub}Stream on the private
|
|
# cameras net (unauthenticated, so it is never on edge). frigate's built-in go2rtc is the
|
|
# only neolink client; the browser gets MSE through Caddy (cam.ginnoir.com).
|
|
#
|
|
# Recording: 24/7 main stream kept 7 d, person/pet clips 30 d, snapshots 30 d — all under
|
|
# /storage1/labdata/frigate (~310 GB rolling). Detection is OpenVINO on
|
|
# CPU, deliberately not the P100 (llama-swap owns its VRAM; CDI breaks after reboots).
|
|
#
|
|
# Configs are host-managed at /config/<svc>/ (Portainer's checkout won't materialize a
|
|
# relative repo-file bind). The copies under stacks/cameras/*/ are canonical; on change,
|
|
# copy them to valhalla (see homelab-apply). All images pinned out of Watchtower:
|
|
# frigate's config schema breaks between minor releases.
|
|
#
|
|
# PTZ: the E1 has no ONVIF, so Frigate can't drive it. neolink runs `mqtt-rtsp` and takes
|
|
# pan/tilt/zoom/preset commands on mosquitto (neolink/e1/control/ptz...). The static page
|
|
# cam.ginnoir.com/ptz/ (stacks/cameras/ptz, served by Caddy from /config/caddy/site/cam-ptz)
|
|
# publishes them over MQTT-websockets at cam.ginnoir.com/mqtt -> mosquitto:8083.
|
|
services:
|
|
mosquitto:
|
|
image: eclipse-mosquitto:2.0.22
|
|
container_name: mosquitto
|
|
restart: unless-stopped
|
|
labels:
|
|
- "com.centurylabs.watchtower.enable=false"
|
|
env_file: stack.env
|
|
# cameras -> neolink on :1883; edge -> Caddy proxies /mqtt to :8083 (websockets)
|
|
networks: [cameras, edge]
|
|
volumes:
|
|
- /config/mosquitto:/mosquitto/config:ro
|
|
|
|
neolink:
|
|
image: quantumentangledandy/neolink:v0.6.2
|
|
container_name: neolink
|
|
restart: unless-stopped
|
|
labels:
|
|
- "com.centurylabs.watchtower.enable=false"
|
|
env_file: stack.env
|
|
command: ["/usr/local/bin/neolink", "mqtt-rtsp", "--config", "/etc/neolink.toml"]
|
|
depends_on: [mosquitto]
|
|
networks: [cameras]
|
|
volumes:
|
|
- /config/neolink/neolink.toml:/etc/neolink.toml:ro
|
|
# neolink can wedge without exiting ("Remaining: 0 of 100 message space"): RTSP stays
|
|
# up but serves no frames, so Frigate shows the stream offline forever (2026-10-08).
|
|
# Probe: pull 30 RTP buffers off the sub stream. After 3 straight failures, SIGKILL
|
|
# neolink; the image's sh PID 1 then exits and `restart: unless-stopped` brings it back.
|
|
healthcheck:
|
|
test:
|
|
- CMD-SHELL
|
|
- >-
|
|
f=/tmp/hc-fails;
|
|
if timeout 20 gst-launch-1.0 -q rtspsrc location=rtsp://127.0.0.1:8554/e1/subStream protocols=tcp
|
|
! identity eos-after=30 ! fakesink >/dev/null 2>&1; then echo 0 > $$f; exit 0; fi;
|
|
n=$$(( $$(cat $$f 2>/dev/null || echo 0) + 1 )); echo $$n > $$f;
|
|
if [ $$n -ge 3 ]; then echo 0 > $$f;
|
|
for p in /proc/[0-9]*; do [ "$$(cat $$p/comm 2>/dev/null)" = neolink ] && kill -9 $${p#/proc/}; done; fi;
|
|
exit 1
|
|
interval: 60s
|
|
timeout: 30s
|
|
start_period: 60s
|
|
retries: 3
|
|
|
|
frigate:
|
|
image: ghcr.io/blakeblackshear/frigate:0.17.2
|
|
container_name: frigate
|
|
restart: unless-stopped
|
|
labels:
|
|
- "com.centurylabs.watchtower.enable=false"
|
|
env_file: stack.env
|
|
# OpenVINO (CPU) spawns one worker per visible CPU and busy-spins them: with all 52
|
|
# threads visible the detector alone burned ~6.5 cores. Pinned to 6 threads it's
|
|
# ~1.2 cores total (incl. 24/7 recording) at ~23 ms inference. Measured 2026-10-08.
|
|
cpuset: "0-5"
|
|
shm_size: "256mb"
|
|
depends_on: [neolink]
|
|
networks: [edge, cameras]
|
|
volumes:
|
|
- /config/frigate:/config
|
|
- /storage1/labdata/frigate:/media/frigate
|
|
- type: tmpfs
|
|
target: /tmp/cache
|
|
tmpfs:
|
|
size: 1000000000
|
|
|
|
frigate-notify:
|
|
image: ghcr.io/0x2142/frigate-notify:v0.5.4
|
|
container_name: frigate-notify
|
|
restart: unless-stopped
|
|
labels:
|
|
- "com.centurylabs.watchtower.enable=false"
|
|
env_file: stack.env
|
|
depends_on: [frigate]
|
|
# cameras -> frigate:5000 API; edge -> ntfy:80
|
|
networks: [cameras, edge]
|
|
volumes:
|
|
- /config/frigate-notify/config.yml:/app/config.yml:ro
|
|
|
|
networks:
|
|
edge:
|
|
external: true
|
|
cameras:
|
|
name: cameras
|