Frigate LXC image creation and deployment on Proxmox using HashiCorp Packer and Terraform.
Download this repo
Install packer and terraform then download this repository
Install the Google coral M.2 drivers on the Proxmox host with the following script
apt-get update
apt-get upgrade -y
apt install -y pve-headers git devscripts dh-dkms libedgetpu1-std
cd /home
git clone https://github.com/google/gasket-driver.git
cd gasket-driver/
debuild -us -uc -tc -b -d
cd ..
dpkg -i gasket-dkms_1.0-18_all.deb
Remember to disable the secure boot on the proxmox host
open the /packer
folder and edit the variables.pkrvars.hcl
then run the script below from the /packer
folder
packer init .
packer build -var-file="variables.pkrvars.hcl" .
frigate_version = "stable"
image_name = "FrigateProxmoxLxc"
image_output_path= "/mnt/storage/template/cache"
ssh_username = "root"
ssh_password = "ChangeMe"
remote_host = "127.0.0.1"
Name | Description | Type | Default | Required |
---|---|---|---|---|
frigate_config | Frigate configuration to load into the LXC image | string |
"mqtt:\n enabled: False\n\ncameras:\n dummy_camera:\n enabled: False\n ffmpeg:\n inputs:\n - path: rtsp://127.0.0.1:554/rtspn roles:\n - detect\n" |
no |
frigate_version | Frigate docker image tag used for download | string |
"stable" |
no |
image_name | Output image file name | string |
"FrigateProxmoxLxc" |
no |
image_output_path | Path where to create the image (path to your Proxmox LXC storage) | string |
"/mnt/storage/template/cache" |
no |
network_config | LXC network config file (will override content of /etc/network/interfaces) | string |
"auto lo\niface lo inet loopback\n\n# interfaces(5) file used by ifup(8) and ifdown(8)\n# Include files from /etc/network/interfaces.d:\nsource /etc/network/interfaces.d/*\n\nauto eth0\niface eth0 inet dhcp\n" |
no |
remote_host | Remote host IP address (usually Proxmox IP address) | string |
"127.0.0.1" |
no |
ssh_password | SSH user password | string |
"ChangeMe" |
no |
ssh_username | SSH user with admin access to create and manage LXC containers | string |
"root" |
no |
use_sudo | Run provisioning script as sudo | bool |
false |
no |
open the /terraform
folder and edit the variables.tfvars
then run the script below from the /terraform
folder
terraform init
terraform validate
terraform apply -var-file="variables.tfvars"
Name | Version |
---|---|
null | 3.2.2 |
proxmox | 2.9.14 |
No outputs.
proxmox = {
ip = "127.0.0.1"
user = "root@pam"
password = "ProxmoxUserPassword"
target_node = "pve-node-name"
}
image = {
name = "FrigateProxmoxLxc"
storage = "storage"
}
lxc_password = "ChangeMe"
network = {
name = "eth0"
bridge = "vmbr0"
ip4 = "10.10.10.10"
ip4mask = "24"
}
storage_fs = {
name = "local-lvm"
size = "8G"
}
storage_media = {
name = "storage"
size = "20G"
}
frigate_config = <<-EOT
mqtt:
enabled: False
cameras:
dummy_camera:
enabled: False
ffmpeg:
inputs:
- path: rtsp://127.0.0.1:554/rtsp
roles:
- detect
EOT
Name | Description | Type | Default | Required |
---|---|---|---|---|
ct_id | Frigate container ID | number |
0 |
no |
frigate_config | Frigate configuration to upload to the container | string |
"" |
no |
image | Frigate LXC image name and storage location | object({ |
{ |
no |
lxc_extraconfig | Extra configuration to append to the frigate .conf file | list(string) |
[] |
no |
lxc_hostname | Hostname for the Frigate container | string |
"frigate" |
no |
lxc_password | Root user password for the Frigate container | string |
"" |
no |
network | Network details for the Frigate container | object({ |
{ |
no |
on_boot | Start the Frigate container when the host boot | bool |
true |
no |
proxmox | Target proxmox instance | object({ |
{ |
no |
resources | Resources assigned to the Frigate container | object({ |
{ |
no |
storage_fs | Storage name and size of the virtual disk to create for Frigate container root fs | object({ |
{ |
no |
storage_media | Storage name (or path for binding mount) and size of the virtual disk to create for Frigate container root fs | object({ |
{ |
no |
- resource.null_resource.frigate_config (terraform/main.tf#116)
- resource.null_resource.frigate_lxc_config (terraform/main.tf#65)
- resource.null_resource.frigate_start (terraform/main.tf#95)
- resource.proxmox_lxc.frigate_lxc (terraform/main.tf#23)