Skip to content

Commit 17aec11

Browse files
authored
fix: Nomad simple example (#19629)
1 parent 6190bdd commit 17aec11

File tree

3 files changed

+81
-3
lines changed

3 files changed

+81
-3
lines changed

production/nomad/loki-simple/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ To deploy a different version change `variable.version` default value or specify
2222
from command line:
2323

2424
```shell
25-
nomad job run -var="version=2.7.5" job.nomad.hcl
25+
nomad job run -var="version=3.5.7" job.nomad.hcl
2626
```
2727

2828
### Scale Loki

production/nomad/loki-simple/config.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ common:
99
replication_factor: 1
1010
# Tell Loki which address to advertise
1111
instance_addr: {{ env "NOMAD_IP_grpc" }}
12+
# Add the compactor address
13+
compactor_address: http://loki-backend.service.consul
1214
ring:
1315
# Tell Loki which address to advertise in ring
1416
instance_addr: {{ env "NOMAD_IP_grpc" }}
@@ -35,7 +37,7 @@ schema_config:
3537
period: 24h
3638

3739
storage_config:
38-
boltdb_shipper:
40+
tsdb_shipper:
3941
# Nomad ephemeral disk is used to store index and cache
4042
# it will try to preserve /alloc/data between job updates
4143
active_index_directory: {{ env "NOMAD_ALLOC_DIR" }}/data/index

production/nomad/loki-simple/job.nomad.hcl

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
variable "version" {
22
type = string
33
description = "Loki version"
4-
default = "2.7.5"
4+
default = "3.5.7"
55
}
66

77
job "loki" {
@@ -83,6 +83,82 @@ job "loki" {
8383
}
8484
}
8585

86+
group "backend" {
87+
count = 1
88+
89+
ephemeral_disk {
90+
size = 1000
91+
sticky = true
92+
}
93+
94+
network {
95+
port "http" {}
96+
port "grpc" {}
97+
}
98+
99+
task "backend" {
100+
driver = "docker"
101+
user = "nobody"
102+
103+
config {
104+
image = "grafana/loki:${var.version}"
105+
106+
ports = [
107+
"http",
108+
"grpc",
109+
]
110+
111+
args = [
112+
"-target=backend",
113+
"-config.file=/local/config.yml",
114+
"-config.expand-env=true",
115+
]
116+
}
117+
118+
template {
119+
data = file("config.yml")
120+
destination = "local/config.yml"
121+
}
122+
123+
template {
124+
data = <<-EOH
125+
S3_ACCESS_KEY_ID=<access_key>
126+
S3_SECRET_ACCESS_KEY=<secret_access_key>
127+
EOH
128+
129+
destination = "secrets/s3.env"
130+
env = true
131+
}
132+
133+
service {
134+
name = "loki-backend"
135+
port = "http"
136+
137+
tags = [
138+
"traefik.enable=true",
139+
"traefik.http.routers.loki-backend.entrypoints=https",
140+
"traefik.http.routers.loki-backend.rule=Host(`loki-backend.service.consul`)",
141+
]
142+
143+
check {
144+
name = "Loki backend"
145+
port = "http"
146+
type = "http"
147+
path = "/ready"
148+
interval = "20s"
149+
timeout = "1s"
150+
151+
initial_status = "passing"
152+
}
153+
}
154+
155+
resources {
156+
cpu = 500
157+
memory = 256
158+
}
159+
}
160+
}
161+
86162
group "write" {
87163
count = 2
88164

0 commit comments

Comments
 (0)