Browse Source

feat: Update nomad config, add telemetry

master
Karan Sharma 1 month ago
parent
commit
b02ba8af93
  1. 27
      docs/SETUP.md
  2. 9
      terraform/modules/caddy/conf/Caddyfile-internal
  3. 12
      terraform/modules/cloudflare/records.tf
  4. 15
      terraform/modules/monitoring/conf/prometheus.yml

27
docs/SETUP.md

@ -75,16 +75,35 @@ server {
client {
enabled = true
options = {
"docker.volumes.enabled" = true,
"driver.raw_exec.enable" = "1"
}
host_network "tailscale" {
cidr = "100.119.138.27/32"
reserved_ports = "22"
}
}
plugin "docker" {
config {
volumes {
enabled = true
}
extra_labels = ["job_name", "job_id", "task_group_name", "task_name", "namespace", "node_name", "node_id"]
}
}
plugin "raw_exec" {
config {
enabled = true
}
}
telemetry {
collection_interval = "15s"
disable_hostname = true
prometheus_metrics = true
publish_allocation_metrics = true
publish_node_metrics = true
}
consul {
address = "100.119.138.27:8500"
}

9
terraform/modules/caddy/conf/Caddyfile-internal

@ -38,3 +38,12 @@ grafana.mrkaran.dev {
dns cloudflare "${cloudflare_api_token}"
}
}
prometheus.mrkaran.dev {
{{ range service "prometheus-web" }}
reverse_proxy {{ .Address }}:{{ .Port }}
{{ end }}
tls {
dns cloudflare "${cloudflare_api_token}"
}
}

12
terraform/modules/cloudflare/records.tf

@ -129,6 +129,18 @@ resource "cloudflare_record" "grafana" {
}
resource "cloudflare_record" "prometheus" {
zone_id = cloudflare_zone.mrkaran_dev.id
name = "prometheus"
type = "A"
ttl = "1"
proxied = "false"
value = var.ips["floyd_tailscale"]
}
resource "cloudflare_record" "git" {
zone_id = cloudflare_zone.mrkaran_dev.id

15
terraform/modules/monitoring/conf/prometheus.yml

@ -16,3 +16,18 @@ scrape_configs:
scrape_interval: 60s
static_configs:
- targets: ["100.94.241.54:9283"] # RPi telegraf Agent
- job_name: "nomad_metrics"
consul_sd_configs:
- server: '{{ env "NOMAD_IP_prometheus_http" }}:8500'
services: ['nomad-client', 'nomad']
relabel_configs:
- source_labels: ['__meta_consul_tags']
regex: '(.*)http(.*)'
action: keep
scrape_interval: 5s
metrics_path: /v1/metrics
params:
format: ['prometheus']
Loading…
Cancel
Save