Skip to content

Instantly share code, notes, and snippets.

@FRosner
Created May 18, 2017 15:02
Show Gist options
  • Save FRosner/c694dbdf36369c1f91537f24303cae99 to your computer and use it in GitHub Desktop.
Save FRosner/c694dbdf36369c1f91537f24303cae99 to your computer and use it in GitHub Desktop.
Nomad sample file starting a Node HTTP server.
job "http" {
datacenters = ["dc1"]
type = "service"
update {
stagger = "10s"
max_parallel = 1
}
group "http" {
count = 1
restart {
attempts = 10
interval = "5m"
delay = "25s"
mode = "delay"
}
ephemeral_disk {
size = 300
}
task "http" {
driver = "raw_exec"
config {
command = "http-server"
}
resources {
cpu = 500 # 500 MHz
memory = 256 # 256MB
network {
mbits = 10
port "http" {
static = "8080"
}
}
}
# The "service" stanza instructs Nomad to register this task as a service
# in the service discovery engine, which is currently Consul. This will
# make the service addressable after Nomad has placed it on a host and
# port.
#
# For more information and examples on the "service" stanza, please see
# the online documentation at:
#
# https://www.nomadproject.io/docs/job-specification/service.html
#
service {
name = "http"
tags = ["http"]
port = "http"
check {
name = "alive"
type = "tcp"
interval = "10s"
timeout = "2s"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment