2022-03-12 18:07:52 +00:00
|
|
|
job "grafana" {
|
|
|
|
datacenters = ["dc1"]
|
|
|
|
|
|
|
|
group "grafana" {
|
|
|
|
count = 1
|
|
|
|
|
|
|
|
network {
|
|
|
|
mode = "bridge"
|
|
|
|
|
|
|
|
port "web" {
|
|
|
|
host_network = "loopback"
|
|
|
|
to = 3000
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-13 17:13:19 +00:00
|
|
|
ephemeral_disk {
|
|
|
|
migrate = true
|
|
|
|
sticky = true
|
|
|
|
}
|
|
|
|
|
2022-03-12 18:07:52 +00:00
|
|
|
service {
|
2022-03-13 17:13:19 +00:00
|
|
|
name = "grafana"
|
2022-03-12 18:07:52 +00:00
|
|
|
port = "web"
|
|
|
|
|
|
|
|
connect {
|
|
|
|
sidecar_service {
|
|
|
|
proxy {
|
|
|
|
local_service_port = 3000
|
|
|
|
|
|
|
|
upstreams {
|
|
|
|
destination_name = "prometheus"
|
|
|
|
local_bind_port = 9090
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sidecar_task {
|
|
|
|
resources {
|
|
|
|
cpu = 50
|
|
|
|
memory = 50
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
check {
|
|
|
|
type = "http"
|
|
|
|
path = "/"
|
|
|
|
port = "web"
|
|
|
|
interval = "10s"
|
|
|
|
timeout = "10s"
|
|
|
|
}
|
|
|
|
|
|
|
|
tags = [
|
|
|
|
"traefik.enable=true",
|
2022-03-15 19:02:55 +00:00
|
|
|
"traefik.http.routers.grafana.entryPoints=websecure",
|
2022-03-12 18:07:52 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
task "grafana" {
|
|
|
|
driver = "docker"
|
|
|
|
|
|
|
|
config {
|
|
|
|
image = "grafana/grafana:7.3.6"
|
|
|
|
ports = ["web"]
|
|
|
|
|
|
|
|
mount {
|
|
|
|
type = "bind"
|
|
|
|
target = "/etc/grafana/grafana.ini"
|
|
|
|
source = "local/config/grafana.ini"
|
|
|
|
}
|
|
|
|
|
|
|
|
mount {
|
|
|
|
type = "bind"
|
|
|
|
target = "/etc/grafana/provisioning"
|
|
|
|
source = "local/config/provisioning"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
env = {
|
|
|
|
"GF_SECURITY_ADMIN_PASSWORD" = "password",
|
|
|
|
"GF_INSTALL_PLUGINS" = "grafana-clock-panel,grafana-piechart-panel,grafana-polystat-panel",
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOF
|
|
|
|
[paths]
|
|
|
|
# Path to where grafana can store temp files, sessions, and the sqlite3 db (if that is used)
|
|
|
|
data = /var/lib/grafana
|
|
|
|
|
|
|
|
# folder that contains provisioning config files that grafana will apply on startup and while running.
|
|
|
|
provisioning = /etc/grafana/provisioning
|
|
|
|
[server]
|
|
|
|
# Protocol (http, https, socket)
|
|
|
|
protocol = http
|
|
|
|
|
|
|
|
http_port = 3000
|
|
|
|
EOF
|
|
|
|
change_mode = "signal"
|
|
|
|
change_signal = "SIGHUP"
|
|
|
|
destination = "local/config/grafana.ini"
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOF
|
|
|
|
---
|
|
|
|
apiVersion: 1
|
|
|
|
|
|
|
|
datasources:
|
|
|
|
- name: Prometheus
|
|
|
|
url: http://${NOMAD_UPSTREAM_ADDR_prometheus}
|
|
|
|
type: prometheus
|
|
|
|
access: proxy
|
|
|
|
isDefault: true
|
|
|
|
version: 1
|
|
|
|
EOF
|
|
|
|
change_mode = "signal"
|
|
|
|
change_signal = "SIGHUP"
|
|
|
|
destination = "local/config/provisioning/datasources/prometheus.yml"
|
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
|
|
|
cpu = 100
|
|
|
|
memory = 200
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|