-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtraefik.nomad
113 lines (107 loc) · 3.56 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
locals {
ports = [
{
port_label = "http"
port = 80
},
{
port_label = "admin"
port = 8080
},
{
port_label = "teeworldsport"
port = 8303
},
{
port_label = "csgoport"
port = 27015
},
{
port_label = "csgotvport"
port = 27020
},
{
port_label = "minecraftbuildbattleport"
port = 25565
},
{
port_label = "minecraftsurvivalport"
port = 25566
},
{
port_label = "radiusauthentication"
port = 1812
},
{
port_label = "radiusaccounting"
port = 1813
},
{
port_label = "radiustunnel"
port = 18120
}
]
}
job "traefik" {
datacenters = ["dc1"]
type = "service"
group "traefik" {
count = 1
network {
dynamic "port" { # works like a for loop
for_each = local.ports # list ; each element will be labeled as the name of the dynamic bloc
# iterator = port # optional, name of the temporary variable that represents the current element of the complex value (for_each)
labels = [port.value.port_label]
content {
static = port.value.port
}
}
}
service {
name = "traefik-http"
provider = "nomad"
port = "http"
}
task "server" {
constraint {
attribute = "${node.unique.name}"
operator = "regexp"
value = "games"
}
resources {
cpu = 2048
memory = 2048
}
driver = "docker"
config {
image = "traefik:latest"
ports = ["admin", "http", "teeworldsport", "csgoport", "csgotvport", "minecraftbuildbattleport", "minecraftsurvivalport", "radiusauthentication", "radiusaccounting", "radiustunnel"]
args = [
"--api.dashboard=true",
"--api.insecure=true", ### For Test only, please do not use that in production
"--entrypoints.web.address=:${NOMAD_PORT_http}",
"--entrypoints.traefik.address=:${NOMAD_PORT_admin}",
"--entrypoints.teeworlds-udp.address=:${NOMAD_PORT_teeworldsport}/udp",
"--entrypoints.minecraft-build-udp.address=:${NOMAD_PORT_minecraftbuildbattleport}/udp",
"--entrypoints.minecraft-build-tcp.address=:${NOMAD_PORT_minecraftbuildbattleport}",
"--entrypoints.minecraft-survival-udp.address=:${NOMAD_PORT_minecraftsurvivalport}/udp",
"--entrypoints.minecraft-survival-tcp.address=:${NOMAD_PORT_minecraftsurvivalport}",
"--entrypoints.csgo-udp.address=:${NOMAD_PORT_csgoport}/udp",
"--entrypoints.csgo-tcp.address=:${NOMAD_PORT_csgoport}",
"--entrypoints.csgotv-udp.address=:${NOMAD_PORT_csgotvport}/udp",
"--entrypoints.radiusauthentication-udp.address=:${NOMAD_PORT_radiusauthentication}/udp",
"--entrypoints.radiusaccounting-udp.address=:${NOMAD_PORT_radiusaccounting}/udp",
"--entrypoints.radiustunnel-udp.address=:${NOMAD_PORT_radiustunnel}/udp",
"--providers.nomad=true",
"--providers.nomad.endpoint.address=http://10.50.12.11:4646", ### IP to your nomad server
"--metrics.prometheus=true",
"--metrics.prometheus.addEntryPointsLabels=true",
"--metrics.prometheus.addrouterslabels=true",
"--metrics.prometheus.addServicesLabels=true",
"--accesslog=true",
"--log.level=DEBUG",
]
}
}
}
}