/
/
/
Ansible role that deployes services on my runner machine
1services:
2 frigate:
3 container_name: frigate
4{% if frigate_hardware_acceleration == 'nvenc' %}
5 image: {{ container_images.frigate_tensorrt }}
6{% else %}
7 image: {{ container_images.frigate }}
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 environment:
41 - NVIDIA_VISIBLE_DEVICES=all
42 - NVIDIA_DRIVER_CAPABILITIES=all
43 - FRIGATE_GPU_STATS=true
44 - ORT_TENSORRT_ENGINE_CACHE_ENABLE=1
45 - ORT_TENSORRT_FP16_ENABLE=1
46 - ORT_TENSORRT_ENGINE_CACHE_PATH=/data/model_cache
47
48 devices:
49 - /dev/dri:/dev/dri
50{% endif %}
51
52 networks:
53 frigate_net:
54 aliases:
55 - frigate
56
57 frigate-snapshots:
58 build:
59 context: .
60 dockerfile: Dockerfile
61 container_name: frigate-snapshots
62 restart: unless-stopped
63 environment:
64 - TZ={{ runner_timezone }}
65
66 - FRIGATE_BASE_URL=http://frigate:5000
67 - CAMERAS={{ frigate_snapshot_cameras | join(',') }}
68
69 # MQTT broker params
70 - MQTT_HOST={{ mqtt_host }}
71 - MQTT_PORT={{ mqtt_port }}
72 - MQTT_USER={{ mqtt_username }}
73 - MQTT_PASS={{ mqtt_password }}
74
75 volumes:
76 - {{ runner_snapshot_dir }}:/snapshots
77 - ./snapshot-data/snapshot.sh:/opt/snapshot.sh
78
79 command:
80 - /bin/sh
81 - -lc
82 - |
83 set -eu
84 chmod +x /opt/snapshot.sh
85 mkdir -p /etc/crontabs
86 echo "$CRON_SCHEDULE /opt/snapshot.sh >> /var/log/cron.log 2>&1" > /etc/crontabs/root
87 crond -f -L /var/log/cron.log
88
89 networks:
90 - frigate_net
91
92networks:
93 frigate_net:
94 driver: bridge
95