lure-web-old/template.nomad

84 lines
2.0 KiB
HCL

job "lure-web" {
region = "global"
datacenters = ["dc1"]
type = "service"
group "lure-web" {
network {
port "api" {
to = 8080
}
port "http" {
to = 3000
}
}
task "backend" {
driver = "docker"
env {
LURE_API_GITHUB_SECRET = "${LURE_API_GITHUB_SECRET}"
// Hack to force Nomad to re-deploy the service
// instead of ignoring it
COMMIT_SHA = "${DRONE_COMMIT_SHA}"
}
config {
image = "gitea.elara.ws/lure/backend:latest"
ports = ["api"]
}
service {
name = "lure-backend"
port = "api"
tags = [
"traefik.enable=true",
"traefik.http.routers.lure-backend.rule=Host(`api.lure.sh`)",
"traefik.http.routers.lure-backend.tls.certresolver=letsencrypt"
]
check {
type = "tcp"
port = "api"
interval = "30s"
timeout = "2s"
}
}
}
task "frontend" {
driver = "docker"
config {
image = "gitea.elara.ws/lure/frontend:latest"
ports = ["http"]
args = ["build"]
}
service {
name = "lure-web"
port = "http"
tags = [
"traefik.enable=true",
"traefik.http.middlewares.lure-redir.redirectRegex.regex=^https://(www\\.lure\\.sh|lure\\.elara\\.ws)",
"traefik.http.middlewares.lure-redir.redirectRegex.replacement=https://lure.sh",
"traefik.http.middlewares.lure-redir.redirectRegex.permanent=true",
"traefik.http.routers.lure-frontend.rule=(Host(`lure.sh`) || Host(`www.lure.sh`) || Host(`lure.elara.ws`)) && !Query(`go-get=1`)",
"traefik.http.routers.lure-frontend.middlewares=lure-redir",
"traefik.http.routers.lure-frontend.tls.certresolver=letsencrypt",
]
}
}
}
constraint {
attribute = "${attr.cpu.arch}"
operator = "set_contains_any"
value = "amd64,arm64,riscv64"
}
}