Skip to content

Instantly share code, notes, and snippets.

@lanefu
Created January 6, 2021 15:09
Show Gist options
  • Save lanefu/6310016ec8fee0613bf8c75400948f71 to your computer and use it in GitHub Desktop.
Save lanefu/6310016ec8fee0613bf8c75400948f71 to your computer and use it in GitHub Desktop.
grafana nomad example
job "grafana" {
datacenters = ["example_datacenter"]
type = "service"
constraint {
attribute = "${attr.kernel.name}"
value = "linux"
}
constraint {
attribute = "${attr.cpu.arch}"
# regexp = "arm"
}
constraint {
attribute = "${meta.group_names}"
operator = "regexp"
value = "hashi_client"
}
update {
max_parallel = 1
min_healthy_time = "10s"
healthy_deadline = "8m"
auto_revert = false
canary = 0
}
reschedule {
delay = "30s"
delay_function = "exponential"
max_delay = "10m"
unlimited = true
}
group "grafana" {
count = 1
restart {
attempts = 10
interval = "5m"
delay = "25s"
mode = "delay"
}
task "grafana" {
driver = "docker"
config {
image = "grafana/grafana:master"
force_pull = false
port_map {
grafana_http = 3000
}
volumes = [
"/mnt/docker_app_data/grafana/varlib:/var/lib/grafana",
"/mnt/docker_app_data/grafana/conf:/etc/grafana"
]
}
resources {
cpu = 1200 # 500 MHz
memory = 300 # 256MB
network {
mbits = 50
port "grafana_http" {}
}
}
service {
name = "grafana"
tags = ["urlprefix-www.example.com/grafana cs=consul-kv-ssl"]
port = "grafana_http"
check {
name = "alive"
path = "/api/health"
type = "http"
interval = "10s"
timeout = "2s"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment