Files
NomadBackup/nomad_backup/20251115_142246/hass.json
2025-11-21 13:07:40 -08:00

10 lines
8.1 KiB
JSON

{
"Format": "hcl2",
"JobID": "hass",
"JobModifyIndex": 13992633,
"Namespace": "default",
"Source": "job \"hass\" {\n # region = \"global\"\n datacenters = [\"dc1\"]\n type = \"service\"\n\n # priority = 50\n\n constraint {\n attribute = \"${attr.kernel.name}\"\n value = \"linux\"\n }\n constraint {\n attribute = \"${attr.unique.hostname}\"\n operator = \"regexp\"\n value = \"odroid.*\"\n }\n // constraint {\n // operator = \"distinct_hosts\"\n // value = \"true\"\n // }\n\n affinity {\n attribute = \"${attr.unique.hostname}\"\n value = \"odroid2\"\n weight = 80\n }\n update {\n # Stagger updates every 60 seconds\n stagger = \"10s\"\n max_parallel = 1\n }\n group \"hass\" {\n count = 1\n\n restart {\n attempts = 99\n interval = \"1h\"\n delay = \"10s\"\n mode = \"delay\"\n }\n\n task \"init\" {\n driver = \"docker\"\n lifecycle {\n hook = \"prestart\"\n sidecar = false\n }\n config {\n memory_hard_limit = \"2048\"\n image_pull_timeout = \"10m\"\n force_pull = false \n image = \"ghcr.io/sstent/rsync\"\n volumes = [\n \"/mnt/configs/${NOMAD_GROUP_NAME}:/config\",\n \"/mnt/Public/config/${NOMAD_GROUP_NAME}:/configbackup\",\n \"/mnt/Public/config/locks:/locks\"\n ]\n\n }\n env {\n DB_NAME = \"home-assistant_v2.db\"\n }\n resources {\n cpu = 20 # 500 MHz\n memory = 20 # 128MB\n }\n// template {\n// data = <<EOH\n// dbs:\n// - path: /config/radarr.db\n// replicas:\n// - path: /configbackup\n// EOH\n\n// destination = \"local/litestream.yml\"\n// }\n }\n\n\n task \"finalsync\" {\n driver = \"docker\"\n lifecycle {\n hook = \"poststop\"\n }\n config {\n memory_hard_limit = \"2048\"\n\n image = \"ghcr.io/sstent/rsync\"\n volumes = [\n \"/mnt/configs/${NOMAD_GROUP_NAME}:/config\",\n \"/mnt/Public/config/${NOMAD_GROUP_NAME}:/configbackup\",\n \"/mnt/Public/config/locks:/locks\"\n ]\n\n // args = [\"flock\", \"-x\", \"/locks/${NOMAD_GROUP_NAME}_rsync.lock\", \"rsync\", \"-av\",\"--exclude='8-20 * * *.db8-20 * * *'\",\"--exclude='8-20 * * *.db'\",\"--exclude='8-20 * * *.db-litestream'\",\"--exclude='generations'\",\"/config/\",\"/configbackup/\"]\n }\n resources {\n cpu = 20 # 500 MHz\n memory = 128 # 128MB\n }\n }\n\n\n task \"sync\" {\n driver = \"docker\"\n lifecycle {\n hook = \"poststart\"\n sidecar = true\n }\n config {\n memory_hard_limit = \"2048\"\n\n image = \"ghcr.io/sstent/rsync\"\n volumes = [\n \"/mnt/configs/:/configs\",\n \"/mnt/Public/config/${NOMAD_GROUP_NAME}:/configbackup\",\n ]\n args = [\"client\"]\n }\n env {\n CRON_TASK_1 = \"50 8-20 * * *rsync -av --exclude='*.db*' --exclude='*.db' --exclude='.db-litestream' --exclude='generations' /configs/${NOMAD_GROUP_NAME}/ /configbackup/;\"\n }\n resources {\n cpu = 20 # 500 MHz\n memory = 20 # 128MB\n }\n }\n\n\n\n\n\n task \"hass\" {\n driver = \"docker\"\n\n config {\n // image = \"homeassistant/armhf-homeassistant:latest\"\n image = \"ghcr.io/home-assistant/home-assistant:stable\"\n ports = [\"http\",\"http_8989\"]\n memory_hard_limit = \"2048\"\n network_mode = \"host\"\n cap_add = [\"NET_ADMIN\"]\n force_pull = false \n volumes = [\n \"/etc/localtime:/etc/localtime\",\n \"local/configuration.yaml:/config/configuration.yaml\",\n \"local/ui-lovelace.yaml:/config/ui-lovelace.yaml\",\n \"/mnt/configs/hass:/config\",\n ]\n // \"local/auth_provider.homeassistant:/config/.storage/auth_provider.homeassistant\"\n\n\n\n }\n env {\n JEMALLOC_DISABLE=true\n }\n service {\n name = \"${TASKGROUP}\"\n tags = [\"global\", \"homeassistant\", \"tools\",\"logo=home-assistant\"]\n port = \"http\"\n\n // check {\n // name = \"hass-alive\"\n // type = \"http\"\n // type = \"script\"\n // command = \"curl -sS http://localhost:8123\"\n // interval = \"120s\"\n // timeout = \"15s\"\n // path = \"/api/\"\n // port = \"http\"\n\n // check_restart {\n // limit = 10\n // grace = \"90s\"\n // ignore_warnings = false\n // }\n // }\n }\n\n // template {\n // data = <<EOH\n // homeassistant:\n // name: Our_House\n // latitude: 40.7654\n // longitude: -73.8175\n // elevation: 26\n // unit_system: metric\n // time_zone: America/New_York\n // auth_providers:\n // - type: trusted_networks\n // trusted_networks:\n // - 127.0.0.1\n // - ::1\n // - 192.168.1.0/24 \n // allow_bypass_login: true\n // - type: homeassistant\n // frontend:\n // lovelace:\n // mode: yaml\n // config:\n // http:\n // sun:\n // automation:\n // - alias: LightsAtSunset\n // trigger:\n // platform: sun\n // event: sunset\n // action:\n // service: switch.turn_on\n // entity_id: switch.lampdrawers\n // wemo:\n // static:\n // - 192.168.99.200 # StuBed\n // - 192.168.99.201 # LampDrawers\n // - 192.168.99.202 # BigLamp\n // - 192.168.99.203 # TallTree\n // - 192.168.99.204 # ShortTree\n // - 192.168.99.205 # TallTree\n // switch:\n // - platform: template\n // switches:\n // living_room_screen_off:\n // friendly_name: 'living_room_screen_off'\n // turn_on:\n // - service: input_boolean.turn_on\n // entity_id: input_boolean.living_room_screen_off\n // - service: webostv.command\n // data:\n // {\n // \"entity_id\": \"media_player.lg_webos_smart_tv\",\n // \"command\": \"com.webos.service.tvpower/power/turnOffScreen\"\n // }\n // turn_off:\n // - service: input_boolean.turn_off\n // entity_id: input_boolean.living_room_screen_off\n // - service: webostv.command\n // data:\n // {\n // \"entity_id\": \"media_player.lg_webos_smart_tv\",\n // \"command\": \"com.webos.service.tvpower/power/turnOnScreen\"\n // }\n // EOH\n\n // destination = \"local/configuration.yaml\"\n // }\n\n template {\n change_mode = \"restart\"\n data = \"{{ key \\\"homeassistant/configuration.yml\\\" }}\"\n destination = \"local/configuration.yaml\"\n }\n\n template {\n change_mode = \"restart\"\n data = \"{{ key \\\"homeassistant/lovelace.yml\\\" }}\"\n destination = \"local/ui-lovelace.yaml\"\n }\n\n resources {\n cpu = 256 # 500 MHz\n memory = 128 # 128MB\n }\n\n # Specify configuration related to log rotation\n logs {\n max_files = 10\n max_file_size = 15\n }\n\n kill_timeout = \"10s\"\n }\n\n network {\n port \"http\" {\n static = 8123\n to = 8123\n }\n port \"http_8989\" {\n static = 8989\n to = 8989\n }\n }\n }\n}\n",
"VariableFlags": null,
"Variables": "",
"Version": 8
}