From a0ecf2ba1e0958334dfbb85253f9b394e8cd1431 Mon Sep 17 00:00:00 2001 From: Viktor Barzin Date: Thu, 4 Jan 2024 22:11:32 +0000 Subject: [PATCH] add frigate deployment with london camera enabled and 2 valchedrym cameras disabled [ci skip] --- main.tf | 3 + modules/kubernetes/frigate/main.tf | 88 ++++++++++++++++++++++++------ modules/kubernetes/main.tf | 6 +- 3 files changed, 77 insertions(+), 20 deletions(-) diff --git a/main.tf b/main.tf index 76c941a2..0c064703 100644 --- a/main.tf +++ b/main.tf @@ -65,6 +65,7 @@ variable "ingress_crowdsec_captcha_site_key" {} variable "vaultwarden_smtp_password" {} variable "resume_database_url" {} variable "resume_redis_url" {} +variable "frigate_valchedrym_camera_credentials" { default = "" } variable "ansible_prefix" { default = "ANSIBLE_VAULT_PASSWORD_FILE=~/.ansible/vault_pass.txt ansible-playbook -i playbook/hosts.yaml playbook/linux.yml -t linux/initial_setup" @@ -339,6 +340,8 @@ module "kubernetes_cluster" { resume_redis_url = var.resume_redis_url resume_database_url = var.resume_database_url + + frigate_valchedrym_camera_credentials = var.frigate_valchedrym_camera_credentials } diff --git a/modules/kubernetes/frigate/main.tf b/modules/kubernetes/frigate/main.tf index e01457dc..7df4d846 100644 --- a/modules/kubernetes/frigate/main.tf +++ b/modules/kubernetes/frigate/main.tf @@ -1,4 +1,9 @@ variable "tls_secret_name" {} +variable "valchedrym_camera_credentials" { + // in the format: + // username:password + default = "" +} resource "kubernetes_namespace" "frigate" { metadata { @@ -30,22 +35,54 @@ resource "kubernetes_config_map" "config" { mqtt: enabled: False cameras: + # Temp disabled until valchedrym is back up valchedrym-cam-1: - ffmpeg: - inputs: - - path: rtsp://admin:REDACTED_RTSP_PW@192.168.0.11:554/Streaming/Channels/101 # <----- The stream you want to use for detection - detect: - enabled: False # <---- disable detection until you have a working camera feed - width: 704 # <---- update for your camera's resolution - height: 576 # <---- update for your camera's resolution + enabled: false + ffmpeg: + inputs: + - path: rtsp://${var.valchedrym_camera_credentials}@192.168.0.11:554/Streaming/Channels/101 # <----- The stream you want to use for detection + detect: + enabled: False # <---- disable detection until you have a working camera feed + width: 704 # <---- update for your camera's resolution + height: 576 # <---- update for your camera's resolution valchedrym-cam-2: + enabled: false + ffmpeg: + inputs: + - path: rtsp://${var.valchedrym_camera_credentials}@192.168.0.11:554/Streaming/Channels/201 # <----- The stream you want to use for detection + detect: + enabled: False # <---- disable detection until you have a working camera feed + width: 704 # <---- update for your camera's resolution + height: 576 # <---- update for your camera's resolution + london-ipcam: + enabled: true ffmpeg: inputs: - - path: rtsp://admin:REDACTED_RTSP_PW@192.168.0.11:554/Streaming/Channels/201 # <----- The stream you want to use for detection + - path: rtsp://192.168.2.2:8554/london_cam # <----- The stream you want to use for detection + roles: + - rtmp + - record + - detect detect: - enabled: False # <---- disable detection until you have a working camera feed - width: 704 # <---- update for your camera's resolution - height: 576 # <---- update for your camera's resolution + enabled: True + width: 1280 + height: 720 + record: + enabled: False # Not needed for this camera but keeping for reference + events: + retain: + default: 10 + objects: + # Optional: list of objects to track from labelmap.txt (full list - https://docs.frigate.video/configuration/objects) + track: + - person + - shoe + - handbag + - wine glass + - knife + - pizza + - laptop + - book EOT } # Password hashes are different each time and avoid changing secret constantly. @@ -110,6 +147,14 @@ resource "kubernetes_deployment" "frigate" { mount_path = "/config/config.yml" sub_path = "config.yml" } + volume_mount { + name = "media" + mount_path = "/media/frigate" + } + volume_mount { + name = "dshm" + mount_path = "/dev/shm" + } } volume { name = "config" @@ -117,13 +162,20 @@ resource "kubernetes_deployment" "frigate" { name = "config" } } - # volume { - # name = "audiobooks" - # nfs { - # path = "/mnt/main/frigate/audiobooks" - # server = "10.0.10.15" - # } - # } + volume { + name = "dshm" + empty_dir { + medium = "Memory" + size_limit = "1Gi" + } + } + volume { + name = "media" + nfs { + path = "/mnt/main/frigate" + server = "10.0.10.15" + } + } } } } diff --git a/modules/kubernetes/main.tf b/modules/kubernetes/main.tf index 00c1efdf..824d024e 100644 --- a/modules/kubernetes/main.tf +++ b/modules/kubernetes/main.tf @@ -52,6 +52,7 @@ variable "ingress_crowdsec_captcha_site_key" {} variable "vaultwarden_smtp_password" {} variable "resume_database_url" {} variable "resume_redis_url" {} +variable "frigate_valchedrym_camera_credentials" { default = "" } resource "null_resource" "core_services" { # List all the core modules that must be provisioned first @@ -395,6 +396,7 @@ module "audiobookshelf" { } module "frigate" { - source = "./frigate" - tls_secret_name = var.tls_secret_name + source = "./frigate" + tls_secret_name = var.tls_secret_name + valchedrym_camera_credentials = var.frigate_valchedrym_camera_credentials }