Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Frigate #79

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions docs/services/frigate.md
Original file line number Diff line number Diff line change
@@ -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.
24 changes: 24 additions & 0 deletions group_vars/mash_servers
Original file line number Diff line number Diff line change
Expand Up @@ -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 [])
Expand Down Expand Up @@ -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 #
Expand Down
3 changes: 3 additions & 0 deletions requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: 401c3f582e1acd710186d82875496e37817ff521
name: frigate
- src: git+https://github.com/mother-of-all-self-hosting/ansible-role-funkwhale.git
version: v1.3.0-rc6-0
name: funkwhale
Expand Down
2 changes: 2 additions & 0 deletions setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@

- role: galaxy/focalboard

- role: galaxy/frigate

- role: galaxy/funkwhale

- role: galaxy/gitea
Expand Down