Skip to content

Instantly share code, notes, and snippets.

@ddreier
Created March 24, 2022 01:59
Show Gist options
  • Save ddreier/3d9c93a555aa36058ae1cf907b98ca51 to your computer and use it in GitHub Desktop.
Save ddreier/3d9c93a555aa36058ae1cf907b98ca51 to your computer and use it in GitHub Desktop.
Sample Nomad Job for running Grafana Loki
variable "nomad_datacenter" {
type = string
}
variable "loki_bucket_name" {
type = string
}
job "ddreier-loki-testing" {
datacenters = [var.nomad_datacenter]
group "loki" {
count = 3
constraint {
attribute = "${attr.kernel.name}"
value = "linux"
}
network {
port "loki_http_server" {
static = 3100
}
port "loki_grpc_server" {
static = 9095
}
port "loki_memberlist" {
static = 7946
}
}
task "loki" {
driver = "docker"
config {
image = "grafana/loki:2.4.2"
args = [
"-target=all",
"-config.file=/local/loki-config.yml",
"-print-config-stderr",
]
ports = [
"loki_http_server",
"loki_grpc_server",
"loki_memberlist",
]
}
resources {
cpu = 500
memory = 500
}
service {
name = "ddreier-loki-testing"
port = "loki_memberlist"
tags = ["memberlist"]
}
template {
destination = "local/loki-config.yml"
data = <<EOF
auth_enabled: false
common:
replication_factor: 1
ring:
instance_addr: {{ env "NOMAD_IP_loki_memberlist" }}
kvstore:
store: memberlist
server:
http_listen_address: 0.0.0.0
grpc_listen_address: 0.0.0.0
http_listen_port: 3100
grpc_listen_port: 9095
log_level: info
memberlist:
join_members: ["ddreier-loki-testing.service.consul:7946"]
ingester:
wal:
enabled: true
dir: /local/loki/wal
schema_config:
configs:
- from: 2020-05-15
store: boltdb-shipper
object_store: filesystem
schema: v11
index:
prefix: index_
period: 24h
storage_config:
boltdb_shipper:
shared_store: filesystem
active_index_directory: /local/loki/index
cache_location: /local/loki/boltdb-cache
filesystem:
directory: /local/loki/chunks
compactor:
working_directory: /local/loki/compactor
shared_store: filesystem
EOF
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment