pati.to/gts.nomad

159 lines
3.0 KiB
Plaintext
Raw Normal View History

2024-04-23 04:30:02 +00:00
variable "package" {
type = map(object({
image = string
version = string
}))
default = {}
}
2023-01-20 18:55:33 +00:00
job "club-patito" {
2023-11-09 02:24:15 +00:00
datacenters = ["qro0"]
region = "qro0"
2024-04-23 04:30:02 +00:00
namespace = "social"
2023-01-20 18:55:33 +00:00
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"
2024-04-23 04:30:02 +00:00
vault {
role = "club-patito"
}
2023-01-20 18:55:33 +00:00
resources {
cpu = 128
memory = 64
memory_max = 512
}
config {
2024-04-23 04:30:02 +00:00
image = "${var.package.litestream.image}:${var.package.litestream.version}"
2023-01-20 18:55:33 +00:00
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"
2024-04-23 04:30:02 +00:00
vault {
role = "club-patito"
}
2023-01-20 18:55:33 +00:00
resources {
cpu = 256
memory = 128
memory_max = 512
}
config {
2024-04-23 04:30:02 +00:00
image = "${var.package.litestream.image}:${var.package.litestream.version}"
2023-01-20 18:55:33 +00:00
args = ["replicate"]
volumes = ["secrets/litestream.yaml:/etc/litestream.yml"]
}
template {
data = file("litestream.yaml")
destination = "secrets/litestream.yaml"
}
}
task "gotosocial" {
driver = "docker"
user = "nobody"
2024-04-23 04:30:02 +00:00
vault {
role = "club-patito"
}
2023-01-20 18:55:33 +00:00
config {
2024-04-23 04:30:02 +00:00
image = "${var.package.self.image}:${var.package.self.version}"
2023-01-20 18:55:33 +00:00
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"
}
}
}
}
}