2022-02-17 14:06:09 +00:00
|
|
|
job "telemetry" {
|
|
|
|
datacenters = ["neptune"]
|
|
|
|
type = "service"
|
|
|
|
|
2022-02-26 19:31:57 +00:00
|
|
|
group "kibana" {
|
|
|
|
count = 1
|
2022-02-17 14:06:09 +00:00
|
|
|
|
|
|
|
network {
|
|
|
|
port "kibana" {
|
|
|
|
static = 5601
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task "kibana" {
|
|
|
|
driver = "docker"
|
|
|
|
config {
|
|
|
|
image = "docker.elastic.co/kibana/kibana:7.17.0"
|
|
|
|
network_mode = "host"
|
|
|
|
ports = [ "kibana" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOH
|
|
|
|
SERVER_NAME=kibana.local
|
|
|
|
ELASTICSEARCH_HOSTS=http://localhost:9200
|
2022-02-26 17:56:16 +00:00
|
|
|
ELASTICSEARCH_USERNAME=kibana_system
|
|
|
|
ELASTICSEARCH_PASSWORD={{ key "secrets/telemetry/elastic_passwords/kibana_system" }}
|
2022-02-17 14:06:09 +00:00
|
|
|
EOH
|
|
|
|
destination = "secrets/env"
|
|
|
|
env = true
|
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
2022-02-26 20:31:58 +00:00
|
|
|
memory = 1000
|
2022-02-17 14:06:09 +00:00
|
|
|
cpu = 500
|
|
|
|
}
|
|
|
|
|
2022-02-26 19:31:57 +00:00
|
|
|
service {
|
|
|
|
tags = [
|
|
|
|
"kibana",
|
|
|
|
"tricot kibana.home.adnab.me",
|
2022-02-17 14:06:09 +00:00
|
|
|
]
|
2022-02-26 19:31:57 +00:00
|
|
|
port = 5601
|
|
|
|
address_mode = "driver"
|
|
|
|
name = "kibana"
|
|
|
|
check {
|
|
|
|
type = "tcp"
|
|
|
|
port = 5601
|
|
|
|
address_mode = "driver"
|
|
|
|
interval = "60s"
|
|
|
|
timeout = "5s"
|
|
|
|
check_restart {
|
|
|
|
limit = 3
|
|
|
|
grace = "90s"
|
|
|
|
ignore_warnings = false
|
|
|
|
}
|
|
|
|
}
|
2022-02-17 14:06:09 +00:00
|
|
|
}
|
2022-02-26 19:31:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
group "grafana" {
|
|
|
|
count = 1
|
2022-02-17 14:06:09 +00:00
|
|
|
|
2022-02-26 19:31:57 +00:00
|
|
|
network {
|
|
|
|
port "grafana" {
|
|
|
|
static = 3333
|
2022-02-17 14:06:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-26 20:31:58 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-17 14:06:09 +00:00
|
|
|
task "grafana" {
|
|
|
|
driver = "docker"
|
|
|
|
config {
|
|
|
|
image = "grafana/grafana:8.3.5"
|
|
|
|
network_mode = "host"
|
|
|
|
ports = [ "grafana" ]
|
|
|
|
volumes = [
|
2022-02-26 20:31:58 +00:00
|
|
|
"../alloc/data:/var/lib/grafana",
|
2022-02-17 14:06:09 +00:00
|
|
|
"secrets/elastic.yaml:/etc/grafana/provisioning/datasources/elastic.yaml"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = file("../config/grafana/provisioning/datasources/elastic.yaml")
|
|
|
|
destination = "secrets/elastic.yaml"
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOH
|
|
|
|
GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource,grafana-piechart-panel,grafana-worldmap-panel,grafana-polystat-panel
|
|
|
|
GF_SERVER_HTTP_PORT=3333
|
|
|
|
EOH
|
|
|
|
destination = "secrets/env"
|
|
|
|
env = true
|
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
|
|
|
memory = 500
|
|
|
|
cpu = 100
|
|
|
|
}
|
2022-02-26 20:31:58 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-02-17 14:06:09 +00:00
|
|
|
}
|
|
|
|
|
2022-02-26 20:31:58 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
2022-02-17 14:06:09 +00:00
|
|
|
}
|
|
|
|
}
|