You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Restart containers automatically when a camera stops producing fresh images #423
The one signal that covers a stuck thread, an unreachable camera, a wrong night detection and any future bug is the outcome: a camera that has not produced a fresh image for N minutes during daytime.
Proposal
Camera API: keep a last_capture_at per camera. /health returns 503 when a patrol is expected to run and the last stored image is older than 5 min. Compose healthcheck becomes curl -sf /health || kill -9 -1 so restart: always brings the container back (Docker never restarts an unhealthy container by itself).
Engine: keep the 70 min log check from fix(compose): restart the engine when its log goes stale #419, and add: unhealthy when is_day has been false for more than 2 h while the sun is up (sunrise/sunset already in the cache from get_sunset_sunrise.sh).
Optional, server side: a Grafana alert on last_active_at per camera in the alert API, as a third net that does not depend on the Pi.
Trade-off
A camera that is really down would restart the camera API every 5 min, which also interrupts the other camera's patrol for about 20 s. Either accept it, or skip the check for cameras that do not answer ping.
Activity
MateoLostanlen commentedon Oct 22, 2026
Merged into #446.