From 13a0675babe3605d9b52166eb61f762fc9faddac Mon Sep 17 00:00:00 2001 From: wizzdom Date: Wed, 26 Feb 2025 04:20:49 +0000 Subject: [PATCH] monitoring: add grafana --- jobs/monitoring/grafana.hcl | 95 +++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 jobs/monitoring/grafana.hcl diff --git a/jobs/monitoring/grafana.hcl b/jobs/monitoring/grafana.hcl new file mode 100644 index 0000000..2d76bc1 --- /dev/null +++ b/jobs/monitoring/grafana.hcl @@ -0,0 +1,95 @@ +job "grafana" { + datacenters = ["aperture"] + + type = "service" + + group "monitoring" { + network { + port "http" { + to = 3000 + } + port "db" { + to = 5432 + } + } + + service { + name = "grafana" + port = "http" + + check { + type = "http" + path = "/" + interval = "10s" + timeout = "2s" + } + + tags = [ + "traefik.enable=true", + "traefik.http.routers.grafana.entrypoints=web,websecure", + "traefik.http.routers.grafana.rule=Host(`grafana.redbrick.dcu.ie`)", + "traefik.http.routers.grafana.tls=true", + "traefik.http.routers.grafana.tls.certresolver=lets-encrypt", + ] + } + + task "grafana" { + driver = "docker" + user = "1001:1001" + + env { + GF_AUTH_BASIC_ENABLED = "true" + GF_INSTALL_PLUGINS = "grafana-piechart-panel" + GF_SERVER_ROOT_URL = "https://grafana.redbrick.dcu.ie" + } + + config { + image = "grafana/grafana" + ports = ["http"] + + volumes = [ + "/storage/nomad/${NOMAD_JOB_NAME}/${NOMAD_TASK_NAME}:/var/lib/grafana" + ] + } + + + template { + data = <