Created
March 18, 2021 12:57
-
-
Save nick96/02b29844856de7ecafa9e1c2e8bc7c09 to your computer and use it in GitHub Desktop.
Example nomad job
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
job "whoami" { | |
datacenters = ["dc1"] | |
type = "service" | |
update { | |
max_parallel = 1 | |
min_healthy_time = "10s" | |
healthy_deadline = "3m" | |
progress_deadline = "10m" | |
auto_revert = false | |
canary = 0 | |
} | |
migrate { | |
max_parallel = 1 | |
health_check = "checks" | |
min_healthy_time = "10s" | |
healthy_deadline = "5m" | |
} | |
group "webapp" { | |
count = 1 | |
network { | |
port "web" {} | |
} | |
service { | |
name = "whoami" | |
tags = ["web", "whoami"] | |
port = "web" | |
check { | |
type = "http" | |
method = "POST" | |
body = "{}" | |
path = "/" | |
interval = "5s" | |
timeout = "5s" | |
} | |
check { | |
type = "http" | |
method = "GET" | |
path = "/health" | |
interval = "5s" | |
timeout = "5s" | |
} | |
} | |
restart { | |
attempts = 2 | |
interval = "30m" | |
delay = "15s" | |
mode = "fail" | |
} | |
ephemeral_disk { | |
size = 300 | |
} | |
task "whoami" { | |
driver = "docker" | |
config { | |
image = "containous/whoami" | |
ports = ["web"] | |
args = ["-port", "${NOMAD_PORT_web}"] | |
} | |
resources { | |
cpu = 250 # 500 MHz | |
memory = 128 # 256MB | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment