-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathexample.nomad
50 lines (50 loc) · 1.1 KB
/
example.nomad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
job "example" {
datacenters = ["dc1"]
#constraint {
# attribute = "$attr.kernel.name"
# value = "linux"
#}
update {
stagger = "10s"
max_parallel = 2
}
group "python" {
count = 4
restart {
interval = "5m"
attempts = 10
delay = "2s"
mode = "delay"
}
task "server" {
driver = "docker"
config {
image = "python:alpine"
command= "/bin/sh"
args = ["-c", "echo hello from $HOSTNAME >index.html && python3 -m http.server 8000"]
port_map {
myhttp = 8000
}
}
service {
tags = ["global", "urlprefix-python/", "urlprefix-python.service.consul/"]
port = "myhttp"
check {
name = "alive"
type = "tcp"
interval = "10s"
timeout = "2s"
}
}
resources {
cpu = 500 # 500 Mhz
memory = 256 # 256MB
network {
mbits = 10
port "myhttp" {
}
}
}
}
}
}