staging: run grafana from nixpkgs

This commit is contained in:
Alex 2022-12-02 00:14:31 +01:00
parent 2482a2f819
commit 88ddfea4d5
Signed by: lx
GPG key ID: 0E496D15096376BE

View file

@ -91,22 +91,21 @@ job "telemetry" {
sidecar = false sidecar = false
} }
driver = "docker" driver = "nix2"
config { config {
image = "litestream/litestream:0.3.7" packages = [ "#litestream" ]
command = "litestream"
args = [ args = [
"restore", "-config", "/etc/litestream.yml", "/ephemeral/grafana.db" "restore", "-config", "/etc/litestream.yml", "/ephemeral/grafana.db"
] ]
volumes = [ bind = {
"../alloc/data:/ephemeral", "../alloc/data" = "/ephemeral",
"secrets/litestream.yml:/etc/litestream.yml" }
]
} }
user = "472"
template { template {
data = file("../config/grafana-litestream.yml") data = file("../config/grafana-litestream.yml")
destination = "secrets/litestream.yml" destination = "etc/litestream.yml"
} }
resources { resources {
@ -117,20 +116,25 @@ job "telemetry" {
} }
task "grafana" { task "grafana" {
driver = "docker" driver = "nix2"
config { config {
image = "grafana/grafana:9.2.3" nixpkgs = "github:nixos/nixpkgs/nixos-22.11"
network_mode = "host" packages = [ "#grafana" ]
ports = [ "grafana" ] command = "grafana-server"
volumes = [ args = [
"../alloc/data:/var/lib/grafana", "-homepath", "/share/grafana",
"secrets/prometheus.yaml:/etc/grafana/provisioning/datasources/prometheus.yaml" "cfg:default.paths.data=/grafana",
"cfg:default.paths.provisioning=/grafana-provisioning"
] ]
bind = {
"../alloc/data" = "/grafana",
}
} }
template { template {
data = file("../config/grafana-datasource-prometheus.yaml") data = file("../config/grafana-datasource-prometheus.yaml")
destination = "secrets/prometheus.yaml" destination = "grafana-provisioning/datasources/prometheus.yaml"
} }
template { template {
@ -148,17 +152,14 @@ job "telemetry" {
} }
service { service {
name = "grafana"
tags = [ tags = [
"grafana", "grafana",
"tricot grafana.staging.deuxfleurs.org", "tricot grafana.staging.deuxfleurs.org",
] ]
port = 3719 port = "grafana"
address_mode = "driver"
name = "grafana"
check { check {
type = "tcp" type = "tcp"
port = 3719
address_mode = "driver"
interval = "60s" interval = "60s"
timeout = "5s" timeout = "5s"
check_restart { check_restart {
@ -171,22 +172,21 @@ job "telemetry" {
} }
task "replicate-db" { task "replicate-db" {
driver = "docker" driver = "nix2"
config { config {
image = "litestream/litestream:0.3.7" packages = [ "#litestream" ]
command = "litestream"
args = [ args = [
"replicate", "-config", "/etc/litestream.yml" "replicate", "-config", "/etc/litestream.yml"
] ]
volumes = [ bind = {
"../alloc/data:/ephemeral", "../alloc/data" = "/ephemeral",
"secrets/litestream.yml:/etc/litestream.yml" }
]
} }
user = "472"
template { template {
data = file("../config/grafana-litestream.yml") data = file("../config/grafana-litestream.yml")
destination = "secrets/litestream.yml" destination = "etc/litestream.yml"
} }
resources { resources {