-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathchatapp.nomad.hcl
70 lines (70 loc) · 1.74 KB
/
chatapp.nomad.hcl
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
variable "consul_namespace"{
description = "which consul namespace you want to deploy this job to"
default = "default"
}
job "chat-app" {
datacenters = ["eu-west-2","ukwest","sa-east-1","ap-northeast-1","dc1","dc1-eu-west-2"]
type = "service"
group "chat-app" {
count = 3
consul{
namespace = var.consul_namespace
}
update {
max_parallel = 1
health_check = "checks"
min_healthy_time = "15s"
healthy_deadline = "2m"
# canary = 3
}
network {
mode = "bridge"
port "http" {
to = 5000
}
}
task "chat-app" {
driver = "docker"
config {
image = "lhaig/anon-app:light-0.03"
}
env {
MONGODB_SERVER = "127.0.0.1"
MONGODB_PORT = "27017"
CONSUL_HTTP_TOKEN="11a9a399-3f1d-b431-2a09-5e50e0ea3a02"
}
resources {
cpu = 300 # MHz
memory = 512 # MB
}
} # end chat-app task
service {
name = "chat-app"
tags = ["urlprefix-/chat",
"traefik.enable=true",
"traefik.http.routers.chat.rule=PathPrefix(`/chat`)||PathPrefix(`/socket.io`)",
"traefik.http.services.chat.loadbalancer.sticky",
"traefik.http.middlewares.sslheader.headers.customrequestheaders.X-Forwarded-Proto = https"
]
port = "http"
check {
name = "chat-app alive"
type = "http"
path = "/chats"
interval = "10s"
timeout = "2s"
}
connect {
sidecar_service {
tags = ["chat-proxy"]
proxy {
upstreams {
destination_name = "mongodb"
local_bind_port = 27017
}
}
}
} # end connnect
} # end service
} # end chat-app group
}