variable "flake_ref" { type = string } variable "flake_sha" { type = string } variable "store_path" { type = object({ mosquitto = string postgresql = string homeAssistant = string zigbee2mqtt = string }) } job "home-assistant" { datacenters = [ "homelab-1" ] type = "service" constraint { attribute = "${attr.unique.hostname}" value = "blowhole" } group "zigbee2mqtt" { count = 1 restart { attempts = 5 delay = "5s" } network { mode = "bridge" port "http" { static = 8456 to = 8456 } } volume "home-assistant_zigbee2mqtt" { type = "csi" source = "home-assistant_zigbee2mqtt" read_only = false attachment_mode = "file-system" access_mode = "single-node-writer" } service { name = "zigbee2mqtt" port = "8456" connect { sidecar_service { proxy { upstreams { destination_name = "mqtt" local_bind_port = 1883 datacenter = "homelab-1" } } } } } task "zigbee2mqtt" { driver = "docker" vault { policies = ["zigbee2mqtt-policy"] } config { nix_flake_ref = "${var.flake_ref}#nixngConfigurations.zigbee2mqtt.config.system.build.toplevel" nix_flake_sha = var.flake_sha nix_flake_store_path = var.store_path.zigbee2mqtt entrypoint = [ "init" ] devices = [ { host_path = "/dev/ttyZigbee" #"serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_4c004e9c53c9eb118a9f8b4f1d69213e-if00-port0" container_path = "/dev/ttyUSB0" } ] } resources { cpu = 128 memory = 256 memory_max = 512 } volume_mount { volume = "home-assistant_zigbee2mqtt" destination = "/var/zigbee2mqtt" read_only = false } template { data = <