GithubHelp home page GithubHelp logo

weltenwort / frigate-synology-dsm7 Goto Github PK

View Code? Open in Web Editor NEW
109.0 6.0 18.0 70 KB

Dockerfile and docker-compose file to enable google coral USB accelerators in containers on Synology DSM 7

License: MIT License

Dockerfile 100.00%
synology-docker frigate synology synology-dsm coral-tpu docker docker-compose

frigate-synology-dsm7's Introduction

frigate-synology-dsm7

This provides a Dockerfile (with context) as well as a docker-compose.yml file to build a frigate docker image that supports using a Google Coral USB TPU. It is based on the official upstream frigate image but recompiles libusb1 without udev support.

Usage on the NAS with docker-compose but without git

  1. SSH into the NAS.

  2. Download the compose file:

    wget "https://github.com/weltenwort/frigate-synology-dsm7/raw/main/docker-compose.yml"
  3. Create environment file secrets.env to inject secrets:

    cat <<EOF >secrets.env
    FRIGATE_MQTT_USERNAME=my-frigate-mqtt-username
    FRIGATE_MQTT_PASSWORD=my-frigate-mqtt-password
    FRIGATE_CAMERA_1_RTSP_CREDENTIALS=my-camera-1-username:my-camera-1-password
    FRIGATE_CAMERA_2_RTSP_CREDENTIALS=my-camera-2-username:my-camera-2-password
    EOF
  4. Create the volume directories (adjust paths if you changed them in the compose file):

    mkdir -p /volume1/docker/volumes/frigate-0-config
    mkdir -p /volume1/docker/volumes/frigate-0-media
  5. Edit the docker-compose.yml file and configure frigate with a config file at /volume1/docker/volumes/frigate-0-config/config.yml using the env variables. Adjust paths and env vars to match your choices above.

  6. Start the container:

    sudo docker-compose up --detach --force-recreate

Usage on the NAS with docker-compose and git

  1. SSH into the NAS.

  2. Clone this repository:

    git clone https://github.com/weltenwort/frigate-synology-dsm7.git
  3. Create environment file secrets.env to inject secrets:

    cat <<EOF >secrets.env
    FRIGATE_MQTT_USERNAME=my-frigate-mqtt-username
    FRIGATE_MQTT_PASSWORD=my-frigate-mqtt-password
    FRIGATE_CAMERA_1_RTSP_CREDENTIALS=my-camera-1-username:my-camera-1-password
    FRIGATE_CAMERA_2_RTSP_CREDENTIALS=my-camera-2-username:my-camera-2-password
    EOF
  4. Create the volume directories (adjust paths if you changed them in the compose file):

    mkdir -p /volume1/docker/volumes/frigate-0-config
    mkdir -p /volume1/docker/volumes/frigate-0-media
  5. Edit the docker-compose.yml file and configure frigate with a config file at /volume1/docker/volumes/frigate-0-config/config.yml using the env variables. Adjust paths and env vars to match your choices above.

  6. Start the container:

    sudo docker-compose up --detach --force-recreate

frigate-synology-dsm7's People

Contributors

baylanger avatar caros2017 avatar dependabot[bot] avatar deviant77 avatar weltenwort avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

frigate-synology-dsm7's Issues

Setup

Hi there.

Just wanted to check this is not expected, right? It seems to be not having the permission to install?

image

Docker image fails to build, Libc6-dev fails to install

I tried to spin this up today using frigate 0.13.1 and had issues with some base dependencies. Specifically while building libusb-1.0-0 I got:

The following packages have unmet dependencies:
 libc6-dev : Depends: libc6 (= 2.31-13+deb11u7) but 2.36-9+deb12u3 is to be installed
             Depends: libc-dev-bin (= 2.31-13+deb11u7) but it is not going to be installed

As a work around I just changed the builder image to be Debian bookworm, and everything else worked as expected.

CPU load

Guys, do you have any ideas why Synology Surveillance Station with Deepstack and SynoAI uses 20% CPU, but Frigate with CPU detection uses 80% CPU? I understand that Coral is preferable to use with Frigate. But SSS do the same job with CPU detection and 4 times less utilisation...

Help wanted if possible. Update to newer versions

First of all, what a great project, thanks for sharing.
I have a question and I am wondering how you solved this. I wanted to run the newest frigate on DSM7.

I changed these two lines in the dockerfile (line 1 and 16):
From:

FROM blakeblackshear/frigate:0.10.0-amd64 AS build
FROM blakeblackshear/frigate:0.10.0-amd64

