From b6bd53773e792b193f70f235ada6e6edcda4b3f1 Mon Sep 17 00:00:00 2001 From: bcirh <72753984+bcirh@users.noreply.github.com> Date: Thu, 2 Jan 2025 15:25:54 +0100 Subject: [PATCH] Add Tempo Nomad job example in Monolithic Mode (#4495) * Add tempo nomad monolith example * Update README.md --- example/nomad/tempo-monolith/README.md | 35 ++++++ example/nomad/tempo-monolith/tempo.hcl | 146 +++++++++++++++++++++++++ 2 files changed, 181 insertions(+) create mode 100644 example/nomad/tempo-monolith/README.md create mode 100644 example/nomad/tempo-monolith/tempo.hcl diff --git a/example/nomad/tempo-monolith/README.md b/example/nomad/tempo-monolith/README.md new file mode 100644 index 00000000000..a13aafcee89 --- /dev/null +++ b/example/nomad/tempo-monolith/README.md @@ -0,0 +1,35 @@ +# Monolithic mode + +This Nomad job will deploy Tempo in +[monolithic mode](https://grafana.com/docs/tempo/latest/setup/deployment/#monolithic-mode) using S3 backend. + +## Usage + +### Prerequisites +- S3 compatible storage + +Variables +-------------- + +| Name | Value | Description | +|---|---|---| +| version | Default = "2.3.1" | Tempo version | +| s3_url | Default = "s3.dummy.url.com" | S3 storage URL | +| s3_access_key_id | Default = "any" | S3 Access Key ID | +| s3_secret_access_key | Default = "any" | S3 Secret Access Key | +| prometheus_remote_write_url | Default = "http://prometheus.service.consul/api/v1/write" | Prometheus Remote Write URL | + +### Run job + +Inside directory with job run: + +```shell +nomad job run tempo.hcl +``` + +To deploy a different version change `variable.version` default value or +specify from command line: + +```shell +nomad job run -var="version=2.6.1" tempo.hcl +``` diff --git a/example/nomad/tempo-monolith/tempo.hcl b/example/nomad/tempo-monolith/tempo.hcl new file mode 100644 index 00000000000..1c839a94c12 --- /dev/null +++ b/example/nomad/tempo-monolith/tempo.hcl @@ -0,0 +1,146 @@ +variable "version" { + type = string + description = "Tempo version" + default = "2.3.1" +} + +variable "prometheus_remote_write_url" { + type = string + description = "Prometheus Remote Write URL" + default = "http://prometheus.service.consul/api/v1/write" +} + +variable "s3_url" { + type = string + description = "S3 URL" + default = "s3.dummy.url" +} + +variable "s3_access_key_id" { + type = string + description = "S3 Access Key ID" + default = "any" +} + +variable "s3_secret_access_key" { + type = string + description = "S3 Secret Access Key" + default = "any" +} + +job "tempo" { + datacenters = ["*"] + + group "tempo" { + count = 1 + + network { + port "http" { + to = 3200 + } + port "grpc" {} + } + + service { + name = "tempo-http" + port = "http" + tags = [] + check { + name = "tempo-http" + port = "http" + type = "http" + path = "/ready" + interval = "20s" + timeout = "1s" + } + } + + service { + name = "tempo-grpc" + port = "grpc" + tags = [] + check { + port = "grpc" + type = "grpc" + interval = "20s" + timeout = "1s" + grpc_use_tls = false + tls_skip_verify = true + } + } + + task "tempo" { + driver = "docker" + user = "nobody" + kill_timeout = "90s" + + config { + image = "grafana/tempo:${var.version}" + ports = [ + "http", + "grpc", + ] + + args = [ + "-target=all", + "-config.file=/local/config.yml", + "-config.expand-env=true", + ] + } + template { + data = <<-EOC + server: + log_level: info + http_listen_port: {{ env "NOMAD_PORT_http" }} + grpc_listen_port: {{ env "NOMAD_PORT_grpc" }} + + distributor: + receivers: # this configuration will listen on all ports and protocols that tempo is capable of. + otlp: + protocols: + http: + grpc: + + metrics_generator: + processor: + service_graphs: + max_items: 10000 + + storage: + path: {{ env "NOMAD_ALLOC_DIR" }}/tempo/wal + remote_write: + - url: ${var.prometheus_remote_write_url} + send_exemplars: true + + storage: + trace: + backend: s3 + wal: + path: {{ env "NOMAD_ALLOC_DIR" }}/tempo/wal + local: + path: {{ env "NOMAD_ALLOC_DIR" }}/tempo/blocks + s3: + bucket: tempo # how to store data in s3 + endpoint: ${var.s3_url} + insecure: true + access_key: ${var.s3_access_key_id} + secret_key: ${var.s3_secret_access_key} + + overrides: + defaults: + metrics_generator: + processors: + - service-graphs + - span-metrics + EOC + destination = "local/config.yml" + } + + + resources { + cpu = 300 + memory = 1024 + } + } + } +} \ No newline at end of file