Skip to content

Commit

Permalink
feat(grafana): working grafana job
Browse files Browse the repository at this point in the history
Signed-off-by: Bruce Becker <[email protected]>
  • Loading branch information
brucellino committed May 29, 2022
1 parent 41f74db commit b179c79
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions grafana.nomad
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ job "dashboard" {
update {
max_parallel = 1
min_healthy_time = "20s"
healthy_deadline = "7m"
progress_deadline = "15m"
healthy_deadline = "20m"
progress_deadline = "30m"
auto_revert = true
auto_promote = true
auto_promote = true
canary = 1
}

Expand All @@ -49,6 +49,7 @@ job "dashboard" {
count = 1
network {
port "mysql_server" {
static = 3306
to = 3306
}
}
Expand All @@ -73,6 +74,7 @@ job "dashboard" {
mode = "fail"
}
task "mysql" {
leader = true
driver = "docker"
config {
image = "arm64v8/mysql:oracle"
Expand All @@ -82,6 +84,7 @@ job "dashboard" {
MYSQL_ROOT_PASSWORD = "password" # pragma: allowlist secret
MYSQL_USER = "mysql"
MYSQL_PASSWORD = "password" # pragma: allowlist secret
MYSQL_DATABASE = "grafana"
}
resources {
cpu = 125
Expand All @@ -95,6 +98,7 @@ job "dashboard" {
count = 1
network {
port "grafana_server" {
to = 3000
static = 3000
}
}
Expand Down Expand Up @@ -144,19 +148,30 @@ job "dashboard" {
command = "${NOMAD_ALLOC_DIR}/grafana-${var.grafana_version}/bin/grafana-server"
args = [
"-homepath=${NOMAD_ALLOC_DIR}/grafana-${var.grafana_version}",
"-config=${NOMAD_ALLOC_DIR}/grafana-${var.grafana_version}/conf/conf.ini"
"--config=${NOMAD_ALLOC_DIR}/grafana-${var.grafana_version}/conf/conf.ini"
]
}

template {
data = <<EOT
[auth.anonymous]
enabled = true
[server]
protocol = http
http_port = ${NOMAD_HOST_PORT_grafana_server}
# cert_file = none
# cert_key = none
[database]
type = mysql
host = "mysql:${NOMAD_HOST_PORT_mysql}"
host = mysql.service.consul:3306
user = root
password = """password"""
ssl_mode = disable
# ca_cert_path = none
# client_key_path = none
# client_cert_path = none
# server_cert_name = none
[paths]
data = ${NOMAD_ALLOC_DIR}/data/
logs = ${NOMAD_ALLOC_DIR}/log/
Expand All @@ -165,6 +180,16 @@ plugins = ${NOMAD_ALLOC_DIR}/plugins
reporting_enabled = false
[snapshots]
external_enabled = false
[security]
admin_user = admin
admin_password = "admin"
disable_gravatar = true
[dashboards]
versions_to_keep = 10
[alerting]
enabled = true
[unified_alerting]
enabled = false
EOT

destination = "${NOMAD_ALLOC_DIR}/grafana-${var.grafana_version}/conf/conf.ini"
Expand Down

0 comments on commit b179c79

Please sign in to comment.