From 88ddfea4d5a49863e98ceb7c73a8a581bb50970e Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Fri, 2 Dec 2022 00:14:31 +0100 Subject: staging: run grafana from nixpkgs --- cluster/staging/app/telemetry/deploy/telemetry.hcl | 58 +++++++++++----------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'cluster') diff --git a/cluster/staging/app/telemetry/deploy/telemetry.hcl b/cluster/staging/app/telemetry/deploy/telemetry.hcl index f4f4013..da0a3c6 100644 --- a/cluster/staging/app/telemetry/deploy/telemetry.hcl +++ b/cluster/staging/app/telemetry/deploy/telemetry.hcl @@ -91,22 +91,21 @@ job "telemetry" { sidecar = false } - driver = "docker" + driver = "nix2" config { - image = "litestream/litestream:0.3.7" + packages = [ "#litestream" ] + command = "litestream" args = [ "restore", "-config", "/etc/litestream.yml", "/ephemeral/grafana.db" ] - volumes = [ - "../alloc/data:/ephemeral", - "secrets/litestream.yml:/etc/litestream.yml" - ] + bind = { + "../alloc/data" = "/ephemeral", + } } - user = "472" template { data = file("../config/grafana-litestream.yml") - destination = "secrets/litestream.yml" + destination = "etc/litestream.yml" } resources { @@ -117,20 +116,25 @@ job "telemetry" { } task "grafana" { - driver = "docker" + driver = "nix2" config { - image = "grafana/grafana:9.2.3" - network_mode = "host" - ports = [ "grafana" ] - volumes = [ - "../alloc/data:/var/lib/grafana", - "secrets/prometheus.yaml:/etc/grafana/provisioning/datasources/prometheus.yaml" + nixpkgs = "github:nixos/nixpkgs/nixos-22.11" + packages = [ "#grafana" ] + command = "grafana-server" + args = [ + "-homepath", "/share/grafana", + "cfg:default.paths.data=/grafana", + "cfg:default.paths.provisioning=/grafana-provisioning" ] + + bind = { + "../alloc/data" = "/grafana", + } } template { data = file("../config/grafana-datasource-prometheus.yaml") - destination = "secrets/prometheus.yaml" + destination = "grafana-provisioning/datasources/prometheus.yaml" } template { @@ -148,17 +152,14 @@ job "telemetry" { } service { + name = "grafana" tags = [ "grafana", "tricot grafana.staging.deuxfleurs.org", ] - port = 3719 - address_mode = "driver" - name = "grafana" + port = "grafana" check { type = "tcp" - port = 3719 - address_mode = "driver" interval = "60s" timeout = "5s" check_restart { @@ -171,22 +172,21 @@ job "telemetry" { } task "replicate-db" { - driver = "docker" + driver = "nix2" config { - image = "litestream/litestream:0.3.7" + packages = [ "#litestream" ] + command = "litestream" args = [ "replicate", "-config", "/etc/litestream.yml" ] - volumes = [ - "../alloc/data:/ephemeral", - "secrets/litestream.yml:/etc/litestream.yml" - ] + bind = { + "../alloc/data" = "/ephemeral", + } } - user = "472" template { data = file("../config/grafana-litestream.yml") - destination = "secrets/litestream.yml" + destination = "etc/litestream.yml" } resources { -- cgit v1.2.3