/
/
/
Ansible role that deployes services on my runner machine
1services:
2 frigate:
3 container_name: frigate
4{% if frigate_hardware_acceleration == 'nvenc' %}
5 image: ghcr.io/blakeblackshear/frigate:stable-tensorrt
6{% else %}
7 image: ghcr.io/blakeblackshear/frigate:stable
8{% endif %}
9 restart: unless-stopped
10 privileged: true
11
12 shm_size: "1gb"
13
14 volumes:
15 - /etc/localtime:/etc/localtime:ro
16
17 # Configuration (read-write for dynamic config updates)
18 - {{ frigate_config_dir }}/config:/config
19
20 # Local storage for database and models
21 - {{ frigate_config_dir }}/data:/data
22
23 # NFS storage for recordings
24 - {{ frigate_data_dir }}:/media/frigate
25
26 # Temporary memory storage for clips
27 - type: tmpfs
28 target: /tmp/cache
29 tmpfs:
30 size: 1000000000 # 1GB
31
32 ports:
33 - "{{ frigate_port }}:5000" # Web UI
34 - "{{ frigate_rtmp_port }}:1935" # RTMP
35 - "{{ frigate_rtsp_port }}:8554" # RTSP Re-stream
36 - "{{ frigate_go2rtc_port }}:1984"
37
38{% if frigate_hardware_acceleration == 'nvenc' %}
39 runtime: nvidia
40 gpus: all
41 environment:
42 - NVIDIA_VISIBLE_DEVICES=all
43 - NVIDIA_DRIVER_CAPABILITIES=all
44 - FRIGATE_GPU_STATS=true
45 - ORT_TENSORRT_ENGINE_CACHE_ENABLE=1
46 - ORT_TENSORRT_FP16_ENABLE=1
47 - ORT_TENSORRT_ENGINE_CACHE_PATH=/data/model_cache
48
49 devices:
50 - /dev/dri:/dev/dri
51{% endif %}
52
53 networks:
54 frigate_net:
55 aliases:
56 - frigate
57
58 frigate-snapshots:
59 build:
60 context: .
61 dockerfile: Dockerfile
62 container_name: frigate-snapshots
63 restart: unless-stopped
64 environment:
65 - TZ=Europe/Amsterdam
66
67 - FRIGATE_BASE_URL=http://frigate:5000
68 - CAMERAS=living-room,dining-room,bed-room,alina-office
69
70 # MQTT broker params
71 - MQTT_HOST={{ frigate_mqtt_host }}
72 - MQTT_PORT={{ frigate_mqtt_port }}
73 - MQTT_USER={{ frigate_mqtt_username }}
74 - MQTT_PASS={{ frigate_mqtt_password }}
75
76 volumes:
77 - {{ runner_snapshot_dir }}:/snapshots
78 - ./snapshot-data/snapshot.sh:/opt/snapshot.sh
79
80 command:
81 - /bin/sh
82 - -lc
83 - |
84 set -eu
85 chmod +x /opt/snapshot.sh
86 mkdir -p /etc/crontabs
87 echo "$CRON_SCHEDULE /opt/snapshot.sh >> /var/log/cron.log 2>&1" > /etc/crontabs/root
88 crond -f -L /var/log/cron.log
89
90 networks:
91 - frigate_net
92
93networks:
94 frigate_net:
95 driver: bridge
96
97