-
Notifications
You must be signed in to change notification settings - Fork 0
/
.nomad.standalone.job
88 lines (80 loc) · 2.25 KB
/
.nomad.standalone.job
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
job "[[.name]]" {
datacenters = ["[[.dc]]"]
type = "service"
group "[[.name]]" {
network {
mbits = 100
port "http" {
to = 80
}
}
count = 1
constraint {
operator = "distinct_hosts"
value = "true"
}
restart {
attempts = 3
interval = "20s"
delay = "5s"
mode = "delay"
}
update {
max_parallel = 1
min_healthy_time = "10s"
healthy_deadline = "1m"
auto_revert = true
}
task "[[.name]]" {
driver = "docker"
config {
image = "gometric/swagger-ui-consolidated:[[.imageversion]]"
ports = ["http"]
volumes = [
"local/config.json:/var/www/swagger-ui/config.json"
]
}
resources {
cpu = 50
memory = 100
}
service {
name = "[[.name]]"
port = "http"
tags = [
"traefik.enable=true",
"traefik.http.routers.[[.name]].rule=Host(`[[.urlprefix]]`)",
"traefik.http.routers.[[.name]].entrypoints=http"
]
check {
name = "swagger-ui"
type = "http"
path = "/"
interval = "10s"
timeout = "2s"
}
}
template {
data = <<EOF
{
"openapi": [{{ $firstItem := true }}{{ range services }}{{- range $idx, $service := connect .Name }}{{ if eq $idx 0 }}{{ if in .Tags "openapi-schema-provider" }}{{ if not $firstItem }}, {{ end }}
{
"slug": "{{index .ServiceMeta "openapi-schema-slug"}}",
"name": "{{index .ServiceMeta "openapi-schema-name"}}",
"url": "{{index .ServiceMeta "openapi-schema-url"}}"
}{{ $firstItem = false }}{{ end }}{{ end }}{{ end }}{{ end }}
],
"asyncapi": [{{ $firstItem := true }}{{ range services }}{{- range $idx, $service := connect .Name }}{{ if eq $idx 0 }}{{ if in .Tags "asyncapi-schema-provider" }}{{ if not $firstItem }}, {{ end }}
{
"slug": "{{index .ServiceMeta "asyncapi-schema-slug"}}",
"name": "{{index .ServiceMeta "asyncapi-schema-name"}}",
"url": "{{index .ServiceMeta "asyncapi-schema-url"}}"
}{{ $firstItem = false }}{{ end }}{{ end }}{{ end }}{{ end }}
]
}
EOF
destination = "local/config.json"
}
}
}
}