staging: run prometheus from nixpkgs

This commit is contained in:
Alex 2022-12-01 23:48:46 +01:00
parent b0405d47a6
commit 2482a2f819
Signed by: lx
GPG key ID: 0E496D15096376BE
2 changed files with 19 additions and 23 deletions

View file

@ -12,9 +12,9 @@ scrape_configs:
services: services:
- 'node-exporter' - 'node-exporter'
tls_config: tls_config:
ca_file: /etc/prometheus/consul.crt ca_file: /etc/prom/consul.crt
cert_file: /etc/prometheus/consul-client.crt cert_file: /etc/prom/consul-client.crt
key_file: /etc/prometheus/consul-client.key key_file: /etc/prom/consul-client.key
- job_name: 'garage' - job_name: 'garage'
authorization: authorization:
@ -25,6 +25,6 @@ scrape_configs:
services: services:
- 'garage-staging-admin' - 'garage-staging-admin'
tls_config: tls_config:
ca_file: /etc/prometheus/consul.crt ca_file: /etc/prom/consul.crt
cert_file: /etc/prometheus/consul-client.crt cert_file: /etc/prom/consul-client.crt
key_file: /etc/prometheus/consul-client.key key_file: /etc/prom/consul-client.key

View file

@ -18,40 +18,39 @@ job "telemetry" {
} }
task "prometheus" { task "prometheus" {
driver = "docker" driver = "nix2"
config { config {
image = "prom/prometheus:v2.39.0" nixpkgs = "github:nixos/nixpkgs/nixos-22.11"
network_mode = "host" packages = [ "#prometheus", "#coreutils", "#findutils", "#bash" ]
ports = [ "prometheus" ] command = "prometheus"
args = [ args = [
"--config.file=/etc/prometheus/prometheus.yml", "--config.file=/etc/prom/prometheus.yml",
"--storage.tsdb.path=/data", "--storage.tsdb.path=/data",
"--storage.tsdb.retention.size=5GB", "--storage.tsdb.retention.size=5GB",
] ]
volumes = [ bind = {
"secrets:/etc/prometheus", "/mnt/ssd/prometheus" = "/data"
"/mnt/ssd/prometheus:/data" }
]
} }
template { template {
data = file("../config/prometheus.yml") data = file("../config/prometheus.yml")
destination = "secrets/prometheus.yml" destination = "etc/prom/prometheus.yml"
} }
template { template {
data = "{{ key \"secrets/consul/consul.crt\" }}" data = "{{ key \"secrets/consul/consul.crt\" }}"
destination = "secrets/consul.crt" destination = "etc/prom/consul.crt"
} }
template { template {
data = "{{ key \"secrets/consul/consul-client.crt\" }}" data = "{{ key \"secrets/consul/consul-client.crt\" }}"
destination = "secrets/consul-client.crt" destination = "etc/prom/consul-client.crt"
} }
template { template {
data = "{{ key \"secrets/consul/consul-client.key\" }}" data = "{{ key \"secrets/consul/consul-client.key\" }}"
destination = "secrets/consul-client.key" destination = "etc/prom/consul-client.key"
} }
resources { resources {
@ -60,14 +59,11 @@ job "telemetry" {
} }
service { service {
port = 9090 port = "prometheus"
address_mode = "driver"
name = "prometheus" name = "prometheus"
check { check {
type = "http" type = "http"
path = "/" path = "/"
port = 9090
address_mode = "driver"
interval = "60s" interval = "60s"
timeout = "5s" timeout = "5s"
check_restart { check_restart {