chore: backup infrastructure configurations [skip ci]

This commit is contained in:
github-actions[bot]
2026-05-11 02:07:23 +00:00
parent 7527c05a1d
commit 0126ce23f5
26 changed files with 174 additions and 33 deletions

View File

@@ -0,0 +1,110 @@
job "homeassistant" {
datacenters = ["dc1"]
type = "service"
constraint {
attribute = "${attr.kernel.name}"
value = "linux"
}
constraint {
attribute = "${attr.unique.hostname}"
operator = "regexp"
value = "odroid.*"
}
group "hass" {
count = 1
restart {
attempts = 99
interval = "1h"
delay = "10s"
mode = "delay"
}
task "wait-for-postgres" {
driver = "docker"
lifecycle {
hook = "prestart"
sidecar = false
}
config {
image = "postgres:16-alpine"
command = "sh"
args = ["-c", "until pg_isready -h master.postgres.service.dc1.consul -U hass; do sleep 3; done"]
}
resources {
cpu = 50
memory = 64
}
}
task "config-backup" {
driver = "docker"
lifecycle {
hook = "poststart"
sidecar = true
}
config {
image = "alpine:3.19"
command = "sh"
args = ["-c", "apk add --no-cache rsync && while true; do rsync -a --delete --exclude='*.db*' --exclude='*.log*' --exclude='tts/' --exclude='deps/' --exclude='__pycache__/' /config/ /configbackup/; sleep 1800; done"]
volumes = [
"/mnt/Public/config/homeassistant:/config:ro",
"/mnt/Public/config/homeassistant-backup:/configbackup",
]
}
resources {
cpu = 30
memory = 64
}
}
task "hass" {
driver = "docker"
config {
image = "linuxserver/homeassistant:latest"
network_mode = "host"
cap_add = ["NET_ADMIN"]
volumes = [
"/etc/localtime:/etc/localtime:ro",
"/mnt/Public/config/homeassistant:/config",
]
}
env {
JEMALLOC_DISABLE = true
PUID = "1000"
PGID = "1000"
}
resources {
cpu = 256
memory = 512
}
service {
name = "homeassistant"
tags = ["global", "homeassistant", "migration-target", "logo=home-assistant"]
port = "http"
check {
type = "http"
path = "/api/config"
interval = "10s"
timeout = "2s"
header {
Authorization = ["Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI3MGI3ZmQzN2RhNjg0ZDcwYmI0MzhlYjJhNzc1NTNjMSIsImlhdCI6MTc3ODQ1Njc1MiwiZXhwIjoyMDkzODE2NzUyfQ.gAWoByWWDDW9YSUpTZHb-xtdiFo-0u5RqHsxKhMQ4rc"]
}
}
}
}
network {
port "http" {
static = 8124
}
}
}
}