r/frigate: Add role to deploy Frigate

Frigate is an NVR that uses machine learning to detect objects on camera
in real time.  It integrates with Home Assistant to expose sensors which
can be used for automation, etc.

The only official way to deploy Frigate is with a container, so we use
Podman and systemd to manage it.
This commit is contained in:
2021-08-21 17:16:58 -05:00
parent 911b86e694
commit 997760968e
9 changed files with 175 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
[Unit]
Description=Frigate
[Service]
Type=notify
NotifyAccess=all
ExecStartPre=-/usr/bin/podman container rm --ignore -f frigate
ExecStart=/usr/bin/podman run \
--pull never \
--sdnotify=conmon --cgroups=no-conmon \
--rm \
--network=host \
--name frigate \
-v /etc/frigate/frigate.yml:/config/config.yml:ro \
-v /var/lib/frigate/tmp:/tmp:Z \
-v /var/lib/frigate:/media/frigate:Z \
--uidmap 0:{{ frigate_user.uid }}:1 \
--gidmap 0:{{ frigate_user.group }}:1 \
--uidmap 1:6000001:1024 \
--gidmap 1:6000001:1024 \
--uidmap 65534:6001025:1 \
--gidmap 65534:6001025:1 \
{% if frigate_shm_size|d %}
--shm-size {{ frigate_shm_size }}m \
{% endif %}
docker.io/blakeblackshear/frigate:{{ frigate_image_tag }}
ProtectSystem=full
UMask=0077
[Install]
WantedBy=multi-user.target