Going bare metal

Security cameras part 3

This is part 3 of my security cameras series.

In the first part I wrote about setting up Frigate, a network video recorder.

In the second part I wrote about setting up Tailscale for remote access.

Moving to bare metal

After using Frigate in a virtual machine for a while, it became abundantly clear that sharing resources between Frigate and other virtual machines is double-plus-ungood for everyone involved.

Performance suffered, both for Frigate and for the other virtual machines, and I could not get PCI passthrough for the Coral EdgeTPU to work.

I scoured the online marketplaces for local bargains -- which were few -- and managed to score an aging "gaming PC" for 115 euros. The seller even delivered it to my door without extra cost! I popped my Coral EdgeTPU PCI card in, and installed the software...

Installing

I installed Debian 13, Docker and the Coral drivers.

Docker

There are probably many ways to install Docker, but this is what I did:


dpkg --get-selections docker.io docker-compose docker-doc podman-docker containerd runc
apt install ca-certificates curl
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
ls /etc/apt/keyrings/
less /etc/apt/keyrings/docker.asc 
chmod a+r /etc/apt/keyrings/docker.asc
ls -l /etc/apt/keyrings/
ls /etc/apt/sources.list.d
tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/debian
Suites: $(. /etc/os-release && echo "$VERSION_CODENAME")
Components: stable
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/docker.asc
EOF
apt update
apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Coral drivers: libedgetpu1-std

The Coral drivers are not available in Debian's package repositories. I had to get them from Google, and that process is more tedious in Debian 13 than it was in previous versions:


cd /etc/apt/keyrings
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg > coral.asc
apt install gpg
gpg --no-default-keyring --keyring ./tempring --export --output coral.gpg
rm coral.asc temp*
cat << EOF > /etc/apt/sources.list.d/coral.list
deb [signed-by=/etc/apt/keyrings/coral.gpg] https://packages.cloud.google.com/apt coral-edgetpu-stable main
EOF

apt-get update
apt install libedgetpu1-std

Coral drivers: Gasket

I had to build the Gasket DKMS myself.


mkdir /builds
cd /builds/
git clone https://github.com/jnicolson/gasket-builder
cd gasket-builder/
docker build --output . .
apt install ./gasket-dkms_1.0-18_all.deb
reboot

Yes, I had to reboot for this to start working.

Add this to Frigate's config/config.yaml:
detectors:
  coral:
    type: edgetpu
    device: pci

docker-compose.yml

I used the same docker-compose.yml as I did in part one, with one addition: since this box has an AMD Lexa GPU, I'm giving Frigate access to it for video decoding.

docker-compose.yml:
environment:
      LIBVA_DRIVER_NAME: "radeonsi"
Add this to Frigate's config/config.yaml for each camera:
  <camera>:
    ffmpeg:
      hwaccel_args: preset-vaapi

Conclusion

All that's left to do at this point is to run docker compose up -d and head over to Frigate's web interface and check that everything is working!