Add Apple Silicon ZMQ detector for Frigate (#206)
## Summary - New `frigate_detector` ansible role deploys the [apple-silicon-detector](https://github.com/frigate-nvr/apple-silicon-detector) as a LaunchAgent on indri - Switches Frigate from ONNX CPU detector (~117ms) to ZMQ detector backed by CoreML/Neural Engine (~15ms) - Removes detect FPS cap (no longer needed with fast inference) - Updates Frigate docs and adds changelog fragment ## Deployment ### Phase 1: Deploy detector on indri (one-time setup + ansible) ```fish ssh indri 'git clone https://github.com/frigate-nvr/apple-silicon-detector.git ~/code/3rd/apple-silicon-detector' ssh indri 'cd ~/code/3rd/apple-silicon-detector && make install' mise run provision-indri -- --tags frigate_detector --check --diff # dry run mise run provision-indri -- --tags frigate_detector # apply ssh indri 'launchctl list mcquack.eblume.frigate-detector' # verify running ssh indri 'tail ~/Library/Logs/mcquack.frigate-detector.out.log' # verify bound ``` ### Phase 2: Test connectivity ```fish kubectl --context=minikube-indri -n frigate exec deploy/frigate -- nc -vz host.minikube.internal 5555 ``` ### Phase 3: Deploy Frigate config (branch workflow) ```fish argocd app set frigate --revision feature/frigate-zmq-detector && argocd app sync frigate ``` ### Phase 4: Post-deploy checks - [ ] Pod starts, no config errors - [ ] `/api/stats` shows detector type zmq, inference_speed ~15ms - [ ] detect_fps uncapped - [ ] Recordings and MQTT events flowing - [ ] After merge: `argocd app set frigate --revision main && argocd app sync frigate` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Reviewed-on: https://forge.ops.eblu.me/eblume/blumeops/pulls/206
This commit is contained in:
parent
f45897b7c7
commit
5f9b024b4a
8 changed files with 137 additions and 14 deletions
|
|
@ -175,3 +175,5 @@
|
|||
tags: jellyfin_metrics
|
||||
- role: caddy
|
||||
tags: caddy
|
||||
- role: frigate_detector
|
||||
tags: frigate_detector
|
||||
|
|
|
|||
8
ansible/roles/frigate_detector/defaults/main.yml
Normal file
8
ansible/roles/frigate_detector/defaults/main.yml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
frigate_detector_repo: https://forge.ops.eblu.me/eblume/apple-silicon-detector.git
|
||||
frigate_detector_dir: "{{ ansible_env.HOME }}/code/3rd/apple-silicon-detector"
|
||||
frigate_detector_endpoint: "tcp://*:5555"
|
||||
frigate_detector_model: AUTO
|
||||
frigate_detector_log_dir: "{{ ansible_env.HOME }}/Library/Logs"
|
||||
frigate_detector_uv_binary: "{{ ansible_env.HOME }}/.local/share/mise/installs/uv/latest/uv-aarch64-apple-darwin/uv"
|
||||
frigate_detector_python: "3.12"
|
||||
6
ansible/roles/frigate_detector/handlers/main.yml
Normal file
6
ansible/roles/frigate_detector/handlers/main.yml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
- name: Restart frigate-detector
|
||||
ansible.builtin.shell: |
|
||||
launchctl unload ~/Library/LaunchAgents/mcquack.eblume.frigate-detector.plist 2>/dev/null || true
|
||||
launchctl load ~/Library/LaunchAgents/mcquack.eblume.frigate-detector.plist
|
||||
changed_when: true
|
||||
55
ansible/roles/frigate_detector/tasks/main.yml
Normal file
55
ansible/roles/frigate_detector/tasks/main.yml
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
---
|
||||
# Apple Silicon ZMQ detector for Frigate
|
||||
# Runs natively on macOS, using CoreML / Neural Engine for ~15ms inference.
|
||||
# Communicates with Frigate via ZMQ over TCP.
|
||||
# Dependencies managed inline by uv — no venv or make install needed.
|
||||
#
|
||||
# ONE-TIME SETUP (before running ansible):
|
||||
#
|
||||
# 1. Clone the repo (use localhost:3001 - hairpinning doesn't work):
|
||||
# ssh indri 'git clone http://localhost:3001/eblume/apple-silicon-detector.git ~/code/3rd/apple-silicon-detector'
|
||||
#
|
||||
# 2. Run ansible to deploy LaunchAgent:
|
||||
# mise run provision-indri -- --tags frigate_detector
|
||||
|
||||
- name: Verify apple-silicon-detector repo exists
|
||||
ansible.builtin.stat:
|
||||
path: "{{ frigate_detector_dir }}/detector/zmq_onnx_client.py"
|
||||
register: frigate_detector_stat
|
||||
|
||||
- name: Fail if apple-silicon-detector not found
|
||||
ansible.builtin.fail:
|
||||
msg: |
|
||||
apple-silicon-detector not found at {{ frigate_detector_dir }}.
|
||||
Please clone first:
|
||||
ssh indri 'git clone {{ frigate_detector_repo }} {{ frigate_detector_dir }}'
|
||||
when: not frigate_detector_stat.stat.exists
|
||||
|
||||
- name: Verify uv binary exists
|
||||
ansible.builtin.stat:
|
||||
path: "{{ frigate_detector_uv_binary }}"
|
||||
register: frigate_detector_uv_stat
|
||||
|
||||
- name: Fail if uv not found
|
||||
ansible.builtin.fail:
|
||||
msg: "uv not found at {{ frigate_detector_uv_binary }}. Install via mise: mise use uv@latest"
|
||||
when: not frigate_detector_uv_stat.stat.exists
|
||||
|
||||
- name: Deploy frigate-detector LaunchAgent plist
|
||||
ansible.builtin.template:
|
||||
src: mcquack.eblume.frigate-detector.plist.j2
|
||||
dest: ~/Library/LaunchAgents/mcquack.eblume.frigate-detector.plist
|
||||
mode: '0644'
|
||||
notify: Restart frigate-detector
|
||||
|
||||
- name: Check if frigate-detector LaunchAgent is loaded
|
||||
ansible.builtin.command: launchctl list mcquack.eblume.frigate-detector
|
||||
register: frigate_detector_launchctl_check
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
- name: Load frigate-detector LaunchAgent if not loaded
|
||||
ansible.builtin.command: launchctl load ~/Library/LaunchAgents/mcquack.eblume.frigate-detector.plist
|
||||
when: frigate_detector_launchctl_check.rc != 0
|
||||
changed_when: true
|
||||
failed_when: false
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- {{ ansible_managed }} -->
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>mcquack.eblume.frigate-detector</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>{{ frigate_detector_uv_binary }}</string>
|
||||
<string>run</string>
|
||||
<string>--python</string>
|
||||
<string>{{ frigate_detector_python }}</string>
|
||||
<string>--with</string>
|
||||
<string>numpy==1.26.*</string>
|
||||
<string>--with</string>
|
||||
<string>opencv-python-headless==4.11.0.*</string>
|
||||
<string>--with</string>
|
||||
<string>opencv-contrib-python==4.11.0.*</string>
|
||||
<string>--with</string>
|
||||
<string>onnxruntime==1.22.*</string>
|
||||
<string>--with</string>
|
||||
<string>pyzmq==26.2.*</string>
|
||||
<string>--with</string>
|
||||
<string>pydantic==2.10.*</string>
|
||||
<string>detector/zmq_onnx_client.py</string>
|
||||
<string>--model</string>
|
||||
<string>{{ frigate_detector_model }}</string>
|
||||
<string>--endpoint</string>
|
||||
<string>{{ frigate_detector_endpoint }}</string>
|
||||
</array>
|
||||
<key>WorkingDirectory</key>
|
||||
<string>{{ frigate_detector_dir }}</string>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
<key>KeepAlive</key>
|
||||
<true/>
|
||||
<key>StandardOutPath</key>
|
||||
<string>{{ frigate_detector_log_dir }}/mcquack.frigate-detector.out.log</string>
|
||||
<key>StandardErrorPath</key>
|
||||
<string>{{ frigate_detector_log_dir }}/mcquack.frigate-detector.err.log</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Loading…
Add table
Add a link
Reference in a new issue