Created
January 6, 2019 16:58
-
-
Save ThomasObenaus/655607103fd7932d6572b4972aa4cc78 to your computer and use it in GitHub Desktop.
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
{ | |
"NomadDockerJobSrv": { | |
"prefix": "nomad-docker-service", | |
"scope": "hcl", | |
"body": [ | |
"# https://www.nomadproject.io/docs/job-specification/job.html", | |
"job \"${1:service-name}\" {", | |
" datacenters = [${2:\"public-services\"}]", | |
"", | |
" type = \"service\"", | |
"", | |
" # https://www.nomadproject.io/docs/job-specification/reschedule.html", | |
" reschedule {", | |
" delay = \"30s\"", | |
" delay_function = \"constant\"", | |
" unlimited = true", | |
" }", | |
"", | |
" # https://www.nomadproject.io/docs/job-specification/update.html", | |
" update {", | |
" max_parallel = 1", | |
" health_check = \"checks\"", | |
" min_healthy_time = \"10s\"", | |
" healthy_deadline = \"5m\"", | |
" progress_deadline = \"10m\"", | |
" auto_revert = true", | |
" canary = 0", | |
" stagger = \"30s\"", | |
" }", | |
"", | |
" # https://www.nomadproject.io/docs/job-specification/group.html", | |
" group \"${1:service-name}\" {", | |
" count = ${3:1}", | |
"", | |
" # https://www.nomadproject.io/docs/job-specification/restart.html", | |
" restart {", | |
" interval = \"10m\"", | |
" attempts = 2", | |
" delay = \"15s\"", | |
" mode = \"fail\"", | |
" }", | |
"", | |
" # https://www.nomadproject.io/docs/job-specification/task.html", | |
" task \"${1:service-name}\" {", | |
" driver = \"docker\"", | |
"", | |
" config {", | |
" image = \"${4:reponame}:latest\"", | |
" port_map = {", | |
" http = ${5:8080}", | |
" }", | |
" }", | |
"", | |
" # https://www.nomadproject.io/docs/job-specification/env.html", | |
" env {}", | |
"", | |
" # https://www.nomadproject.io/docs/job-specification/service.html", | |
" service {", | |
" name = \"${1:service-name}\"", | |
" port = \"http\"", | |
" tags = [\"urlprefix-/${1:service-name} strip=/${1:service-name}\"] # fabio", | |
"", | |
" check {", | |
" name = \"${1:service-name} health using http endpoint '/health'\"", | |
" port = \"http\"", | |
" type = \"http\"", | |
" path = \"/health\"", | |
" method = \"GET\"", | |
" interval = \"10s\"", | |
" timeout = \"2s\"", | |
" }", | |
"", | |
" # https://www.nomadproject.io/docs/job-specification/check_restart.html", | |
" check_restart {", | |
" limit = 3", | |
" grace = \"10s\"", | |
" ignore_warnings = false", | |
" }", | |
" }", | |
"", | |
" # https://www.nomadproject.io/docs/job-specification/resources.html", | |
" resources {", | |
" cpu = 100 # MHz", | |
" memory = 256 # MB", | |
"", | |
" # https://www.nomadproject.io/docs/job-specification/network.html", | |
" network {", | |
" mbits = 10", | |
" port \"http\" {}", | |
" }", | |
" }", | |
" }", | |
" }", | |
"}" | |
], | |
"description": "Nomad job definition for a docker based job of type service." | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment