/
/
/
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{% if frigate_manager_enabled | default(true) %}
58 frigate-manager:
59 build:
60 context: ./manager
61 dockerfile: Dockerfile
62 container_name: frigate-manager
63 restart: unless-stopped
64 environment:
65 - TZ={{ runner_timezone }}
66 - FRIGATE_URL=http://frigate:5000
67 - MQTT_HOST={{ mqtt_host }}
68 - MQTT_PORT={{ mqtt_port }}
69 - MQTT_USER={{ mqtt_username }}
70 - MQTT_PASS={{ mqtt_password }}
71 - SNAPSHOT_INTERVAL={{ (frigate_snapshot_interval_minutes | default(30)) * 60 }}
72 - SNAPSHOT_CAMERAS={{ frigate_snapshot_cameras | join(',') }}
73 - SWITCH_TIMEOUT={{ frigate_profile_switch_timeout | default(120) }}
74 - CONFIG_DIR=/config
75 - SNAPSHOT_DIR=/snapshots
76 - LOG_LEVEL=INFO
77 volumes:
78 - {{ frigate_config_dir }}/config:/config
79 - {{ runner_snapshot_dir }}:/snapshots
80 depends_on:
81 - frigate
82 networks:
83 - frigate_net
84{% endif %}
85
86networks:
87 frigate_net:
88 driver: bridge
89