-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathnomad.job
64 lines (54 loc) · 1.49 KB
/
nomad.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
job "scalad" {
region = "global"
datacenters = ["dc1"]
type = "service"
group "job-autoscaler" {
count = 1
task "scaler" {
driver = "docker"
config {
image = "trivago/scalad:0.1"
force_pull = true
network_mode = "host"
}
service {
name = "${NOMAD_JOB_NAME}"
tags = ["nomad-autoscaler", "scalad"]
port = "http"
check {
type = "http"
path = "/"
interval = "30s"
timeout = "2s"
}
}
template {
data = <<EOH
PORT = {{ env "NOMAD_ADDR_http" }}
NOMAD_HOST = "http://nomad.service.consul:4646"
##Slack Parameters for sending scaling events
USE_SLACK = "false"
SLACK_CHANNEL = "#scalad"
SLACK_USERNAME = "scalad"
SLACK_WEBHOOK = ""
##enable scaling of jobs with secrets from vault (this token needs access to the all policies of jobs that scalad will scale
VAULT_TOKEN = ""
##authentication for the manual scaling endpoints
HTTP_USER = "user"
HTTP_PASS = "pass"
##prometheus endpoint to run queries against for scaling
METRICS_ENDPOINT = "http://prometheus.service.consul:9090/api/v1/query?query="
EOH
destination = "secrets/file.env"
env = true
}
resources {
cpu = 300
memory = 128
network {
port "http"{}
}
}
}
}
}