move_detect/deploy/systemd/move-detect-edge.env.example
유창욱 9386dfc580 feat(delivery): install-path fixes + cafe24 package + delivery-audit hardening
Three intertwined bodies of work developed and tested together this session.
Full test suite green: python (edge) + phpunit (cloud).

## Edge/Pi install path
- setup_online.sh: apt-lock retry (apt-daily contention), Type=exec unit +
  StartLimitIntervalSec in [Unit], journalctl-on-failure, crash-loop detection.
- onnxruntime is now best-effort (no sdist / no 32-bit-ARM wheel); [6/8] probes the
  real backend and hard-fails if none works.
- Hailo HEF auto-fetch: edge/tools/fetch_hailo_hef.py (pinned sha256, refuses to guess
  8 vs 8L, HAILO_ARCH override for serial-less boards); hailo_pose.py run() timeout fix.
- install_offline.sh: mirrors the backend gate; onnxruntime optional.

## Cafe24 cloud package (cloud/deploy/)
- build_cafe24_package.sh emits move_detect_app/ (private, one folder) + www/move_detect/
  (docroot subdir); no-dev classmap autoloader; preflight.php; hardened .htaccess.
- Subdirectory mount support: Request::baseFrom/pathFor strip the mount prefix; index.php
  walks up to find the app root; views/JS prefix every URL with APP_BASE; session cookie
  scoped to the mount.

## Delivery audit — silent-failure & correctness (docs/delivery-audit.md)
All 4 blockers + all Phase-1 silent-failure + Phase-2 HIGH correctness:
- Edge cloud clients send a custom User-Agent (cafe24 WAF blocks python-requests) and
  allow_redirects=False.
- Daemon fails loud on blank CAFE24_URL/DEVICE_SECRET; run_loop logs swallowed exceptions;
  heartbeat carries real fps + per-camera health; UvcSource reopens a dead camera;
  offline queue is size-capped and drops poison rows; TARGET_FPS/QUEUE_DB validated.
- Zone coordinates normalized 0..1 on both sides (were canvas-px vs camera-px — every zone
  misplaced); pinch zones emit PINCH/HIGH (were downgraded to WARNING).
- Fall detection uses bbox cues when keypoints are low-confidence (occluded fallen person);
  ghost incident not cancelled by a bystander; displacement normalized per-second (FPS-invariant).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Xmn8KZWqiQUguEMRtn6rW
2026-07-17 09:07:33 +09:00

51 lines
2.4 KiB
Text

# move-detect edge daemon environment — copy to /etc/move-detect/edge.env and fill in.
# Consumed by edge.config.load_config() and edge.daemon.main().
# Keep this file 0640 root:movedetect — it holds the per-device HMAC secret.
#
# IMPORTANT: systemd EnvironmentFile= does NOT strip inline comments, so every active
# line below is a bare KEY=value. All comments live on their own lines.
# --- identity / cloud (required) ---
# DEVICE_ID must match the devices.device_id row in the cloud.
DEVICE_ID=pi-01
# DEVICE_SECRET: per-device HMAC secret; must match devices.secret.
DEVICE_SECRET=CHANGEME
# CAFE24_URL: cloud base URL (POST events / poll config / heartbeat). MUST include the app's
# subdirectory when the cloud is mounted under an existing www/ (the cafe24 package default):
# use https://<domain>/move_detect, NOT https://<domain>. A wrong/missing path 404s every
# upload — the daemon now refuses to start on a blank value, but a wrong path it cannot detect.
CAFE24_URL=https://your-domain.example/move_detect
# CAMERA_ID: stamped on events and matched to dashboard zones.
CAMERA_ID=cam-01
# --- pose backend / capture ---
# POSE_BACKEND: "movenet" (CPU, needs MOVENET_ONNX) or "hailo" (needs HAILO_HEF).
POSE_BACKEND=movenet
# MOVENET_ONNX: required when POSE_BACKEND=movenet.
MOVENET_ONNX=/opt/move-detect/models/movenet_lightning.onnx
# HAILO_HEF: required when POSE_BACKEND=hailo (uncomment and set).
#HAILO_HEF=/opt/move-detect/models/yolov8s_pose.hef
# CAMERA_BACKEND: "uvc" (USB webcam, uses UVC_DEVICE) or "csi" (Pi CSI camera, uses CSI_DEVICE).
CAMERA_BACKEND=uvc
# UVC_DEVICE: OpenCV VideoCapture index for the USB (UVC) webcam.
UVC_DEVICE=0
# CSI_DEVICE: picamera2 camera_num for the CSI camera (used when CAMERA_BACKEND=csi).
CSI_DEVICE=0
# CAMERAS (optional): run several cameras at once; overrides CAMERA_BACKEND/*_DEVICE.
# Format backend:device:camera_id, comma-separated. Each camera_id must match its
# cloud zones. Example — CSI + USB together on a Hailo Pi:
#CAMERAS=csi:0:cam-01,uvc:0:cam-02
# TARGET_FPS: frame pacing = 1/TARGET_FPS.
TARGET_FPS=12
# --- offline queue (required) ---
# QUEUE_DB: sqlite buffer for events while the cloud is unreachable.
QUEUE_DB=/var/lib/move-detect/queue.db
# --- detector tuning (optional; defaults shown) ---
#FALL_PRONE_S=3.0
#FALL_NO_MOTION_S=10.0
#IMMOBILE_S=120.0
#GHOST_REAPPEAR_S=10.0
#ZONE_DEBOUNCE_S=0.75
#COOLDOWN_S=30.0