mydocker/side-agent
blasebast 9b069a15c4 docs: improve all README files, add uptime-kuma 2026-04-12 20:11:50 +02:00
..
Dockerfile .gitignore, documentation, other improvements 2026-04-04 21:45:48 +02:00
README.md docs: improve all README files, add uptime-kuma 2026-04-12 20:11:50 +02:00
backup_scheduler.py .gitignore, documentation, other improvements 2026-04-04 21:45:48 +02:00
chown-cron .gitignore, documentation, other improvements 2026-04-04 21:45:48 +02:00
container_manager.py .gitignore, documentation, other improvements 2026-04-04 21:45:48 +02:00
entrypoint.sh .gitignore, documentation, other improvements 2026-04-04 21:45:48 +02:00
requirements.txt .gitignore, documentation, other improvements 2026-04-04 21:45:48 +02:00
setup_asustor_backup.sh .gitignore, documentation, other improvements 2026-04-04 21:45:48 +02:00
snapit.py .gitignore, documentation, other improvements 2026-04-04 21:45:48 +02:00

README.md

Side Agent - Custom Background Daemons

Custom container running three daemons simultaneously. Has Docker socket access and mounts the entire /mydocker directory. Acts as "glue" connecting camera monitoring, container management and backup scheduling.

Daemons

snapit.py - Camera Snapshot Monitor

Monitors the Frigate clips directory (/media/evo2t/frigate/clips). Detects new JPG files per camera, copies them as notification files for Home Assistant, and pushes gauge metrics to Prometheus Pushgateway.

  • Cameras: reolink_1-5, hikvision_2, hikvision_4
  • Detected objects: person, car, dog, cat, animal
  • Pushgateway: http://<PUSHGATEWAY_HOST>:9091/metrics/job/camera_detection/camera/<name>
  • Metric: person_detected{camera="..."} - gauge of active detections, resets after 30s from last event
  • Archive: frames archived to /hikvision/objects-detected/<camera>/<date>/

container_manager.py - Container Version Checker

Checks every 3600s for new Docker image versions across all running containers (skips local builds and SHA-referenced images). Updates the version manifest.

  • Manifest: ./side-agent/manifest/container_versions.yaml
  • Skips: images prefixed with mydocker_, docker-, SHA-referenced images

backup_scheduler.py - NAS Backup Scheduler

Schedules rsync to Asustor NAS (root@asustor-lan1). Replaces Ansible crons.

Task Schedule Source Destination
mydocker backup (3-day rotation) Daily 07:33 /mydocker/ /volume1/data/rsyncs/mydocker_YYYYMMDD/
myansible sync Daily 01:10 ../git.repos/myansible/ /volume1/data/rsyncs/myansible/
myansible -> gdrive Sundays 01:15 ../git.repos/myansible/ /volume1/data/google-drive-sync/...
/etc/hosts Daily 01:15 /etc/hosts /volume1/data/rsyncs/hosts
valuable_scripts Daily 01:15 ../valuable_scripts/ /volume1/data/rsyncs/valuable_scripts/

Volumes

Host Mount Container Mount Purpose
/var/run/docker.sock - Docker API access
/home/seba/mydocker /mydocker Full project directory
/media/evo2t/frigate/clips - Frigate clip source (SOURCE_DIR)
/media/seagata16t/hikvision16t - Detection archive (TARGET_DIR)

Useful Commands

# Follow all daemon logs
docker compose logs -f side-agent

# View current container version manifest
cat /home/seba/mydocker/side-agent/manifest/container_versions.yaml

# Manual test: mydocker backup
docker exec side-agent python3 /app/backup_scheduler.py --test-mydocker

# Manual test: all backups
docker exec side-agent python3 /app/backup_scheduler.py --test-all

# Check pushgateway metrics
curl http://192.168.1.132:9091/metrics | grep person_detected

# Rebuild
docker compose build side-agent && docker compose up -d side-agent