job "grafana" { datacenters = ["dc1"] group "grafana" { count = 1 network { mode = "bridge" port "web" { host_network = "wesher" to = 3000 } # TODO: Not sure if this needs to be mapped here since it's within the group port "renderer" { host_network = "loopback" to = 8081 } } ephemeral_disk { migrate = true sticky = true } service { name = "grafana" provider = "nomad" port = "web" tags = [ "traefik.enable=true", "traefik.http.routers.grafana.entryPoints=websecure", ] } task "grafana-bootstrap" { driver = "docker" lifecycle { hook = "prestart" sidecar = false } config { image = "mariadb:10" args = [ "/bin/bash", "-c", "/usr/bin/mysql --defaults-extra-file=$${NOMAD_SECRETS_DIR}/my.cnf < $${NOMAD_SECRETS_DIR}/bootstrap.sql", ] } vault { policies = [ "access-tables", "nomad-task", ] } template { data = < 0 ~} left_delimiter = "<<<<" right_delimiter = ">>>>" %{ endif } } %{ endfor } resources { cpu = 100 memory = 200 } } task "grafana-image-renderer" { driver = "docker" config { image = "grafana/grafana-image-renderer:3.6.1" ports = ["renderer"] } env = { "RENDERING_MODE" = "clustered" "RENDERING_CLUSTERING_MODE" = "browser" "RENDERING_CLUSTERING_MAX_CONCURRENCY" = 5 "RENDERING_CLUSTERING_TIMEOUT" = 30 } } } }