homelab/nomad-job/apps/homeassistant.nomad

79 lines
1.9 KiB
Plaintext
Raw Permalink Normal View History

2022-05-07 12:46:29 +00:00
job "homeassistant" {
datacenters = ["homelab"]
2022-12-10 16:10:32 +00:00
priority = 90
2022-10-29 08:40:01 +00:00
type = "service"
2024-02-21 18:03:31 +00:00
constraint {
attribute = "${node.class}"
operator = "set_contains"
value = "cluster"
}
2022-05-07 12:46:29 +00:00
meta {
2022-05-23 19:44:34 +00:00
forcedeploy = "0"
2022-05-07 12:46:29 +00:00
}
constraint {
2022-11-13 16:01:03 +00:00
attribute = "${attr.cpu.arch}"
value = "amd64"
2022-05-07 12:46:29 +00:00
}
2022-10-29 08:40:01 +00:00
group "homeassistant" {
2022-05-07 12:46:29 +00:00
network {
mode = "host"
port "http" {
2022-10-29 08:40:01 +00:00
to = 8123
2022-05-07 12:46:29 +00:00
static = 8123
}
2022-10-29 08:40:01 +00:00
port "coap" {
to = 5683
2022-05-07 12:46:29 +00:00
static = 5683
}
}
task "hass" {
driver = "docker"
service {
name = "${NOMAD_TASK_NAME}"
port = "http"
tags = [
2022-10-29 08:40:01 +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",
2023-11-05 18:08:17 +00:00
"homer.url=https://${NOMAD_TASK_NAME}.ducamps.eu",
2022-10-29 08:40:01 +00:00
"traefik.enable=true",
2023-11-05 18:08:17 +00:00
"traefik.http.routers.${NOMAD_TASK_NAME}.rule=Host(`${NOMAD_TASK_NAME}.ducamps.eu`)",
"traefik.http.routers.${NOMAD_TASK_NAME}.tls.domains[0].sans=${NOMAD_TASK_NAME}.ducamps.eu",
2022-10-29 08:40:01 +00:00
"traefik.http.routers.${NOMAD_TASK_NAME}.tls.certresolver=myresolver",
2023-10-07 16:40:40 +00:00
"traefik.http.routers.${NOMAD_TASK_NAME}.entrypoints=web,websecure",
2022-05-07 12:46:29 +00:00
]
check {
type = "tcp"
interval = "10s"
timeout = "2s"
}
}
config {
2024-03-17 17:58:24 +00:00
image = "docker.service.consul:5000/homeassistant/home-assistant:stable"
2022-10-29 08:40:01 +00:00
ports = ["http", "coap"]
privileged = "true"
2022-05-07 12:46:29 +00:00
network_mode = "host"
volumes = [
"/mnt/diskstation/nomad/hass:/config",
]
}
env {
TZ = "Europe/Paris"
}
resources {
cpu = 800 # 500 MHz
memory = 512 # 512 MB
2022-10-29 08:40:01 +00:00
}
2022-05-07 12:46:29 +00:00
}
}
2022-10-29 08:40:01 +00:00
}