diff options
Diffstat (limited to 'app/telemetry/deploy/telemetry.hcl')
-rw-r--r-- | app/telemetry/deploy/telemetry.hcl | 86 |
1 files changed, 78 insertions, 8 deletions
diff --git a/app/telemetry/deploy/telemetry.hcl b/app/telemetry/deploy/telemetry.hcl index c3edd4c..b394699 100644 --- a/app/telemetry/deploy/telemetry.hcl +++ b/app/telemetry/deploy/telemetry.hcl @@ -31,7 +31,7 @@ EOH } resources { - memory = 1500 + memory = 1000 cpu = 500 } @@ -62,18 +62,42 @@ EOH group "grafana" { count = 1 - constraint { - attribute = "${attr.unique.hostname}" - operator = "=" - value = "carcajou" - } - network { port "grafana" { static = 3333 } } + task "restore-db" { + lifecycle { + hook = "prestart" + sidecar = false + } + + driver = "docker" + config { + image = "litestream/litestream:0.3.7" + args = [ + "restore", "-config", "/etc/litestream.yml", "/ephemeral/grafana.db" + ] + volumes = [ + "../alloc/data:/ephemeral", + "secrets/litestream.yml:/etc/litestream.yml" + ] + } + user = "472" + + template { + data = file("../config/grafana-litestream.yml") + destination = "secrets/litestream.yml" + } + + resources { + memory = 200 + cpu = 1000 + } + } + task "grafana" { driver = "docker" config { @@ -81,7 +105,7 @@ EOH network_mode = "host" ports = [ "grafana" ] volumes = [ - "/mnt/ssd/telemetry/grafana:/var/lib/grafana", + "../alloc/data:/var/lib/grafana", "secrets/elastic.yaml:/etc/grafana/provisioning/datasources/elastic.yaml" ] } @@ -104,7 +128,53 @@ EOH memory = 500 cpu = 100 } + + service { + tags = [ + "grafana", + "tricot grafana.home.adnab.me", + ] + port = 3333 + address_mode = "driver" + name = "grafana" + check { + type = "tcp" + port = 3333 + address_mode = "driver" + interval = "60s" + timeout = "5s" + check_restart { + limit = 3 + grace = "90s" + ignore_warnings = false + } + } + } } + task "replicate-db" { + driver = "docker" + config { + image = "litestream/litestream:0.3.7" + args = [ + "replicate", "-config", "/etc/litestream.yml" + ] + volumes = [ + "../alloc/data:/ephemeral", + "secrets/litestream.yml:/etc/litestream.yml" + ] + } + user = "472" + + template { + data = file("../config/grafana-litestream.yml") + destination = "secrets/litestream.yml" + } + + resources { + memory = 200 + cpu = 100 + } + } } } |