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 untrusted user: lx
GPG key ID: 0E496D15096376BE
2 changed files with 19 additions and 23 deletions

View file

@ -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

View file

@ -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 {