club-patito/gts.nomad

144 lines
2.7 KiB
HCL

job "club-patito" {
datacenters = ["nyc1"]
region = "nyc1"
vault {
policies = ["club-patito"]
change_mode = "signal"
change_signal = "SIGHUP"
}
group "club-patito" {
reschedule {
delay = "5s"
delay_function = "fibonacci"
max_delay = "5m"
unlimited = true
}
restart {
attempts = 60
interval = "10m"
delay = "10s"
mode = "delay"
}
network {
mode = "host"
port "gotosocial" {
host_network = "private"
}
}
task "db-restore" {
lifecycle {
hook = "prestart"
}
driver = "docker"
user = "nobody"
resources {
cpu = 128
memory = 64
memory_max = 512
}
config {
image = "litestream/litestream:0.3.9"
args = ["restore", "/alloc/gotosocial.db"]
volumes = ["secrets/litestream.yaml:/etc/litestream.yml"]
}
template {
data = file("litestream.yaml")
destination = "secrets/litestream.yaml"
}
}
task "db-replicate" {
lifecycle {
hook = "prestart"
sidecar = true
}
driver = "docker"
user = "nobody"
resources {
cpu = 256
memory = 128
memory_max = 512
}
config {
image = "litestream/litestream:0.3.9"
args = ["replicate"]
volumes = ["secrets/litestream.yaml:/etc/litestream.yml"]
}
template {
data = file("litestream.yaml")
destination = "secrets/litestream.yaml"
}
}
task "gotosocial" {
driver = "docker"
user = "nobody"
config {
image = "superseriousbusiness/gotosocial:0.11.1"
ports = ["gotosocial"]
args = [
"--config-path",
"/secrets/gotosocial.yaml",
"server",
"start"
]
}
template {
data = file("gotosocial.yaml")
destination = "secrets/gotosocial.yaml"
}
resources {
cpu = 256
memory = 512
memory_max = 1024
}
service {
name = "gotosocial"
port = "gotosocial"
tags = [
"nidito.service",
"nidito.dns.enabled",
"nidito.http.enabled",
"nidito.http.public",
"nidito.ingress.enabled",
]
meta {
nidito-acl = "allow external"
nidito-http-buffering = "off"
nidito-http-tls = "pati.to"
nidito-http-domain = "club.pati.to"
nidito-http-wss = "on"
nidito-http-max-body-size = "40m"
}
check {
name = "gotosocial"
type = "tcp"
interval = "10s"
timeout = "2s"
}
}
}
}
}