CD — Kai-Sa-Cam Deployment / deploy (push) Successful in 1m59s
- add apiFetch wrapper with re-auth popup, retry and session monitor - proxy go2rtc through the app (/go2rtc) and drop the public stream hostname - route WebSocket upgrades manually (the talk WSS was rejecting go2rtc MSE) - harden talkback: paplay error handling, heartbeat, single speaker, reconnect - sync recording state with the server on load and on 409 - optionally verify Cf-Access-Jwt-Assertion (CF_ACCESS_TEAM_DOMAIN/AUD) - keep go2rtc on the internal network only - remove unused env vars, update README and cam-watch script
35 lines
1.0 KiB
Bash
35 lines
1.0 KiB
Bash
#!/bin/bash
|
|
LOG=/var/log/cam-watch.log
|
|
STAMP=/run/cam-watch.last
|
|
STATE=/run/cam-watch.state
|
|
COOLDOWN=120
|
|
now=$(date +%s)
|
|
last=$(cat "$STAMP" 2>/dev/null || echo 0)
|
|
[ $((now - last)) -lt $COOLDOWN ] && exit 0
|
|
|
|
recreate() {
|
|
echo "$(date '+%F %T') $1 : recreation go2rtc" >> "$LOG"
|
|
(cd /srv/apps/kai-sa-cam && docker compose --profile prod up -d --force-recreate kai-sa-go2rtc >/dev/null 2>&1)
|
|
echo "$now" > "$STAMP"
|
|
}
|
|
|
|
prev=$(cat "$STATE" 2>/dev/null || echo ok)
|
|
|
|
# Webcam reellement presente ? (lsusb plus fiable que /dev/video0 qui peut etre perime)
|
|
if lsusb | grep -q '1d5b:0104'; then
|
|
if [ "$prev" = "absent" ]; then
|
|
echo "$(date '+%F %T') webcam revenue" >> "$LOG"
|
|
echo "ok" > "$STATE"
|
|
sleep 5
|
|
recreate "retour webcam"
|
|
exit 0
|
|
fi
|
|
echo "ok" > "$STATE"
|
|
if [ "$(docker inspect -f '{{.State.Running}}' kai-sa-go2rtc 2>/dev/null)" != "true" ]; then
|
|
recreate "go2rtc arrete"
|
|
fi
|
|
else
|
|
[ "$prev" != "absent" ] && echo "$(date '+%F %T') webcam ABSENTE (probleme USB)" >> "$LOG"
|
|
echo "absent" > "$STATE"
|
|
fi
|