fix: Nomad simple example (#19629)

This commit is contained in:
Shubham Arawkar
2025-11-07 13:35:14 -07:00
committed by GitHub
parent 6190bdd9c9
commit 17aec119a0
3 changed files with 81 additions and 3 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ To deploy a different version change `variable.version` default value or specify
from command line:
```shell
nomad job run -var="version=2.7.5" job.nomad.hcl
nomad job run -var="version=3.5.7" job.nomad.hcl
```
### Scale Loki
+3 -1
View File
@@ -9,6 +9,8 @@ common:
replication_factor: 1
# Tell Loki which address to advertise
instance_addr: {{ env "NOMAD_IP_grpc" }}
# Add the compactor address
compactor_address: http://loki-backend.service.consul
ring:
# Tell Loki which address to advertise in ring
instance_addr: {{ env "NOMAD_IP_grpc" }}
@@ -35,7 +37,7 @@ schema_config:
period: 24h
storage_config:
boltdb_shipper:
tsdb_shipper:
# Nomad ephemeral disk is used to store index and cache
# it will try to preserve /alloc/data between job updates
active_index_directory: {{ env "NOMAD_ALLOC_DIR" }}/data/index
+77 -1
View File
@@ -1,7 +1,7 @@
variable "version" {
type = string
description = "Loki version"
default = "2.7.5"
default = "3.5.7"
}
job "loki" {
@@ -83,6 +83,82 @@ job "loki" {
}
}
group "backend" {
count = 1
ephemeral_disk {
size = 1000
sticky = true
}
network {
port "http" {}
port "grpc" {}
}
task "backend" {
driver = "docker"
user = "nobody"
config {
image = "grafana/loki:${var.version}"
ports = [
"http",
"grpc",
]
args = [
"-target=backend",
"-config.file=/local/config.yml",
"-config.expand-env=true",
]
}
template {
data = file("config.yml")
destination = "local/config.yml"
}
template {
data = <<-EOH
S3_ACCESS_KEY_ID=<access_key>
S3_SECRET_ACCESS_KEY=<secret_access_key>
EOH
destination = "secrets/s3.env"
env = true
}
service {
name = "loki-backend"
port = "http"
tags = [
"traefik.enable=true",
"traefik.http.routers.loki-backend.entrypoints=https",
"traefik.http.routers.loki-backend.rule=Host(`loki-backend.service.consul`)",
]
check {
name = "Loki backend"
port = "http"
type = "http"
path = "/ready"
interval = "20s"
timeout = "1s"
initial_status = "passing"
}
}
resources {
cpu = 500
memory = 256
}
}
}
group "write" {
count = 2