-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #4: Frigate configuration work.
- Loading branch information
1 parent
f6b8849
commit 77b2264
Showing
10 changed files
with
138 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# These are supported funding model platforms | ||
--- | ||
github: geerlingguy | ||
patreon: geerlingguy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
name: CI | ||
'on': | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
schedule: | ||
- cron: "9 10 * * 0" | ||
|
||
jobs: | ||
|
||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the codebase. | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python 3. | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install test dependencies. | ||
run: pip3 install yamllint | ||
|
||
- name: Lint code. | ||
run: | | ||
yamllint . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
inventory.ini |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,56 @@ | ||
# Raspberry Pi NVR Configuration | ||
|
||
This repository contains a Raspberry Pi NVR configuration so a Pi 4 or CM4 can be used as an NVR, or Network Video Recorder, for capturing and managing CCTV/IP camera streams. | ||
This repository contains Raspberry Pi NVR configurations so a Pi 4 or CM4 can be used as an NVR, or Network Video Recorder, for capturing and managing CCTV/IP camera streams. | ||
|
||
Currently I'm experimenting with which DVR application I'm going to use. So I'm not updating the README further until I pick something. | ||
Currently I'm experimenting with many different DVR applications. | ||
|
||
See the 'NVR Solutions' section below for current thoughts. | ||
See the 'NVR Solutions' section below for my thoughts on different applications, and read through the GitHub issues to see current progress in testing. | ||
|
||
## Raspberry Pi Setup | ||
|
||
For an NVR, you're going to want to use storage other than built-in eMMC (CM4 only) or microSD (Lite CM4 or Pi 4 model B). For my own purposes, I'm booting a Pi off of an NVMe drive, using the new [native NVMe boot option](https://www.jeffgeerling.com/blog/2021/raspberry-pi-can-boot-nvme-ssds-now) on the CM4. | ||
For an NVR, you should use storage other than built-in eMMC (CM4 only) or microSD (Lite CM4 or Pi 4 model B). For my own purposes, I'm booting a Pi off of an NVMe drive, using the new [native NVMe boot option](https://www.jeffgeerling.com/blog/2021/raspberry-pi-can-boot-nvme-ssds-now) on the CM4. | ||
|
||
You also need a lot of storage—multiple TB of storage is best if you want any form of long-term archive. | ||
|
||
And finally, some applications like Frigate work great if you add on something like Google Coral TPU via USB. But for now I'm not doing that. | ||
And finally, some applications like Frigate work great if you add on something like Google Coral TPU via USB. | ||
|
||
To prep the Pi, make sure you are running the latest version of Raspberry Pi OS, can reach the Pi over SSH, and can log into it with something like `ssh [email protected]` (that's the default address I'm using to test). | ||
|
||
## Installation | ||
|
||
TODO. Install Ansible, run playbook. | ||
Make sure you have Ansible installed (I install with Pip: `pip3 install ansible`). | ||
|
||
Copy the `example.inventory.ini` to `inventory.ini` and change the IP address under the `[dvr]` section to the IP or hostname of your Pi, and the username after `ansible_user` to your Pi username. | ||
|
||
Run the Ansible playbook to prepare the Pi for NVR applications: | ||
|
||
``` | ||
ansible-playbook main.yml | ||
``` | ||
|
||
> Ideally you will have set up an [SSH key pair](https://www.raspberrypi-spy.co.uk/2019/02/setting-up-ssh-keys-on-the-raspberry-pi/) to access the Pi without entering a password. If you need to enter a password to SSH into the Pi, add `-K` after the `ansible-*` commands and Ansible will prompt you for the password when it runs. | ||
Then run specific NVR playbook, e.g. | ||
|
||
``` | ||
ansible-playbook shinobi/main.yml | ||
ansible-playbook frigate/main.yml | ||
``` | ||
|
||
### Shinobi First-time setup | ||
Be sure to have storage settings configured (e.g. any network or local mounts) prior to starting any of these applications. | ||
|
||
### Frigate setup | ||
|
||
The Frigate `docker-compose` configures the Frigate storage volume to be synced to `/mnt/frigate`, so you should either mount a network share in that path, or create a local volume there. | ||
|
||
In my case, I either set up a RAID volume or a single disk (NVMe, SSD, or HDD), and made sure it was mounted at the path `/mnt/frigate` before running the playbook. | ||
|
||
### Shinobi setup | ||
|
||
After the playbook completes, visit the URL of your NVR, at the `/super` path, e.g. `http://dvr.local:8080/super`. The default login credentials are: | ||
|
||
- Email: `[email protected]` | ||
- Password: `admin` | ||
|
||
TODO. | ||
|
||
## Raspberry Pi NVR Solutions | ||
|
||
Here are my notes on different options for DVR/NVR/CCTV solutions that could run on the Pi: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[dvr] | ||
10.0.100.80 | ||
|
||
[dvr:vars] | ||
ansible_user=admin | ||
frigate_rtsp_password=changeme |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
- hosts: dvr | ||
become: true | ||
|
||
vars: | ||
frigate_storage_path: /mnt/frigate | ||
|
||
handlers: | ||
- name: Restart frigate | ||
community.docker.docker_compose: | ||
project_src: "~/frigate/" | ||
build: false | ||
restarted: true | ||
become: false | ||
|
||
pre_tasks: | ||
- name: Update apt cache. | ||
ansible.builtin.apt: update_cache=yes cache_valid_time=600 | ||
|
||
tasks: | ||
- name: Ensure pip is installed. | ||
ansible.builtin.apt: | ||
name: python3-pip | ||
state: present | ||
|
||
- name: Install required python libraries. | ||
ansible.builtin.pip: | ||
name: | ||
- docker | ||
- docker-compose | ||
state: present | ||
|
||
- name: Create Frigate folder on Pi. | ||
ansible.builtin.file: | ||
path: "~/frigate" | ||
state: directory | ||
mode: '0755' | ||
become: false | ||
|
||
- name: Copy Frigate files to Pi. | ||
ansible.builtin.template: | ||
src: "{{ item }}" | ||
dest: "~/frigate/{{ item }}" | ||
mode: '0640' | ||
become: false | ||
notify: Restart frigate | ||
with_items: | ||
- docker-compose.yml.j2 | ||
- frigate.yml.j2 | ||
|
||
- name: Ensure Frigate is running. | ||
community.docker.docker_compose: | ||
project_src: "~/frigate/" | ||
build: false | ||
become: false |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters