Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion production/nomad/loki-simple/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion production/nomad/loki-simple/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }}
Expand All @@ -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
Expand Down
78 changes: 77 additions & 1 deletion production/nomad/loki-simple/job.nomad.hcl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
variable "version" {
type = string
description = "Loki version"
default = "2.7.5"
default = "3.5.7"
}

job "loki" {
Expand Down Expand Up @@ -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

Expand Down
Loading