From ca93fd944fb96ee83916555e5e431d7440f9c06e Mon Sep 17 00:00:00 2001 From: Charles Wright Date: Sat, 8 Jul 2023 15:18:52 -0500 Subject: [PATCH 1/4] Initial support for Frigate --- group_vars/mash_servers | 24 ++++++++++++++++++++++++ requirements.yml | 3 +++ setup.yml | 2 ++ 3 files changed, 29 insertions(+) diff --git a/group_vars/mash_servers b/group_vars/mash_servers index 90d227b7..23bd16f4 100644 --- a/group_vars/mash_servers +++ b/group_vars/mash_servers @@ -101,6 +101,8 @@ devture_systemd_service_manager_services_list_auto: | + ([{'name': (focalboard_identifier + '.service'), 'priority': 2000, 'groups': ['mash', 'focalboard']}] if focalboard_enabled else []) + + ([{'name': (frigate_identifier + '.service'), 'priority': 2000, 'groups': ['mash', 'frigate']}] if frigate_enabled else []) + + ([{'name': (funkwhale_api_identifier + '.service'), 'priority': 2000, 'groups': ['mash', 'funkwhale']}] if funkwhale_enabled else []) + ([{'name': (funkwhale_frontend_identifier + '.service'), 'priority': 2000, 'groups': ['mash', 'funkwhale']}] if funkwhale_enabled else []) @@ -930,6 +932,28 @@ focalboard_container_labels_traefik_tls_certResolver: "{{ devture_traefik_certRe +######################################################################## +# # +# frigate # +# # +######################################################################## + +frigate_enabled: false +frigate_identifier: "{{ mash_playbook_service_identifier_prefix }}frigate" +frigate_base_path: "{{ mash_playbook_base_path }}/{{ mash_playbook_service_base_directory_name_prefix }}frigate" + +# Yes, unfortunately Frigate requires to run as root :\ +frigate_uid: "0" +frigate_gid: "0" + +######################################################################## +# # +# /frigate # +# # +######################################################################## + + + ######################################################################## # # # funkwhale # diff --git a/requirements.yml b/requirements.yml index 90613fd9..d48abc08 100644 --- a/requirements.yml +++ b/requirements.yml @@ -63,6 +63,9 @@ - src: git+https://github.com/mother-of-all-self-hosting/ansible-role-focalboard.git version: v7.9.3-2 name: focalboard +- src: git+https://github.com/cvwright/ansible-role-frigate.git + version: ca53b84f26f0349fac171a6830fa05fbbe6178a3 + name: frigate - src: git+https://github.com/mother-of-all-self-hosting/ansible-role-funkwhale.git version: v1.3.0-rc6-0 name: funkwhale diff --git a/setup.yml b/setup.yml index aaa6f950..222fa301 100644 --- a/setup.yml +++ b/setup.yml @@ -76,6 +76,8 @@ - role: galaxy/focalboard + - role: galaxy/frigate + - role: galaxy/funkwhale - role: galaxy/gitea From 5c41781085a5f0be1d78bdbc35b1f51ad9ebb83e Mon Sep 17 00:00:00 2001 From: Charles Wright Date: Sat, 8 Jul 2023 17:24:13 -0500 Subject: [PATCH 2/4] Bump version of ansible-role-frigate to get new config options --- requirements.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.yml b/requirements.yml index d48abc08..8706eb16 100644 --- a/requirements.yml +++ b/requirements.yml @@ -64,7 +64,7 @@ version: v7.9.3-2 name: focalboard - src: git+https://github.com/cvwright/ansible-role-frigate.git - version: ca53b84f26f0349fac171a6830fa05fbbe6178a3 + version: c7a26fd23c557d2a86a6edb5f1a6137cc6502e2c name: frigate - src: git+https://github.com/mother-of-all-self-hosting/ansible-role-funkwhale.git version: v1.3.0-rc6-0 From 1c36a59969b40f1bd28459f2e8fa5168085427bf Mon Sep 17 00:00:00 2001 From: Charles Wright Date: Sun, 9 Jul 2023 12:50:01 -0500 Subject: [PATCH 3/4] Add a minimal documentation file for Frigate --- docs/services/frigate.md | 73 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 docs/services/frigate.md diff --git a/docs/services/frigate.md b/docs/services/frigate.md new file mode 100644 index 00000000..3c2137ee --- /dev/null +++ b/docs/services/frigate.md @@ -0,0 +1,73 @@ +# Frigate + +[Frigate](https://frigate.video/) is an open source NVR built around real-time AI object detection. + +## Dependencies + +No other services are required to run Frigate in the default configuration, +but it is commonly deployed together with an MQTT broker such as: +* [mosquitto](mosquitto.md) +* [rumqttd](rumqttd.md) + +## Configuration + +To enable this service, add the following to your `vars.yml` and re-run the [installation](../installing.md). + +```yaml +######################################################################## +# # +# frigate # +# # +######################################################################## + +frigate_enabled: true + +# Required +# See https://docs.frigate.video/configuration/cameras +frigate_cameras: + # Required: name of the camera + MY_EXAMPLE_CAMERA_NAME: + # Optional: Enable/Disable the camera (default: shown below). + # If disabled: config is used but no live stream and no capture etc. + # Events/Recordings are still viewable. + enabled: True + # Required: ffmpeg settings for the camera + ffmpeg: + # Required: A list of input streams for the camera. See documentation for more information. + inputs: + # Required: the path to the stream + # NOTE: path may include environment variables, which must begin with 'FRIGATE_' and be referenced in {} + - path: rtsp://MY_EXAMPLE_CAMERA_URL + # Required: list of roles for this stream. valid values are: detect,record,rtmp + # NOTICE: In addition to assigning the record and rtmp roles, + # they must also be enabled in the camera config. + roles: + - detect + - record + - rtmp + +######################################################################## +# # +# /frigate # +# # +######################################################################## +``` + +## Enabling Video Hardware Acceleration + +The playbook supports configuring hardware acceleration in Frigate. + +For example, to enable Intel hardware acceleration with VA-API, add the +following lines to your `vars.yml`: + +```yaml +# Use VA-API to detect and use whatever hw accel is available on the system +frigate_ffmpeg_hwaccel_args: preset-vaapi + +# Give the frigate container access to the Intel device +frigate_devices: + - /dev/dri/renderD128 +``` + +Refer to the [Frigate documentation on hardare acceleration](https://docs.frigate.video/configuration/hardware_acceleration) +for more details and support for other hardware. From 4bb74710b8d731af1de770c6ebdbc1447f847848 Mon Sep 17 00:00:00 2001 From: Charles Wright Date: Sun, 9 Jul 2023 12:51:46 -0500 Subject: [PATCH 4/4] Update the Frigate role to address initial issues raised in PR #79 --- requirements.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.yml b/requirements.yml index 8706eb16..0f6afea6 100644 --- a/requirements.yml +++ b/requirements.yml @@ -64,7 +64,7 @@ version: v7.9.3-2 name: focalboard - src: git+https://github.com/cvwright/ansible-role-frigate.git - version: c7a26fd23c557d2a86a6edb5f1a6137cc6502e2c + version: 401c3f582e1acd710186d82875496e37817ff521 name: frigate - src: git+https://github.com/mother-of-all-self-hosting/ansible-role-funkwhale.git version: v1.3.0-rc6-0