Files
portal/nomad-job.hcl

97 lines
2.0 KiB
HCL
Raw Permalink Normal View History

2026-05-18 23:49:27 +02:00
job "dolibarr" {
datacenters = ["dc1"]
type = "service"
group "dolibarr" {
count = 1
constraint {
attribute = "${node.unique.name}"
value = "autobox.i80.dk"
}
network {
port "http" {
2026-05-18 23:58:40 +02:00
static = 80
2026-05-18 23:49:27 +02:00
}
}
volume "dolibarr-documents" {
type = "host"
source = "dolibarr-documents"
read_only = false
}
task "app" {
driver = "docker"
config {
image = "dolibarr/dolibarr:latest"
ports = ["http"]
}
volume_mount {
volume = "dolibarr-documents"
destination = "/var/www/documents"
}
template {
data = <<EOH
DOLI_DB_PASSWORD="{{ key "dolibarr/db_password" }}"
DOLI_ADMIN_PASSWORD="{{ key "dolibarr/admin_password" }}"
EOH
destination = "secrets/dolibarr.env"
env = true
}
env {
2026-05-18 23:58:40 +02:00
DOLI_DB_HOST = "portaldb.service.consul"
2026-05-18 23:49:27 +02:00
DOLI_DB_PORT = "3306"
DOLI_DB_NAME = "dolibarr"
DOLI_DB_USER = "dolibarr"
DOLI_URL_ROOT = "https://portal.i80.dk"
DOLI_ADMIN_LOGIN = "admin"
DOLI_INSTALL_AUTO = "1"
DOLI_COMPANY_NAME = "i80"
}
resources {
cpu = 512
memory = 512
}
restart {
attempts = 5
delay = "20s"
interval = "3m"
mode = "fail"
}
service {
name = "dolibarr"
port = "http"
provider = "consul"
tags = [
"traefik.enable=true",
"traefik.http.routers.dolibarr.rule=Host(`portal.i80.dk`)",
"traefik.http.routers.dolibarr.tls=true",
"traefik.http.routers.dolibarr.tls.certresolver=letsencrypt",
]
check {
type = "http"
path = "/"
interval = "30s"
timeout = "10s"
check_restart {
limit = 3
grace = "60s"
}
}
}
}
}
}