homelab/nomad-job/nomad.sample
vincent 42b8119f1d
Some checks failed
continuous-integration/drone/push Build is failing
chore: change domain in sample nomad file
2024-12-21 10:19:16 +01:00

76 lines
1.5 KiB
Plaintext

job "sample" {
datacenters = ["homelab"]
priority = 50
type = "service"
meta {
forcedeploy = "0"
}
constraint {
attribute = "${attr.cpu.arch}"
value = "amd64"
}
group "sample"{
network {
mode = "host"
port "http" {
to = 0000
}
}
volume "sample-data" {
type = "csi"
source = "sapmle-data"
access_mode = "multi-node-multi-writer"
attachment_mode = "file-system"
}
vault{
policies= ["policy_name"]
}
task "server" {
driver = "docker"
service {
name = "sample"
port = "http"
tags = [
"traefik.enable=true",
"traefik.http.routers.${NOMAD_JOB_NAME}.rule=Host(`${NOMAD_JOB_NAME}.ducamps.eu`)",
"traefik.http.routers.${NOMAD_JOB_NAME}.tls.domains[0].sans=${NOMAD_JOB_NAME}.ducamps.eu",
"traefik.http.routers.${NOMAD_JOB_NAME}.tls.certresolver=myresolver",
"traefik.http.routers.${NOMAD_JOB_NAME}.entrypoints=web,websecure",
]
}
volume_mount {
volume = "sample-data"
destination = "/app/data"
}
config {
image = "sample"
ports = ["http"]
volumes = [
"/local/sample:/media"
]
}
env {
}
template {
data= <<EOH
{{ with secret "secrets/data/sample"}}
{{end}}
EOH
destination = "secrets/sample.env"
env = true
}
resources {
memory = 300
}
}
}
}