homelab/nomad-job/homeassistant.nomad

76 lines
1.7 KiB
Plaintext
Raw Normal View History

2022-05-07 12:46:29 +00:00
job "homeassistant" {
datacenters = ["homelab"]
type = "service"
meta {
2022-05-23 19:44:34 +00:00
forcedeploy = "0"
2022-05-07 12:46:29 +00:00
}
constraint {
2022-05-09 06:50:17 +00:00
attribute = "${attr.unique.hostname}"
value = "oscar"
2022-05-07 12:46:29 +00:00
}
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 = [
2022-05-23 19:44:34 +00:00
"homer.enable=true",
"homer.name=Hass",
"homer.service=Application",
"homer.subtitle=Home Assistant",
"homer.logo=https://raw.githubusercontent.com/home-assistant/assets/master/logo/logo-small.svg",
"homer.target=_blank",
"homer.url=https://${NOMAD_TASK_NAME}.ducamps.win",
2022-05-07 12:46:29 +00:00
"traefik.enable=true",
"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
}
}
}
}