To:

FROM blakeblackshear/frigate:0.11.0-beta2 AS build
FROM blakeblackshear/frigate:0.11.0-beta2

If I want to build this docker I get:

Err:5 http://archive.ubuntu.com/ubuntu focal InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B4FE6ACC0B21F32 NO_PUBKEY 871920D1991BC93C
W: GPG error: http://archive.ubuntu.com/ubuntu focal InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B4FE6ACC0B21F32 NO_PUBKEY 871920D1991BC93C
E: The repository 'http://archive.ubuntu.com/ubuntu focal InRelease' is not signed.

Normally (it's not safe I know) you can solve this by adding:
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 871920D1991BC93C

To run this you need to have gnupg2 installed. So I can add this to the dockerfile:
RUN apt-get -y install gnupg2

The problem I am facing then is that for installing gnupg2 I get the same signature verification error.

How did you manage to solve this, or am I doing something wrong here?

Language translation

Discussed in #63

Originally posted by siri10086 August 26, 2022
Is there any way to change these Title languages into other languages? I will translate and replace them myself
WX20220826-210520@2x

USB accelerator is normal in MAC test, but ds918plus is connected to USB An error occurred when frigate-synthesis-dsm7 was started on DSM 7.1.

USB accelerator is normal in MAC test, but ds918plus is connected to USB

An error occurred when frigate-synthesis-dsm7 was started on DSM 7.1. Type: CPU can run normally. If you change it to type: edgetpu device: USB, an error occurs. Relevant parameters and logs are as follows

DS918plus
DSM 7.1-42661 Update 1
frigate-synthesis-dsm7 v0.11.0-beta5

image


detectors:
coral:
type: edgetpu
device: usb

date stream content
2022-07-18T12:22:39.671062764Z stdout [s6-finish] sending all processes the KILL signal and exiting.
2022-07-18T12:22:36.629981766Z stdout [s6-finish] sending all processes the TERM signal.
2022-07-18T12:22:36.424630358Z stdout [s6-finish] waiting for services.
2022-07-18T12:22:36.423829316Z stdout [cont-finish.d] done.
2022-07-18T12:22:36.423081302Z stdout [cont-finish.d] executing container finish scripts...
2022-07-18T12:22:34.355030664Z stdout [2022-07-18 20:22:34] detector.coral                 INFO    : Starting detection process: 217
2022-07-18T12:22:34.349941425Z stdout [2022-07-18 20:22:34] ws4py                          INFO    : Using epoll
2022-07-18T12:22:34.340698166Z stdout [2022-07-18 20:22:34] frigate.app                    INFO    : Output process started: 218
2022-07-18T12:22:34.309096970Z stdout [2022-07-18 20:22:34] peewee_migrate                 INFO    : There is nothing to migrate
2022-07-18T12:22:34.308911291Z stdout There is nothing to migrate
2022-07-18T12:22:34.298965370Z stdout [2022-07-18 20:22:34] peewee_migrate                 INFO    : Starting migrations
2022-07-18T12:22:34.298734195Z stdout Starting migrations
2022-07-18T12:22:34.226243735Z stdout [2022-07-18 20:22:34] frigate.app                    INFO    : Starting Frigate (0.11.0-ef54cd6)
2022-07-18T12:22:31.402799563Z stdout [services.d] done.
2022-07-18T12:22:31.386422397Z stdout [services.d] starting services
2022-07-18T12:22:31.385326373Z stdout [cont-init.d] done.
2022-07-18T12:22:31.384253675Z stdout [cont-init.d] executing container initialization scripts...
2022-07-18T12:22:31.383127055Z stdout [fix-attrs.d] done.
2022-07-18T12:22:31.382199135Z stdout [fix-attrs.d] applying ownership & permissions fixes...
2022-07-18T12:22:31.380726367Z stdout [s6-init] ensuring user provided files have correct perms...exited 0.
2022-07-18T12:22:31.332846635Z stdout [s6-init] making user provided files available at /var/run/s6/etc...exited 0.
2022-07-18T12:22:26.283060104Z stdout [s6-finish] sending all processes the KILL signal and exiting.
2022-07-18T12:22:23.249121383Z stdout [s6-finish] sending all processes the TERM signal.
2022-07-18T12:22:23.020157007Z stdout [s6-finish] waiting for services.
2022-07-18T12:22:23.019535029Z stdout [cont-finish.d] done.
2022-07-18T12:22:23.018488273Z stdout [cont-finish.d] executing container finish scripts...
2022-07-18T12:22:23.017116491Z stdout [2022-07-18 20:22:23] frigate.video                  ERROR   : fristcamera: ffmpeg process is not running. exiting capture thread...
2022-07-18T12:22:23.015518451Z stdout [2022-07-18 20:22:23] frigate.video                  ERROR   : fristcamera: Unable to read frames from ffmpeg process.
2022-07-18T12:22:22.996774149Z stdout [2022-07-18 20:22:22] frigate.video                  ERROR   : ketingcamera: ffmpeg process is not running. exiting capture thread...
2022-07-18T12:22:22.995761498Z stdout [2022-07-18 20:22:22] frigate.video                  ERROR   : ketingcamera: Unable to read frames from ffmpeg process.
2022-07-18T12:22:22.960501899Z stdout [2022-07-18 20:22:22] frigate.watchdog               INFO    : Detection appears to have stopped. Exiting frigate...
2022-07-18T12:22:16.396147061Z stdout  
2022-07-18T12:22:16.396103229Z stdout ValueError: Failed to load delegate from libedgetpu.so.1.0
2022-07-18T12:22:16.396053429Z stdout raise ValueError('Failed to load delegate from {}\n{}'.format(
2022-07-18T12:22:16.396001281Z stdout File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 162, in load_delegate
2022-07-18T12:22:16.395953859Z stdout edge_tpu_delegate = load_delegate("libedgetpu.so.1.0", device_config)
2022-07-18T12:22:16.395902929Z stdout File "/opt/frigate/frigate/edgetpu.py", line 43, in init
2022-07-18T12:22:16.395859341Z stdout object_detector = LocalObjectDetector(
2022-07-18T12:22:16.395793017Z stdout File "/opt/frigate/frigate/edgetpu.py", line 135, in run_detector
2022-07-18T12:22:16.395748078Z stdout self._target(*self._args, **self._kwargs)
2022-07-18T12:22:16.395700094Z stdout File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
2022-07-18T12:22:16.395657565Z stdout self.run()
2022-07-18T12:22:16.395584309Z stdout File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
2022-07-18T12:22:16.395480361Z stdout Traceback (most recent call last):
2022-07-18T12:22:16.395336457Z stdout  
2022-07-18T12:22:16.395280546Z stdout During handling of the above exception, another exception occurred:
2022-07-18T12:22:16.395243705Z stdout  
2022-07-18T12:22:16.395202847Z stdout ValueError
2022-07-18T12:22:16.395155119Z stdout raise ValueError(capture.message)
2022-07-18T12:22:16.395091561Z stdout File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 119, in init
2022-07-18T12:22:16.395043784Z stdout delegate = Delegate(library, options)
2022-07-18T12:22:16.394961089Z stdout File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 160, in load_delegate
2022-07-18T12:22:16.394769317Z stdout Traceback (most recent call last):
2022-07-18T12:22:16.392729930Z stdout Process detector:coral:
2022-07-18T12:22:16.391974070Z stdout [2022-07-18 20:22:16] frigate.edgetpu                ERROR   : No EdgeTPU was detected. If you do not have a Coral device yet, you must configure CPU detectors.
2022-07-18T12:21:52.945388524Z stdout [2022-07-18 20:21:52] ws4py                          INFO    : Using epoll
2022-07-18T12:21:51.345216081Z stdout [2022-07-18 20:21:51] frigate.app                    INFO    : Capture process started for ketingcamera: 226
2022-07-18T12:21:51.331934375Z stdout [2022-07-18 20:21:51] frigate.edgetpu                INFO    : Attempting to load TPU as usb
2022-07-18T12:21:51.326890153Z stdout [2022-07-18 20:21:51] frigate.mqtt                   INFO    : Turning off detection for ketingcamera via mqtt
2022-07-18T12:21:51.325877437Z stdout [2022-07-18 20:21:51] frigate.mqtt                   INFO    : Turning off snapshots for ketingcamera via mqtt
2022-07-18T12:21:51.321020467Z stdout [2022-07-18 20:21:51] frigate.app                    INFO    : Capture process started for fristcamera: 224
2022-07-18T12:21:51.310108700Z stdout [2022-07-18 20:21:51] frigate.app                    INFO    : Camera processor started for ketingcamera: 222
2022-07-18T12:21:51.309269569Z stdout [2022-07-18 20:21:51] frigate.app                    INFO    : Camera processor started for fristcamera: 219
2022-07-18T12:21:51.301410155Z stdout [2022-07-18 20:21:51] ws4py                          INFO    : Using epoll
2022-07-18T12:21:51.292418509Z stdout [2022-07-18 20:21:51] detector.coral                 INFO    : Starting detection process: 215
2022-07-18T12:21:51.290184145Z stdout [2022-07-18 20:21:51] frigate.app                    INFO    : Output process started: 216
2022-07-18T12:21:51.259252397Z stdout [2022-07-18 20:21:51] peewee_migrate                 INFO    : There is nothing to migrate
2022-07-18T12:21:51.259009845Z stdout There is nothing to migrate
2022-07-18T12:21:51.248469221Z stdout [2022-07-18 20:21:51] peewee_migrate                 INFO    : Starting migrations
2022-07-18T12:21:51.248279605Z stdout Starting migrations
2022-07-18T12:21:51.242666058Z stdout [2022-07-18 20:21:51] frigate.app                    INFO    : Creating directory: /tmp/cache
2022-07-18T12:21:51.144849602Z stdout [2022-07-18 20:21:51] frigate.app                    INFO    : Starting Frigate (0.11.0-ef54cd6)
2022-07-18T12:21:42.014667319Z stdout [services.d] done.
2022-07-18T12:21:42.001176376Z stdout [services.d] starting services
2022-07-18T12:21:42.000211683Z stdout [cont-init.d] done.
2022-07-18T12:21:41.999217422Z stdout [cont-init.d] executing container initialization scripts...
2022-07-18T12:21:41.997972996Z stdout [fix-attrs.d] done.
2022-07-18T12:21:41.997038335Z stdout [fix-attrs.d] applying ownership & permissions fixes...
2022-07-18T12:21:41.995458059Z stdout [s6-init] ensuring user provided files have correct perms...exited 0.
2022-07-18T12:21:41.870074330Z stdout [s6-init] making user provided files available at /var/run/s6/etc...exited 0.

Google coral dev board

Hello, is there any way to use dev board in synology. I really can't buy Google coral USB.

Do you also need to install the edge TPU runtime

First of all, thank you very much. Your tool is great. Install your frigate-syntax-dsm7, and then Google core USB just needs to plug into synology to work normally? Don't I need to install the edge TPU runtime on the official website?

Start the container?

Is it
sudo docker-compose up --detach --force-create
or
sudo docker-compose up --detach --force-recreate

Getting error on Docker startup

Hi,

I'm trying to run Frigate on a RS422+ using this. I've set up the coral TPU in the serial port and think its being recognised:
lsusb |__usb1 1d6b:0002:0404 09 2.00 480MBit/s 0mA 1IF (Linux 4.4.302+ xhci-hcd xHCI Host Controller 0000:05:00.3) hub |__1-1 f400:f400:0100 00 2.00 480MBit/s 200mA 1IF (Synology DiskStation 7F00238D1C1A2E27) |__usb2 1d6b:0003:0404 09 3.00 5000MBit/s 0mA 1IF (Linux 4.4.302+ xhci-hcd xHCI Host Controller 0000:05:00.3) hub |__2-2 1a6e:089a:0100 00 3.10 5000MBit/s 896mA 1IF ( ffffffd1ffffffb2ffffffdbffffffad)

I'm using the docker-compose file exactly as shown and set up the config file as:
mqtt:
enabled: False

cameras:
Front_Door:
enabled: True
ffmpeg:
inputs:
- path: rtsp://{FRIGATE_CAMERA_1_RTSP_CREDENTIALS}@192.168.40.11:554/rtsp
roles:
- detect
The indentation is fine - it just isn't showing here.

I'm getting an error on startup though
`

date stream content
2024/02/08 14:19:56 stdout [s6-finish] sending all processes the KILL signal and exiting.
2024/02/08 14:19:53 stdout [s6-finish] sending all processes the TERM signal.
2024/02/08 14:19:53 stdout [s6-finish] waiting for services.
2024/02/08 14:19:53 stdout [cont-finish.d] done.
2024/02/08 14:19:53 stdout [cont-finish.d] executing container finish scripts...
2024/02/08 14:19:53 stdout [cmd] python3 exited 1
2024/02/08 14:19:52 stdout *************************************************************
2024/02/08 14:19:52 stdout ***    End Config Validation Errors                       ***
2024/02/08 14:19:52 stdout *************************************************************
2024/02/08 14:19:52 stdout  
2024/02/08 14:19:52 stdout extra fields not permitted (type=value_error.extra)
2024/02/08 14:19:52 stdout cameras -> Front_Door -> enabled
2024/02/08 14:19:52 stdout extra fields not permitted (type=value_error.extra)
2024/02/08 14:19:52 stdout mqtt -> enabled
2024/02/08 14:19:52 stdout field required (type=value_error.missing)
2024/02/08 14:19:52 stdout mqtt -> host
2024/02/08 14:19:52 stdout pydantic.error_wrappers.ValidationError: 3 validation errors for FrigateConfig
2024/02/08 14:19:52 stdout File "pydantic/main.py", line 341, in pydantic.main.BaseModel.init
2024/02/08 14:19:52 stdout File "pydantic/main.py", line 521, in pydantic.main.BaseModel.parse_obj
2024/02/08 14:19:52 stdout return cls.parse_obj(config)
2024/02/08 14:19:52 stdout File "/opt/frigate/frigate/config.py", line 942, in parse_file
2024/02/08 14:19:52 stdout user_config = FrigateConfig.parse_file(config_file)
2024/02/08 14:19:52 stdout File "/opt/frigate/frigate/app.py", line 82, in init_config
2024/02/08 14:19:52 stdout self.init_config()
2024/02/08 14:19:52 stdout File "/opt/frigate/frigate/app.py", line 332, in start
2024/02/08 14:19:52 stdout Traceback (most recent call last):
2024/02/08 14:19:52 stdout extra fields not permitted (type=value_error.extra)
2024/02/08 14:19:52 stdout cameras -> Front_Door -> enabled
2024/02/08 14:19:52 stdout extra fields not permitted (type=value_error.extra)
2024/02/08 14:19:52 stdout mqtt -> enabled
2024/02/08 14:19:52 stdout field required (type=value_error.missing)
2024/02/08 14:19:52 stdout mqtt -> host
2024/02/08 14:19:52 stdout 3 validation errors for FrigateConfig
2024/02/08 14:19:52 stdout *************************************************************
2024/02/08 14:19:52 stdout ***    Config Validation Errors                           ***
2024/02/08 14:19:52 stdout *************************************************************
2024/02/08 14:19:52 stdout *************************************************************
2024/02/08 14:19:52 stdout ***    https://docs.frigate.video/configuration/index     ***
2024/02/08 14:19:52 stdout ***    Please check the docs at                           ***
2024/02/08 14:19:52 stdout ***    Your config file is not valid!                     ***
2024/02/08 14:19:52 stdout *************************************************************
2024/02/08 14:19:52 stdout *************************************************************

`

but I really can't see any errors in the config file!

Update frigate version

Hi,

thanks for your work.

Is there a way to have the latest frigate version compatible with HA ?

Enregistreur: custom_components.frigate
Source: custom_components/frigate/__init__.py:201
intégration: Frigate ([documentation](https://github.com/blakeblackshear/frigate), [problèmes](https://github.com/blakeblackshear/frigate-hass-integration/issues))
S'est produit pour la première fois: 07:31:28 (4 occurrences)
Dernier enregistrement: 07:33:19

Using a Frigate server (http://192.168.1.30:6545/) with version 0.11.1-2eada21 <= 0.12.1 which is not compatible -- you must upgrade: https://github.com/blakeblackshear/frigate/releases
Using a Frigate server (http://192.168.1.30:6545) with version 0.11.1-2eada21 <= 0.12.1 which is not compatible -- you must upgrade: https://github.com/blakeblackshear/frigate/releases

Thanks

Some beginner help, please

I've been running Frigate as a Home assistant addon for some time and it is excellent. Unfortunately, the CPU overhead is an issue so thought I'd look to run it elsewhere and came across your work.

I'm a complete docker novice though!

I have a Synology NAS but don't know if it has GIT. How do I find out?

I made the assumption that it doesn't and carried out step 2 and got this:
Screenshot 2022-10-26 at 19 54 20
So I assume that worked but I can't find the docker-compose.yml file on the NAS.

Where should it be?

Step 3 says to create the secrets.env file. Where on the NAS should it be it be saved?
Do I need a FRIGATE_CAMERA_2_RTSP_CREDENTIALS=my-camera-2-username:my-camera-2-password for each camera that I have?

I already have an extensive config file from running Frigate as a Home Assistant addon. Will this work in docker too?
What will I need to change as per step 5.

Many thanks for any help.

Ash

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.