Skip to content

Instantly share code, notes, and snippets.

@langerma
Created April 4, 2023 10:41
Show Gist options
  • Save langerma/477c772efe7610ad4cb24dc551d2aff3 to your computer and use it in GitHub Desktop.
Save langerma/477c772efe7610ad4cb24dc551d2aff3 to your computer and use it in GitHub Desktop.
deploy kafka-ui on nomad
job "kafkaui" {
datacenters = ["yourdc"]
constraint {
attribute = "${attr.kernel.name}"
value = "linux"
}
group "kafkaui" {
constraint {
attribute = "${attr.cpu.arch}"
value = "arm64"
}
network {
port "kafkaui" {
static = 18181
}
}
service {
name = "kafkaui"
tags = [
"global",
"monitoring",
"log"
]
port = "kafkaui"
check {
type = "http"
path = "/"
port = "kafkaui"
interval = "10s"
timeout = "2s"
}
}
task "kafkaui" {
driver = "docker"
artifact {
source = "https://raw.githubusercontent.com/netsampler/goflow2/main/pb/flow.proto"
destination = "local/flow.proto"
mode = "file"
}
config {
force_pull = true
image = "provectuslabs/kafka-ui:latest"
ports = ["kafkaui"]
network_mode = "host"
}
template {
data = <<EOT
#KAFKA_CLUSTERS_0_ZOOKEEPER={{ range $index, $element := service "zookeeper|any" }}{{if ne $index 0}},{{end}}{{$element.Address}}:{{$element.Port}}{{end}}/kafka
KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS={{ range $index, $element := service "kafka-plain|any" }}{{if ne $index 0}},{{end}}{{$element.Address}}:{{$element.Port}}{{end}}
EOT
destination = "secrets/file.env"
env = true
change_mode = "noop"
}
resources {
cpu = 100
memory = 384
}
env {
SERVER_PORT = "18181"
KAFKA_CLUSTERS_0_NAME = "langerma"
KAFKA_CLUSTERS_0_PROTOBUFFILES_0 = "/local/flow.proto"
KAFKA_CLUSTERS_0_PROTOBUFMESSAGENAME = "flowpb.FlowMessage"
KAFKA_CLUSTERS_0_PROTOBUFMESSAGENAMEFORKEYBYTOPIC_flows = "flowpb.FlowMessage"
JAVA_OPTS = "-Xms256m -Xmx256m"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment