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

Split out "full access" variants of frigate and frigate_beta add-ons #36

Merged
merged 2 commits into from
Oct 16, 2021
Merged
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
2 changes: 1 addition & 1 deletion frigate/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
],
"usb": true,
"tmpfs": true,
"full_access": true,
"full_access": false,
"environment": {
"CONFIG_FILE": "/config/frigate.yml"
},
Expand Down
2 changes: 1 addition & 1 deletion frigate_beta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
],
"usb": true,
"tmpfs": true,
"full_access": true,
"full_access": false,
"environment": {
"CONFIG_FILE": "/config/frigate.yml"
},
Expand Down
45 changes: 45 additions & 0 deletions frigate_fa/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
FROM ubuntu:20.04

WORKDIR /workspaces

# Default ENV
ENV LANG C.UTF-8
ENV DEBIAN_FRONTEND noninteractive

# Set shell
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# Use the mirror protocol for a fast mirror
RUN sed -i -e 's/http:\/\/archive\.ubuntu\.com\/ubuntu\//mirror:\/\/mirrors\.ubuntu\.com\/mirrors\.txt/' /etc/apt/sources.list

# Install docker, jq, socat
# https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/
RUN apt-get update && apt-get install -y --no-install-recommends \
apt-transport-https \
ca-certificates \
curl \
dbus \
software-properties-common \
gpg-agent \
git \
jq \
socat \
sudo \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - \
&& add-apt-repository "deb https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
&& apt-get update && apt-get install -y --no-install-recommends \
docker-ce \
docker-ce-cli \
containerd.io
# This is a development container. Don't bother to clean up apt cache, this way we have it handy later

COPY .devcontainer/start_ha.sh /usr/local/bin/start_ha.sh

# Install dependencies for the add-on development below. For example, if you're running Node.js,
# you may want something like the following...
# RUN apt-get install -y --no-install-recommends nodejs npm

# Generate a machine-id for this container
RUN rm /etc/machine-id && dbus-uuidgen --ensure=/etc/machine-id

ENV DEBIAN_FRONTEND=dialog
29 changes: 29 additions & 0 deletions frigate_fa/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// For format details, see https://aka.ms/vscode-remote/devcontainer.json
// TODO: When https://github.com/microsoft/vscode-remote-release/issues/2129 is fixed, move to ${localWorkspaceFolderBasename}\
{
"name": "Home Assistant Add-On",
"context": "..",
"dockerFile": "Dockerfile",
"appPort": [8123,5000],
"runArgs": [
"-e",
"GIT_EDITOR=code --wait",
"--privileged"
],
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/test_hassio/addons/local/myaddon,type=bind,consistency=delegated",
"workspaceFolder": "/workspaces/test_hassio/addons/local/myaddon",
"mounts": [
// Cache docker images between devcontainer rebuilds (and share between devcontainers)
"source=vsc-hassio-docker,target=/var/lib/docker,type=volume"
]

// Post-create command to initialize the workspace. For example, for a node.js add-on you may want:
// "postCreateCommand": "cd /workspaces/test_hassio/addons/local/myaddon && npm install",
// "extensions": [
// "dbaeumer.vscode-eslint",
// "maty.vscode-mocha-sidebar"
// ]
}
103 changes: 103 additions & 0 deletions frigate_fa/.devcontainer/start_ha.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#!/bin/bash
set -eE

DOCKER_TIMEOUT=30
DOCKER_PID=0


function start_docker() {
local starttime
local endtime

echo "Starting docker..."
dockerd 2> /dev/null &
DOCKER_PID=$!

echo "Waiting for docker to initialize..."
starttime="$(date +%s)"
endtime="$(date +%s)"
until docker info >/dev/null 2>&1; do
if [ $((endtime - starttime)) -le $DOCKER_TIMEOUT ]; then
sleep 1
endtime=$(date +%s)
else
echo "Timeout while waiting for docker to come up"
exit 1
fi
done
echo "Docker was initialized"
}


function stop_docker() {
local starttime
local endtime

echo "Stopping in container docker..."
if [ "$DOCKER_PID" -gt 0 ] && kill -0 "$DOCKER_PID" 2> /dev/null; then
starttime="$(date +%s)"
endtime="$(date +%s)"

# Now wait for it to die
kill "$DOCKER_PID"
while kill -0 "$DOCKER_PID" 2> /dev/null; do
if [ $((endtime - starttime)) -le $DOCKER_TIMEOUT ]; then
sleep 1
endtime=$(date +%s)
else
echo "Timeout while waiting for container docker to die"
exit 1
fi
done
else
echo "Your host might have been left with unreleased resources"
fi
}


function install() {
docker pull homeassistant/amd64-hassio-supervisor:247
docker pull homeassistant/amd64-hassio-cli:26
}

function cleanup_hass_data() {
rm -rf /workspaces/test_hassio/{apparmor,backup,config.json,dns,dns.json,homeassistant,homeassistant.json,ingress.json,share,ssl,tmp,updater.json}
rm -rf /workspaces/test_hassio/addons/{core,data,git}
}

function cleanup_docker() {
echo "Cleaning up stopped containers..."
docker rm $(docker ps -a -q)
}

function run_supervisor() {
docker run --rm --privileged \
--name hassio_supervisor \
--security-opt seccomp=unconfined \
--security-opt apparmor:unconfined \
-v /run/docker.sock:/run/docker.sock \
-v /run/dbus:/run/dbus \
-v "/workspaces/test_hassio":/data \
-v /etc/machine-id:/etc/machine-id:ro \
-e SUPERVISOR_SHARE="/workspaces/test_hassio" \
-e SUPERVISOR_NAME=hassio_supervisor \
-e SUPERVISOR_DEV=1 \
-e HOMEASSISTANT_REPOSITORY="homeassistant/qemux86-64-homeassistant" \
homeassistant/amd64-hassio-supervisor:247
}

case "$1" in
"--cleanup")
echo "Cleaning up old environment"
cleanup_docker || true
cleanup_hass_data || true
exit 0;;
*)
echo "Creating development Home Assistant environment"
start_docker
trap "stop_docker" ERR
install
cleanup_docker || true
run_supervisor
stop_docker;;
esac
1 change: 1 addition & 0 deletions frigate_fa/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.sh text eol=lf
41 changes: 41 additions & 0 deletions frigate_fa/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Start Home Assistant",
"type": "shell",
"command": "/usr/local/bin/start_ha.sh",
"group": {
"kind": "test",
"isDefault": true,
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
},{
"label": "Cleanup stale Home Assistant environment",
"type": "shell",
"command": "/usr/local/bin/start_ha.sh --cleanup",
"group": "test",
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
},{
"label": "Run Home Assistant CLI",
"type": "shell",
"command": "docker run --rm -ti -v /etc/machine-id:/etc/machine-id --network=hassio --add-host hassio:172.30.32.2 homeassistant/amd64-hassio-cli:dev",
"group": "test",
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
}
]
}
56 changes: 56 additions & 0 deletions frigate_fa/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
### 2.0
- BREAKING CHANGES: Update to 0.9.1 [release notes](https://github.com/blakeblackshear/frigate/releases/tag/v0.9.1)
- This also requires an update to the Home Assistant integration (custom component)

### 1.14
- Allow access to side panel for non-admins
- Add additional apex devices

### 1.13
- Update to 0.8.4

### 1.12
- Use new tmpfs config option

### 1.11
- Update to 0.8.3

### 1.10
- Update device config to avoid protection mode to be disabled for Coral access
- Add additional devices in hopes that protection mode can be enabled on RPi with hwaccel

### 1.9
- Update to avoid deprecation warning for new devices config
- Skip version to reduce confusion about the beta being newer than stable

### 1.7
- Fixes for supervisor 2021.02.5
- Configuration moved to Home Assistant config directory as `frigate.yml`

### 1.6
- Update to 0.8.1
- Better ffmpeg log handling
- WebUI fixes and improvements

### 1.5
- Config fixes for 0.8.0

### 1.4 - MAJOR BREAKING CHANGES
- Update to 0.8.0

### 1.3

- Update to 0.7.3

### 1.2

- Update to 0.7.2
- Support for PCI Coral devices

### 1.1

- Update to 0.7.1

### 1.0

- Initial release
9 changes: 9 additions & 0 deletions frigate_fa/DOCS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
You must create a config file as `frigate.yml` in the root of your Home Assistant configuration directory.

Frigate brings realtime object detection to any camera video feed supported by ffmpeg. More detailed docs are maintained [here](https://docs.frigate.video).

## Required Dependencies
- MQTT: Frigate communicates via MQTT

## Support
Please [open an issue](https://github.com/blakeblackshear/frigate/issues/new/choose) if you need support.
2 changes: 2 additions & 0 deletions frigate_fa/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ARG BUILD_ARCH
FROM blakeblackshear/frigate:0.9.1-${BUILD_ARCH}
20 changes: 20 additions & 0 deletions frigate_fa/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Home Assistant Add-on: Frigate NVR (Full Access)

Please reference the [release notes](https://github.com/blakeblackshear/frigate/releases) for breaking changes.

![Supports aarch64 Architecture][aarch64-shield] ![Supports amd64 Architecture][amd64-shield] ![Supports armv7 Architecture][armv7-shield]

NVR with realtime local object detection for IP cameras.

You must create a config file as `frigate.yml` in the root of your Home Assistant configuration directory.

This version of the add-on requests full device access, in order to turn off protection mode for those devices which don't work with protection mode enabled.

[Documentation](https://docs.frigate.video)

[Frigate]: https://github.com/blakeblackshear/frigate
[aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg
[amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg
[armhf-shield]: https://img.shields.io/badge/armhf-no-red.svg
[armv7-shield]: https://img.shields.io/badge/armv7-yes-green.svg
[i386-shield]: https://img.shields.io/badge/i386-no-red.svg
51 changes: 51 additions & 0 deletions frigate_fa/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "Frigate NVR (Full Access)",
"version": "2.0",
"panel_icon": "mdi:cctv",
"slug": "frigate-fa",
"description": "NVR with realtime local object detection for IP cameras",
"url": "https://github.com/blakeblackshear/frigate",
"startup": "application",
"boot": "auto",
"webui": "http:https://[HOST]:[PORT:5000]/",
"watchdog": "http:https://[HOST]:[PORT:5000]/",
"ingress": true,
"ingress_port": 5000,
"ingress_entry": "/",
"panel_admin": false,
"ports": {
"5000/tcp": 5000,
"1935/tcp": 1935
},
"ports_description": {
"5000/tcp": "Web interface (Not required for Hass.io Ingress)",
"1935/tcp": "RTMP streams"
},
"host_network": false,
"devices": [
"/dev/dri/renderD128",
"/dev/apex_0",
"/dev/apex_1",
"/dev/apex_2",
"/dev/dri/card0",
"/dev/vchiq"
],
"usb": true,
"tmpfs": true,
"full_access": true,
"environment": {
"CONFIG_FILE": "/config/frigate.yml"
},
"options": {},
"schema": {},
"services": ["mqtt:need"],
"arch": [
"amd64",
"armv7",
"aarch64"
],
"map": [
"media:rw",
"config:rw"
]
}
Binary file added frigate_fa/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frigate_fa/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading