diff --git a/ansible/roles/frigate_detector/defaults/main.yml b/ansible/roles/frigate_detector/defaults/main.yml index 8913905..71af21d 100644 --- a/ansible/roles/frigate_detector/defaults/main.yml +++ b/ansible/roles/frigate_detector/defaults/main.yml @@ -4,3 +4,5 @@ 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" diff --git a/ansible/roles/frigate_detector/tasks/main.yml b/ansible/roles/frigate_detector/tasks/main.yml index 948d05b..07b5ffc 100644 --- a/ansible/roles/frigate_detector/tasks/main.yml +++ b/ansible/roles/frigate_detector/tasks/main.yml @@ -2,32 +2,39 @@ # 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. Install dependencies: -# ssh indri 'cd ~/code/3rd/apple-silicon-detector && make install' -# -# 3. Run ansible to deploy LaunchAgent: +# 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 }}/Makefile" + 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 and install first: + Please clone first: ssh indri 'git clone {{ frigate_detector_repo }} {{ frigate_detector_dir }}' - ssh indri 'cd {{ frigate_detector_dir }} && make install' 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 diff --git a/ansible/roles/frigate_detector/templates/mcquack.eblume.frigate-detector.plist.j2 b/ansible/roles/frigate_detector/templates/mcquack.eblume.frigate-detector.plist.j2 index 6ac39c5..87921ac 100644 --- a/ansible/roles/frigate_detector/templates/mcquack.eblume.frigate-detector.plist.j2 +++ b/ansible/roles/frigate_detector/templates/mcquack.eblume.frigate-detector.plist.j2 @@ -7,18 +7,30 @@ mcquack.eblume.frigate-detector ProgramArguments - /usr/bin/make + {{ frigate_detector_uv_binary }} run + --python + {{ frigate_detector_python }} + --with + numpy==1.26.* + --with + opencv-python-headless==4.11.0.* + --with + opencv-contrib-python==4.11.0.* + --with + onnxruntime==1.22.* + --with + pyzmq==26.2.* + --with + pydantic==2.10.* + detector/zmq_onnx_client.py + --model + {{ frigate_detector_model }} + --endpoint + {{ frigate_detector_endpoint }} WorkingDirectory {{ frigate_detector_dir }} - EnvironmentVariables - - ENDPOINT - {{ frigate_detector_endpoint }} - MODEL - {{ frigate_detector_model }} - RunAtLoad KeepAlive