From 0e7a34a341110536ee912afdcaf2e79af2928b58 Mon Sep 17 00:00:00 2001 From: Petru Paler Date: Fri, 21 Jul 2023 06:31:05 +0100 Subject: [PATCH] Loki service configuration. --- hosts/common/nomad.nix | 1 + services/loki.hcl | 118 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 services/loki.hcl diff --git a/hosts/common/nomad.nix b/hosts/common/nomad.nix index 8cfd5f9..b619f0c 100644 --- a/hosts/common/nomad.nix +++ b/hosts/common/nomad.nix @@ -45,6 +45,7 @@ in allow_privileged = true; # for keepalived, though only really needing "NET_ADMIN","NET_BROADCAST","NET_RAW" on top of default allow_caps = ["all"]; + volumes.enabled = true; }; }; diff --git a/services/loki.hcl b/services/loki.hcl new file mode 100644 index 0000000..3eac82f --- /dev/null +++ b/services/loki.hcl @@ -0,0 +1,118 @@ +job "loki" { + datacenters = ["alo"] + type = "service" + update { + max_parallel = 1 + health_check = "checks" + min_healthy_time = "10s" + healthy_deadline = "3m" + progress_deadline = "5m" + } + group "loki" { + count = 1 + restart { + attempts = 3 + interval = "5m" + delay = "25s" + mode = "delay" + } + network { + port "loki" { + # static so that it can be hardcoded in the grafana data source + static = 3100 + } + } + task "loki" { + driver = "docker" + config { + image = "grafana/loki:2.8.2" + args = [ + "-config.file", + "local/loki/local-config.yaml", + ] + ports = ["loki"] + volumes = ["/data/compute/appdata/loki:/loki"] + } + template { + data = <