From b1bac2bd9e7ea06c90bd054cf897f5f393389f3c Mon Sep 17 00:00:00 2001 From: vincent Date: Sat, 7 May 2022 14:46:29 +0200 Subject: [PATCH] add home assistant --- homeassistant.nomad | 70 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 homeassistant.nomad diff --git a/homeassistant.nomad b/homeassistant.nomad new file mode 100644 index 0000000..1b06f10 --- /dev/null +++ b/homeassistant.nomad @@ -0,0 +1,70 @@ + +job "homeassistant" { + datacenters = ["homelab"] + type = "service" + meta { + forcedeploy = "1" + } + constraint { + attribute = "${attr.cpu.arch}" + value = "amd64" + } + + group "homeassistant"{ + network { + mode = "host" + port "http" { + to = 8123 + static = 8123 + } + port "coap"{ + to = 5683 + static = 5683 + } + } + vault{ + policies= ["access-tables"] + + } + + + + task "hass" { + driver = "docker" + service { + name = "${NOMAD_TASK_NAME}" + port = "http" + tags = [ + "traefik.enable=true", + "traefik.http.middlewares.httpsRedirect.redirectscheme.scheme=https", + "traefik.http.routers.${NOMAD_TASK_NAME}_insecure.middlewares=httpsRedirect", + "traefik.http.routers.${NOMAD_TASK_NAME}.rule=Host(`${NOMAD_TASK_NAME}.ducamps.win`)", + "traefik.http.routers.${NOMAD_TASK_NAME}.tls.domains[0].sans=${NOMAD_TASK_NAME}.ducamps.win", + "traefik.http.routers.${NOMAD_TASK_NAME}.tls.certresolver=myresolver", + ] + check { + type = "tcp" + interval = "10s" + timeout = "2s" + } + } + config { + image = "homeassistant/home-assistant:stable" + ports = ["http","coap"] + privileged = "true" + network_mode = "host" + volumes = [ + "/mnt/diskstation/nomad/hass:/config", + ] + } + env { + TZ = "Europe/Paris" + } + resources { + cpu = 800 # 500 MHz + memory = 512 # 512 MB + } + } + } + + }