Files
PunktFri/punktfri.nomad
Henrik Jess Nielsen 585a8c8ada
All checks were successful
Build and Deploy PunktFri / build-and-deploy (push) Successful in 1m1s
deploy: update Traefik routing to punktfri.dk with TLS and www-redirect
2026-04-28 16:08:10 +02:00

116 lines
2.6 KiB
HCL

job "punktfri" {
region = "global"
datacenters = ["dc1"]
type = "service"
update {
stagger = "30s"
max_parallel = 1
canary = 1
min_healthy_time = "10s"
healthy_deadline = "5m"
auto_revert = true
auto_promote = true
progress_deadline = "10m"
}
group "punktfri" {
count = 1
constraint {
attribute = "${node.unique.name}"
value = "autobox.i80.dk"
}
network {
port "http" {}
}
reschedule {
attempts = 5
interval = "10m"
delay = "30s"
delay_function = "exponential"
max_delay = "120s"
unlimited = false
}
volume "punktfri-data" {
type = "host"
source = "punktfri-data"
read_only = false
}
service {
provider = "consul"
name = "punktfri"
port = "http"
tags = [
"traefik.enable=true",
"traefik.http.routers.punktfri.rule=Host(`punktfri.dk`) || Host(`www.punktfri.dk`)",
"traefik.http.routers.punktfri.tls=true",
"traefik.http.routers.punktfri.tls.certresolver=le",
"traefik.http.middlewares.punktfri-www-redirect.redirectregex.regex=^https://www.punktfri.dk/(.*)",
"traefik.http.middlewares.punktfri-www-redirect.redirectregex.replacement=https://punktfri.dk/$${1}",
"traefik.http.middlewares.punktfri-www-redirect.redirectregex.permanent=true",
"traefik.http.routers.punktfri.middlewares=punktfri-www-redirect"
]
canary_tags = [
"traefik.enable=false"
]
check {
name = "http_health_check"
type = "http"
path = "/health"
interval = "10s"
timeout = "5s"
check_restart {
limit = 3
grace = "10s"
}
}
}
task "web" {
driver = "docker"
volume_mount {
volume = "punktfri-data"
destination = "/app/instance"
read_only = false
}
config {
image = "registry.i80.dk/gitea/punktfri:latest"
ports = ["http"]
force_pull = true
}
restart {
attempts = 10
interval = "10m"
delay = "10s"
mode = "fail"
}
env {
APP_ENV = "production"
PORT = "${NOMAD_PORT_http}"
HOST = "0.0.0.0"
DATABASE = "/app/instance/punktfri.db"
LOG_FILE = "/app/instance/signups.log"
TZ = "Europe/Copenhagen"
}
resources {
cpu = 200
memory = 256
}
}
}
}