Skip to content

Instantly share code, notes, and snippets.

@lanefu
Created January 6, 2021 15:09

Revisions

  1. lanefu created this gist Jan 6, 2021.
    98 changes: 98 additions & 0 deletions graphana.hcl
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,98 @@

    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"
    }
    }




    }
    }
    }