forked from servian/hashiqube
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtraefik.nomad
89 lines (75 loc) · 1.92 KB
/
traefik.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
86
87
88
89
# https://traefik.io/blog/traefik-proxy-fully-integrates-with-hashicorp-nomad/
job "traefik" {
region = "global"
datacenters = ["dc1"]
type = "service"
group "traefik" {
count = 1
network {
port "http"{
static = 80
}
port "admin"{
static = 8181
}
port "api" {
static = 8080
}
port "metrics" {
static = 8082
}
port "grpc" {
static = 7233
}
}
service {
name = "traefik-dashboard"
provider = "nomad"
tags = [
"traefik.enable=true",
"traefik.http.routers.dashboard.rule=Host(`traefik.localhost`)",
"traefik.http.routers.dashboard.service=api@internal",
"traefik.http.routers.dashboard.entrypoints=web",
]
port = "http"
check {
type = "tcp"
interval = "10s"
timeout = "5s"
}
}
service {
name = "traefik-grpc"
provider = "nomad"
port = "grpc"
check {
type = "tcp"
interval = "10s"
timeout = "5s"
}
}
// service {
// name = "traefik-http"
// provider = "nomad"
// port = "http"
// }
task "server" {
driver = "docker"
config {
image = "traefik:v2.8.0-rc1"
ports = ["admin", "http", "api", "metrics", "grpc"]
args = [
"--api.dashboard=true",
"--api.insecure=true", ### For Test only, please do not use that in production
"--log.level=DEBUG",
"--entrypoints.web.address=:${NOMAD_PORT_http}",
"--entrypoints.traefik.address=:${NOMAD_PORT_admin}",
"--entrypoints.metrics.address=:${NOMAD_PORT_metrics}",
"--entrypoints.grpc.address=:${NOMAD_PORT_grpc}",
"--providers.nomad=true",
"--providers.nomad.endpoint.address=http://10.9.99.10:4646" ### IP to your nomad server
]
}
}
}
}