Although there’s a community script for creating a Frigate LXC in Proxmox I’ve found it easier get working with external devices like hard drives and a Coral TPU by running as a VM rather than as an LXC.

Download the relevant Debian ISO image from https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/ and upload it to Proxmox.

Create a new VM with the following values.

  1. System
    • Machine: q35
    • BIOS: OVMF (UEFI)
    • Quemu Agent: true
  2. Disks
    • Disk Size: 32 GB
  3. CPU
    • Sockets: 1
    • Cores: 2
  4. Memory:
    • Memory: 8192 MiB

In my case I had an external USB connected hard drive that I wanted to use as dedicated storage for frigate. As I wanted this to be dedicated solely to the Frigate VM I created it as an LVM.

Identify the disk in Proxmox.

lsblk
fdisk -l /dev/sdb

Wipe the disk

wipefs -a /dev/sdb
sgdisk --zap-all /dev/sdb

Create LVM physical volume

pvcreate /dev/sdb

Create a volume group

vgcreate usb-vg /dev/sdb

Create a logical volume with 100% space

lvcreate -l 100%FREE -n usb-lv usb-vg

Add the LVM to Proxmox storage in Datacenter > Storage > Add > LVM

Go to your Frigate VM and under hardware add your new LVM as a hard disk.

If you recieve an error about not having any space on the VM then you can add it manually.

qm set 101 --virtio2 /dev/usb-vg/usb-lv

Now remote in to your VM and check it exists.

lsblk

Format the disk

mkfs.ext4 /dev/vda

Create mount point

mkdir -p /mnt/frigate

Find the drives UUID

blkid

Mount the disk

mount -U {UUID} /mnt/frigate
mount -a

Confirm mounting

df -h

Permantly mount the disk

nano /etc/fstab

Add the following line

UUID={UUID} /mnt/frigate ext4 defaults 0 2

In order to run frigate you now need install docker and then launch a docker-compose file.

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Create a docker-compose file

mkdir /home/frigate
nano /home/frigate/docker-compose.yml

Add the content

services:
  frigate:
    container_name: frigate
    privileged: true
    restart: unless-stopped
    shm_size: "128mb"
    image: ghcr.io/blakeblackshear/frigate:stable
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./config.yml:/config/config.yml:ro
      - /mnt/frigate:/media/frigate
    ports:
      - "5000:5000"
      - "8554:8554"
      - "1984:1984"
      - "8555:8555/udp"
    devices:
      - /dev/bus/usb:/dev/bus/usb
    networks:
      - frigate_net

networks:
  frigate_net:

Build and run docker

docker compose -f /home/frigate/docker-compose.yml up -d

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *