-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from komminarlabs/tk/grafana
Added Grafana OSS pack
- Loading branch information
Showing
13 changed files
with
487 additions
and
88 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# 0.1.0 | ||
|
||
- Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Grafana OSS | ||
|
||
This pack uses Docker driver to deploy Grafana OSS in Nomad. | ||
|
||
## Variables | ||
|
||
- `datacenters` (list of string) - A list of datacenters in the region which are eligible for task placement. | ||
- `docker_env_vars` (map of string) - Environment variables to pass to Docker container. | ||
- `grafana_task_config_datasources` (string) - The yaml configuration for automatic provision of datasources. | ||
- `grafana_task_config_ini` (string) - ini string for grafana.ini. | ||
- `grafana_task_resources` (object) - The resource to assign to the Grafana service task. | ||
- `region` (string) - The region where the job should be placed. | ||
- `constraints` (list of object) - Constraints to apply to the entire job. | ||
- `consul_service` (object) - The consul service for grafana. | ||
- `data_volume` (object) - The dedicated data volume you want InfluxDB to use. | ||
- `grafana_task_artifacts` (list of object) - Define external artifacts for Grafana. | ||
- `grafana_task_config_dashboards` (string) - The yaml configuration for automatic provision of dashboards. | ||
- `grafana_version_tag` (string) - The docker image version. For options, see https://hub.docker.com/grafana/grafana. | ||
- `grafana_task_config_plugins` (string) - The yaml configuration for automatic provision of plugins. | ||
- `namespace` (string) - The namespace where the job should be placed. | ||
- `node_pool` (string) - The node_pool where the job should be placed. | ||
- `vault_policies` (list of string) - List of Vault Policies. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
app { | ||
url = "https://grafana.com/" | ||
author = "Grafana Labs" | ||
} | ||
|
||
pack { | ||
name = "grafana" | ||
description = "Dashboard anything. Observe everything." | ||
url = "https://github.com/komminarlabs/nomad-pack-registry/grafana" | ||
version = "0.1.0" | ||
} | ||
|
||
integration { | ||
identifier = "nomad/komminarlabs/grafana" | ||
name = "Grafana OSS" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Congrats on deploying [[ meta "pack.name" . ]]. | ||
|
||
There are [[ var "app_count" . ]] instances of your job now running on Nomad. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
data_volume = { | ||
name = "grafana_data_volume" | ||
type = "host" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,184 @@ | ||
job "grafana" { | ||
region = "[[ var "region" . ]]" | ||
datacenters = [[ (var "datacenters" .) | toStringList ]] | ||
node_pool = "[[ var "node_pool" . ]]" | ||
type = "service" | ||
[[- if var "namespace" . ]] | ||
namespace = "[[ var "namespace" . ]]" | ||
[[- end ]] | ||
[[- if var "constraints" . ]][[ range $idx, $constraint := var "constraints" . ]] | ||
constraint { | ||
[[- if ne $constraint.attribute "" ]] | ||
attribute = "[[ $constraint.attribute ]]" | ||
[[- end ]] | ||
[[- if ne $constraint.value "" ]] | ||
value = "[[ $constraint.value ]]" | ||
[[- end ]] | ||
[[- if ne $constraint.operator "" ]] | ||
operator = "[[ $constraint.operator ]]" | ||
[[- end ]] | ||
} | ||
[[- end ]] | ||
[[- end ]] | ||
|
||
group "grafana" { | ||
count = 1 | ||
network { | ||
port "http" { | ||
static = 3000 | ||
} | ||
} | ||
|
||
[[- if var "consul_service.register" . ]] | ||
|
||
service { | ||
name = "[[ var "consul_service.name" . ]]" | ||
[[- if ne (len (var "consul_service.tags" .)) 0 ]] | ||
tags = [[ (var "consul_service.tags" .) | toStringList ]] | ||
[[- end ]] | ||
port = "http" | ||
check { | ||
name = "alive" | ||
type = "http" | ||
path = "/health" | ||
interval = "10s" | ||
timeout = "2s" | ||
} | ||
} | ||
[[- end ]] | ||
|
||
[[- if var "vault_policies" . ]] | ||
|
||
vault { | ||
policies = [[ (var "vault_policies" .) | toStringList ]] | ||
change_mode = "noop" | ||
} | ||
[[- end ]] | ||
|
||
[[- if var "data_volume" . ]] | ||
volume "[[ var "data_volume.name" . ]]" { | ||
type = "[[ var "data_volume.type" . ]]" | ||
read_only = false | ||
source = "[[ var "data_volume.name" . ]]" | ||
} | ||
[[- end ]] | ||
|
||
[[- if var "data_volume" . ]] | ||
|
||
task "chown_data_volume" { | ||
driver = "docker" | ||
lifecycle { | ||
hook = "prestart" | ||
sidecar = false | ||
} | ||
|
||
volume_mount { | ||
volume = "[[ var "data_volume.name" . ]]" | ||
destination = "/var/lib/grafana" | ||
read_only = false | ||
} | ||
|
||
config { | ||
image = "busybox:stable" | ||
command = "sh" | ||
args = ["-c", "chown -R 1000:1000 /var/lib/grafana"] | ||
} | ||
|
||
resources { | ||
cpu = 200 | ||
memory = 128 | ||
} | ||
} | ||
[[- end ]] | ||
|
||
task "grafana" { | ||
driver = "docker" | ||
[[- if var "data_volume" . ]] | ||
volume_mount { | ||
volume = "[[ var "data_volume.name" . ]]" | ||
destination = "/var/lib/grafana" | ||
read_only = false | ||
} | ||
[[- end ]] | ||
|
||
config { | ||
image = "grafana/grafana:[[ var "grafana_version_tag" . ]]" | ||
ports = ["http"] | ||
} | ||
|
||
resources { | ||
cpu = [[ var "grafana_task_resources.cpu" . ]] | ||
memory = [[ var "grafana_task_resources.memory" . ]] | ||
} | ||
|
||
[[- if ne (len (var "docker_env_vars" .)) 0 ]] | ||
|
||
env { | ||
[[- range $key, $var := var "docker_env_vars" . ]] | ||
[[if ne (len $var) 0 ]][[ $key | upper ]] = [[ $var | quote ]][[ end ]] | ||
[[- end ]] | ||
} | ||
[[- end ]] | ||
|
||
[[- if var "grafana_task_artifacts" . ]] | ||
[[- range $artifact := var "grafana_task_artifacts" . ]] | ||
|
||
artifact { | ||
source = "[[ $artifact.source ]]" | ||
destination = "[[ $artifact.destination ]]" | ||
mode = "[[ $artifact.mode ]]" | ||
[[- if $artifact.options ]] | ||
options { | ||
[[- range $option, $val := $artifact.options ]] | ||
[[ $option ]] = "[[ $val ]]" | ||
[[- end ]] | ||
} | ||
[[- end ]] | ||
} | ||
[[- end ]] | ||
[[- end ]] | ||
|
||
template { | ||
data = <<EOF | ||
[[ var "grafana_task_config_ini" . ]] | ||
EOF | ||
destination = "/local/grafana/grafana.ini" | ||
} | ||
|
||
[[- if var "grafana_task_config_dashboards" . ]] | ||
template { | ||
data = <<EOF | ||
[[ var "grafana_task_config_dashboards" . ]] | ||
EOF | ||
destination = "/local/grafana/provisioning/dashboards/dashboards.yaml" | ||
} | ||
[[ end ]] | ||
|
||
[[- if var "grafana_task_config_datasources" . ]] | ||
template { | ||
data = <<EOF | ||
[[ var "grafana_task_config_datasources" . ]] | ||
EOF | ||
destination = "/local/grafana/provisioning/datasources/datasources.yaml" | ||
} | ||
[[ end ]] | ||
|
||
[[- if var "grafana_task_config_plugins" . ]] | ||
|
||
template { | ||
data = <<EOF | ||
[[ var "grafana_task_config_plugins" . ]] | ||
EOF | ||
destination = "/local/grafana/provisioning/plugins/plugins.yml" | ||
} | ||
[[- end -]] | ||
} | ||
} | ||
} |
Oops, something went wrong.