From d909bc85bd99a72c79911225d209a859ad903c20 Mon Sep 17 00:00:00 2001 From: dsutanto Date: Wed, 5 Aug 2026 10:27:43 +0700 Subject: [PATCH] Add bytetrack-recounting-upload-dashboard.service for port 5003 --- AGENTS.md | 2 +- bytetrack-recounting-upload-dashboard.service | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 bytetrack-recounting-upload-dashboard.service diff --git a/AGENTS.md b/AGENTS.md index 59ad2ae..f6fd1de 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -43,7 +43,7 @@ PYTHONNOUSERSITE=1 venv/bin/python recounting_dashboard_upload.py - **`numpy<2`** is required for `rknn-toolkit-lite2` compatibility. - **Install path in service files is `/opt/bytetrack-counter`** (not the `/opt/jetson-counter` mentioned in README/DEPLOY). The `.env.example` also reflects `/opt/bytetrack-counter`. - Service user is **`root`**, not `jetson` (despite README saying otherwise). -- Two systemd units: `bytetrack-counter.service` + `bytetrack-counter-dashboard.service`. +- Three systemd units: `bytetrack-counter.service`, `bytetrack-counter-dashboard.service`, and `bytetrack-recounting-upload-dashboard.service` (upload recounting dashboard, port 5003). - `counter_live.py` (TensorRT) is Jetson-only and won't work on RK3588. - **Reset flow**: `POST /api/reset` → deletes state JSON + touches `{SHM_DIR}/.reset`. `batch_store._check_reset_signal()` watches this marker and clears in-memory state on next crossing. - **Upload filename contract**: uploads are expected as `batch_XX_YYYYMMDD_HHmmSS.mp4` (XX = batch number, timestamp = date). `recounting_dashboard_upload.py` parses both to query the live API's `/api/day-detail/` for the recorded count. diff --git a/bytetrack-recounting-upload-dashboard.service b/bytetrack-recounting-upload-dashboard.service new file mode 100644 index 0000000..0e6b1d7 --- /dev/null +++ b/bytetrack-recounting-upload-dashboard.service @@ -0,0 +1,34 @@ +[Unit] +Description=Edge Counter Recounting Upload Dashboard (Flask, port 5003) +Documentation=file:///opt/bytetrack-counter/DEPLOY.md +After=network-online.target bytetrack-counter-dashboard.service +Wants=network-online.target bytetrack-counter-dashboard.service + +[Service] +Type=simple +User=root +Group=root + +WorkingDirectory=/opt/bytetrack-counter + +EnvironmentFile=/opt/bytetrack-counter/.env +Environment=PATH=/opt/bytetrack-counter/venv/bin:/usr/local/bin:/usr/bin:/bin +Environment=PYTHONNOUSERSITE=1 +Environment=FLASK_DEBUG=false + +ExecStart=/opt/bytetrack-counter/venv/bin/python recounting_dashboard_upload.py + +TimeoutStopSec=15 +KillSignal=SIGTERM + +Restart=on-failure +RestartSec=5 +StartLimitInterval=60s +StartLimitBurst=3 + +NoNewPrivileges=true +ProtectHome=true +PrivateTmp=false + +[Install] +WantedBy=multi-user.target