aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-12-01 23:48:46 +0100
committerAlex Auvolat <alex@adnab.me>2022-12-01 23:48:46 +0100
commit2482a2f819012546d08b03e68bc1a6330b825b5b (patch)
treeb07da6e2a0676496ac1934d90f81c2039b4039f0
parentb0405d47a6297d6b59cd293adec3eec4fd784459 (diff)
downloadnixcfg-2482a2f819012546d08b03e68bc1a6330b825b5b.tar.gz
nixcfg-2482a2f819012546d08b03e68bc1a6330b825b5b.zip
staging: run prometheus from nixpkgs
-rw-r--r--cluster/staging/app/telemetry/config/prometheus.yml12
-rw-r--r--cluster/staging/app/telemetry/deploy/telemetry.hcl30
2 files changed, 19 insertions, 23 deletions
diff --git a/cluster/staging/app/telemetry/config/prometheus.yml b/cluster/staging/app/telemetry/config/prometheus.yml
index e0e786d..0203ca4 100644
--- a/cluster/staging/app/telemetry/config/prometheus.yml
+++ b/cluster/staging/app/telemetry/config/prometheus.yml
@@ -12,9 +12,9 @@ scrape_configs:
services:
- 'node-exporter'
tls_config:
- ca_file: /etc/prometheus/consul.crt
- cert_file: /etc/prometheus/consul-client.crt
- key_file: /etc/prometheus/consul-client.key
+ ca_file: /etc/prom/consul.crt
+ cert_file: /etc/prom/consul-client.crt
+ key_file: /etc/prom/consul-client.key
- job_name: 'garage'
authorization:
@@ -25,6 +25,6 @@ scrape_configs:
services:
- 'garage-staging-admin'
tls_config:
- ca_file: /etc/prometheus/consul.crt
- cert_file: /etc/prometheus/consul-client.crt
- key_file: /etc/prometheus/consul-client.key
+ ca_file: /etc/prom/consul.crt
+ cert_file: /etc/prom/consul-client.crt
+ key_file: /etc/prom/consul-client.key
diff --git a/cluster/staging/app/telemetry/deploy/telemetry.hcl b/cluster/staging/app/telemetry/deploy/telemetry.hcl
index 84a15db..f4f4013 100644
--- a/cluster/staging/app/telemetry/deploy/telemetry.hcl
+++ b/cluster/staging/app/telemetry/deploy/telemetry.hcl
@@ -18,40 +18,39 @@ job "telemetry" {
}
task "prometheus" {
- driver = "docker"
+ driver = "nix2"
config {
- image = "prom/prometheus:v2.39.0"
- network_mode = "host"
- ports = [ "prometheus" ]
+ nixpkgs = "github:nixos/nixpkgs/nixos-22.11"
+ packages = [ "#prometheus", "#coreutils", "#findutils", "#bash" ]
+ command = "prometheus"
args = [
- "--config.file=/etc/prometheus/prometheus.yml",
+ "--config.file=/etc/prom/prometheus.yml",
"--storage.tsdb.path=/data",
"--storage.tsdb.retention.size=5GB",
]
- volumes = [
- "secrets:/etc/prometheus",
- "/mnt/ssd/prometheus:/data"
- ]
+ bind = {
+ "/mnt/ssd/prometheus" = "/data"
+ }
}
template {
data = file("../config/prometheus.yml")
- destination = "secrets/prometheus.yml"
+ destination = "etc/prom/prometheus.yml"
}
template {
data = "{{ key \"secrets/consul/consul.crt\" }}"
- destination = "secrets/consul.crt"
+ destination = "etc/prom/consul.crt"
}
template {
data = "{{ key \"secrets/consul/consul-client.crt\" }}"
- destination = "secrets/consul-client.crt"
+ destination = "etc/prom/consul-client.crt"
}
template {
data = "{{ key \"secrets/consul/consul-client.key\" }}"
- destination = "secrets/consul-client.key"
+ destination = "etc/prom/consul-client.key"
}
resources {
@@ -60,14 +59,11 @@ job "telemetry" {
}
service {
- port = 9090
- address_mode = "driver"
+ port = "prometheus"
name = "prometheus"
check {
type = "http"
path = "/"
- port = 9090
- address_mode = "driver"
interval = "60s"
timeout = "5s"
check_restart {