homelab/nomad-job/nomad.sample

76 lines
1.5 KiB
Plaintext
Raw Normal View History

2022-04-30 19:09:37 +00:00
job "sample" {
datacenters = ["homelab"]
2022-09-04 14:43:35 +00:00
priority = 50
2022-04-30 19:09:37 +00:00
type = "service"
meta {
forcedeploy = "0"
}
constraint {
attribute = "${attr.cpu.arch}"
value = "amd64"
}
group "sample"{
network {
mode = "host"
port "http" {
to = 0000
}
}
2024-04-28 14:11:37 +00:00
volume "sample-data" {
type = "csi"
source = "sapmle-data"
access_mode = "multi-node-multi-writer"
attachment_mode = "file-system"
}
2022-04-30 19:09:37 +00:00
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",
2022-04-30 19:09:37 +00:00
"traefik.http.routers.${NOMAD_JOB_NAME}.tls.certresolver=myresolver",
2024-01-24 17:42:59 +00:00
"traefik.http.routers.${NOMAD_JOB_NAME}.entrypoints=web,websecure",
2022-04-30 19:09:37 +00:00
]
}
2024-04-28 14:11:37 +00:00
volume_mount {
volume = "sample-data"
destination = "/app/data"
}
2022-04-30 19:09:37 +00:00
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
}
2022-05-12 09:37:24 +00:00
resources {
memory = 300
}
2022-04-30 19:09:37 +00:00
}
}
}