From ac15eefedbb0f28943bf53b00662b907a9531cc3 Mon Sep 17 00:00:00 2001 From: Ben Martin Date: Wed, 11 Dec 2024 01:29:29 +0000 Subject: [PATCH] feat(elk): repurpose Neto node to tiebreaker --- modules/elk/jobspec.nomad.hcl | 86 ++++++++++++++++++++++++++++++++++- 1 file changed, 85 insertions(+), 1 deletion(-) diff --git a/modules/elk/jobspec.nomad.hcl b/modules/elk/jobspec.nomad.hcl index c5d29ab..6442f52 100644 --- a/modules/elk/jobspec.nomad.hcl +++ b/modules/elk/jobspec.nomad.hcl @@ -6,12 +6,18 @@ job "elk" { group "node" { - count = 3 + count = 2 constraint { distinct_hosts = true } + constraint { + attribute = "${node.unique.name}" + operator = "set_contains_any" + value = "Hestia,Nyx" + } + network { mode = "bridge" port "http" { @@ -83,6 +89,84 @@ job "elk" { } } + group "tiebreaker" { + + constraint { + attribute = "${node.unique.name}" + value = "Neto" + } + + network { + mode = "bridge" + port "http" { + static = 9200 + } + port "transport" { + static = 9300 + } + port "envoy_metrics" { + to = 9102 + } + } + + service { + provider = "consul" + port = "9200" + + meta { + envoy_metrics_port = "${NOMAD_HOST_PORT_envoy_metrics}" + } + + connect { + sidecar_service { + proxy { + expose { + path { + path = "/metrics" + protocol = "http" + local_path_port = 9102 + listener_port = "envoy_metrics" + } + } + transparent_proxy { + exclude_inbound_ports = ["9200", "9300"] + exclude_outbound_ports = [9200, 9300] + } + } + } + } + } + + service { + provider = "consul" + port = "transport" + } + + task "elasticsearch" { + driver = "docker" + + config { + image = "docker.elastic.co/elasticsearch/elasticsearch:${var.elastic_version}" + + ports = ["9200", "9300"] + + volumes = [ + "/mnt/docker/elastic-${node.unique.name}/config:/usr/share/elasticsearch/config", + "/mnt/docker/elastic-${node.unique.name}/data:/usr/share/elasticsearch/data", + ] + + ulimit { + memlock = "-1:-1" + } + } + + resources { + cpu = 500 + memory = 1024 + } + } + } + group "kibana" { count = 2