Skip to content

Commit

Permalink
fix(esm): add service, telemetry and health check (#124)
Browse files Browse the repository at this point in the history
fix(esm): add service, telemetry and health check
chore(esm): tweak resources and service configuration for esm
fix(esm): add restart and reschedule blocks

---------

Signed-off-by: Bruce Becker <[email protected]>
  • Loading branch information
brucellino authored Apr 1, 2024
1 parent 584ab3c commit af8643c
Showing 1 changed file with 72 additions and 4 deletions.
76 changes: 72 additions & 4 deletions consul-esm.nomad
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ variable "consul_esm_version" {

job "consul-esm" {
group "main" {

count = 1
network {
port "metrics" {
to = "9000"
}
}
count = 5

update {
max_parallel = 1
Expand All @@ -25,8 +29,24 @@ job "consul-esm" {
healthy_deadline = "5m"
}

task "monitor" {
restart {
interval = "10m"
attempts = 3
delay = "1m"
mode = "delay"
}

reschedule {
unlimited = true
delay = "15s"
delay_function = "fibonacci"
max_delay = "1h"
}

task "monitor" {
env {
log_level = "INFO"
}
// scaling {
// enabled = true
// min = 0
Expand All @@ -35,10 +55,58 @@ job "consul-esm" {

// }
// }

service {
port = "metrics"
check {
name = "metrics_health"
type = "http"
path = "/metrics"
interval = "1m"
timeout = "5s"
}
}
driver = "exec"
config {
command = "local/consul-esm"
args = [
"-config-dir=local"
]
}

template {
data = <<EOT
log_level = "{{ env "log_level" }}"
enable_syslog = false
log_json = false
instance_id = "${uuidv4()}"
consul_service = "consul-esm"
consul_service_tag = ""
consul_kv_path = "consul-esm/"
external_node_meta {
"external-node" = "true"
}
node_reconnect_timeout = "72h"
node_reconnect_timeout = "72h"
node_probe_interval = "10s"
disable_coordinate_updates = false
http_addr = "localhost:8500"
token = ""
datacenter = "dc1"
client_address = "{{ env "NOMAD_ADDR_metrics" }}"
ping_type = "udp"
telemetry {
disable_hostname = false
filter_default = false
prefix_filter = []
metrics_prefix = "/metrics"
prometheus_retention_time = "30s"
}
passing_threshold = 0
critical_threshold = 0
EOT
destination = "local/config.hcl"
perms = "0644"

}
artifact {
source = "https://releases.hashicorp.com/consul-esm/${var.consul_esm_version}/consul-esm_${var.consul_esm_version}_linux_arm64.zip"
Expand Down

0 comments on commit af8643c

Please sign in to comment.