-
Notifications
You must be signed in to change notification settings - Fork 19
/
hello-world-docker.nomad
73 lines (60 loc) · 1.35 KB
/
hello-world-docker.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
variable "datacenters" {
type = list(string)
description = "List of datacenters to deploy to."
default = ["dc1"]
}
variable "image_tag" {
type = string
description = "Docker image tag to deploy."
default = "latest"
}
job "hello-world-docker" {
datacenters = var.datacenters
type = "service"
# Specify this job to have rolling updates, with 30 second intervals.
update {
stagger = "30s"
max_parallel = 1
}
# A group defines a series of tasks that should be co-located
# on the same client (host). All tasks within a group will be
# placed on the same host.
group "web" {
# Specify the number of these tasks we want.
count = 1
restart {
attempts = 3
interval = "2m"
delay = "15s"
mode = "fail"
}
network {
port "http" { to = 80 }
}
task "frontend" {
driver = "docker"
config {
image = "rancher/hello-world:${var.image_tag}"
cap_drop = [
"ALL",
]
ports = ["http"]
}
resources {
cpu = 100
memory = 50
}
service {
name = "hello-docker"
tags = ["http"]
port = "http"
check {
type = "http"
path = "/"
interval = "10s"
timeout = "2s"
}
}
}
}
}