blumeops/ansible/roles/frigate_detector/tasks/main.yml
Erich Blume 5f9b024b4a 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
2026-02-17 19:03:28 -08:00

55 lines
2.1 KiB
YAML

---
# 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