cluster/infrastructure/gitea/nomad.hcl

123 lines
1.7 KiB
HCL
Raw Normal View History

job "gitea" {
datacenters = [ "homelab-1" ]
type = "service"
constraint {
attribute = "${attr.unique.hostname}"
value = "blowhole"
}
group "svc" {
count = 1
volume "gitea-data" {
type = "csi"
source = "gitea-data"
read_only = false
}
volume "gitea-db" {
type = "csi"
source = "gitea-db"
read_only = false
}
restart {
attempts = 5
delay = "5s"
}
network {
port "db" {
to = "3306"
}
port "http" {
static = "3666"
to = "3000"
}
}
service {
name = "gitea"
port = "http"
check {
type = "http"
path = "/"
interval = "2s"
timeout = "2s"
}
}
task "app" {
driver = "docker"
volume_mount {
volume = "gitea-data"
destination = "/data/gitea"
read_only = false
}
config {
image = "magicrb/gitea:yc5q5q4q4zmih2rr1xjamnzxx7agjz55"
ports = ["http"]
volumes = [
"local/app.ini:/app.ini",
]
labels = {
"traefik.http.routers.gitea.rule" = "Host(`gitea.redalder.org`)"
"traefik.http.services.gitea.loadbalancer.server.address" = "${NOMAD_HOST_ADDR_http}"
"traefik.enable" = "true"
}
}
env {
USER_UID = "5001"
USER_GID = "5001"
}
resources {
cpu = 500
memory = 1024
}
vault {
policies = ["gitea-policy"]
}
template {
data = file("./app.ini.tpl")
destination = "local/app.ini"
}
}
task "db" {
driver = "docker"
volume_mount {
volume = "gitea-db"
destination = "/data/mariadb"
read_only = false
}
config {
image = "mariadb:local"
ports = ["db"]
}
env {
USER_UID = "84"
USER_GID = "84"
}
resources {
cpu = 500
memory = 512
}
}
}
}