129 lines
3.1 KiB
HCL
129 lines
3.1 KiB
HCL
job "grafana" {
|
|
# region = "global"
|
|
datacenters = ["dc1"]
|
|
type = "service"
|
|
# priority = 50
|
|
constraint {
|
|
attribute = "${attr.kernel.name}"
|
|
value = "linux"
|
|
}
|
|
constraint {
|
|
attribute = "${attr.unique.hostname}"
|
|
operator = "regexp"
|
|
value = "odroid.*"
|
|
}
|
|
update {
|
|
# Stagger updates every 60 seconds
|
|
stagger = "60s"
|
|
max_parallel = 1
|
|
}
|
|
group "grafana" {
|
|
count = 1
|
|
restart {
|
|
attempts = 2
|
|
interval = "1m"
|
|
delay = "10s"
|
|
mode = "delay"
|
|
}
|
|
task "grafana" {
|
|
driver = "docker"
|
|
config {
|
|
// image = "fg2it/grafana-armhf:v5.1.4"
|
|
image = "grafana/grafana:latest"
|
|
ports = ["http"]
|
|
logging {
|
|
type = "json-file"
|
|
}
|
|
memory_hard_limit = 2048
|
|
}
|
|
env {
|
|
disable_login_form = "EST5EDT"
|
|
PUID = 1000
|
|
PGID = 1000
|
|
GF_PATHS_PROVISIONING = "/local/"
|
|
GF_AUTH_ANONYMOUS_ENABLED = true
|
|
GF_AUTH_ANONYMOUS_ORG_NAME = "Main Org."
|
|
GF_AUTH_ANONYMOUS_ORG_ROLE = "Admin"
|
|
}
|
|
template {
|
|
data = <<EOH
|
|
apiVersion: 1
|
|
datasources:
|
|
- name: Prometheus
|
|
type: prometheus
|
|
url: http://prometheus.service.dc1.consul:9090
|
|
isDefault: true
|
|
- name: Loki
|
|
type: loki
|
|
access: proxy
|
|
url: http://{{ range service "loki" }}{{ .Address }}:{{ .Port }}{{ end }}
|
|
isDefault: false
|
|
editable: true
|
|
jsonData:
|
|
maxLines: 1000
|
|
EOH
|
|
destination = "local/datasources/prometheus.yaml"
|
|
}
|
|
template {
|
|
data = <<EOH
|
|
apiVersion: 1
|
|
providers:
|
|
- name: dashboards
|
|
type: file
|
|
updateIntervalSeconds: 30
|
|
options:
|
|
path: /local/dashboard_definitons
|
|
foldersFromFilesStructure: true
|
|
EOH
|
|
destination = "local/dashboards/dashboards.yaml"
|
|
}
|
|
template {
|
|
data = "{{ key \"grafana_dashboards/nomad\" }}"
|
|
destination = "local/dashboard_definitons/nomad.json"
|
|
}
|
|
template {
|
|
data = "{{ key \"grafana_dashboards/thermals\" }}"
|
|
destination = "local/dashboard_definitons/thermals.json"
|
|
}
|
|
template {
|
|
data = "{{ key \"grafana_dashboards/NomadMem\" }}"
|
|
destination = "local/dashboard_definitons/NomadMem.json"
|
|
}
|
|
service {
|
|
name = "${TASKGROUP}"
|
|
tags = ["global", "backend"]
|
|
port = "http"
|
|
check {
|
|
name = "alive"
|
|
type = "http"
|
|
interval = "60s"
|
|
timeout = "120s"
|
|
path = "/login"
|
|
port = "http"
|
|
check_restart {
|
|
limit = 3
|
|
grace = "120s"
|
|
ignore_warnings = false
|
|
}
|
|
}
|
|
}
|
|
resources {
|
|
cpu = 128 # 500 MHz
|
|
memory = 64 # 128MB
|
|
}
|
|
# Specify configuration related to log rotation
|
|
logs {
|
|
max_files = 10
|
|
max_file_size = 15
|
|
}
|
|
kill_timeout = "10s"
|
|
}
|
|
network {
|
|
port "http" {
|
|
static = 3100
|
|
to = 3000
|
|
}
|
|
}
|
|
}
|
|
}
|