-
Notifications
You must be signed in to change notification settings - Fork 0
/
mongo.nomad
85 lines (72 loc) · 1.58 KB
/
mongo.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
74
75
76
77
78
79
80
81
82
83
84
85
job "mongo" {
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 "database" {
count = 1
network {
port "db" { static = 27017 }
}
restart {
attempts = 2
interval = "30m"
delay = "15s"
mode = "fail"
}
#ephemeral_disk {
# sticky = true
# migrate = true
# size = 32768
#}
task "mongo_container" {
driver = "docker"
config {
image = "mongo:3.4"
ports = ["db"]
volumes = [
"/data:/data"
]
extra_hosts = [
"mylocalhost:${attr.unique.network.ip-address}",
"nomad-host-ip:${NOMAD_IP_db}",
"mongo:${NOMAD_IP_db}"
]
}
#resources {
# cpu = 2000
# memory = 1024
#}
service {
name = "mongo"
port = "db"
provider = "nomad"
check {
name = "http-alive"
type = "http"
path = "/"
interval = "10s"
timeout = "5s"
port = 27017
address_mode = "driver"
tags = [
"urlprefix-:27017 proto=tcp"
]
}
}
}
}