hashicorp / consul-template

Template rendering, notifier, and supervisor for @HashiCorp Consul and Vault data.
https://www.hashicorp.com/
Mozilla Public License 2.0
4.76k stars 783 forks source link

Bug: Deduplication mode with exec mode in the same consul-template config #1609

Open komapa opened 2 years ago

komapa commented 2 years ago

Consul Template version

2022-07-29T05:33:52.961Z [INFO] consul-template v0.29.1 (4525703)

Configuration

log_level = "trace"

# Setting this value to the empty string will cause consul-template
# to not listen for any reload signals but pass them down to nginx instead.
reload_signal = ""

consul {
  retry {
    enabled = true
    attempts = 10
    max_backoff = "1s"
  }
}

# See: https://github.com/hashicorp/consul-template/blob/main/docs/modes.md#de-duplication-mode
deduplicate {
  # This enables de-duplication mode.
  enabled = true

  # This is the prefix to the path in Consul's KV store where de-duplication
  # templates will be pre-rendered and stored.
  prefix = "consul-template/dedup/"
}

template {
  source      = "templates/service-gateway.conf.ctmpl"
  destination = "local/nginx/conf.d/service-gateway.conf"
}

template {
  source      = "templates/http-status.conf.ctmpl"
  destination = "local/nginx/conf.d/http-status.conf"
}

exec {
  # We are setting the kill_timeout to the max 5m that Nomad is going to wait before killing consul-template itself
  # This way we allow Nomad to be the one controlling the kill_timeout and not consul-template
  kill_timeout = "5m"

  # It is very important to use the "array" syntax when defining parameters to the command,
  # otherwise consul-template does not pass signals correctly to the spawned process.
  # See: https://github.com/hashicorp/consul-template#multiple-commands
  command = ["nginx"]
}

Command

consul-template -config /config.hcl -exec-kill-signal SIGQUIT -exec-reload-signal SIGHUP

Debug output

Upon request

Expected behavior

I would expect deduplication mode to work with the exec mode.

Actual behavior

The leader consul-template renders templates and executes the process but all other consul-templates are blocked on waiting on changes for the templates and never execute the process defined in the exec stanza.

komapa commented 2 years ago

@eikenb, let me know if you need any more information from our side. I would love to help fix this if it is possible. Thank you!

komapa commented 1 year ago

This has come down in priority for us as well, just to update the issue.