sous-chefs / consul

Development repository for the consul cookbook
https://supermarket.chef.io/cookbooks/consul
Apache License 2.0
192 stars 244 forks source link

Latest Configuration Changes - New version release? #375

Closed matthew-watson1 closed 7 years ago

matthew-watson1 commented 7 years ago

The latest tagged version of the cookbook does not contain the performance parameters (for raft multiplier etc) which are needed for production. Any idea when the new version will be committed?

richid commented 7 years ago

Similarly, there are missing configuration options for things like dogstatsd_* and retry_join_ec2 in ConsulConfig. I realize it's difficult to keep this list updated with the available options upstream so I was wondering if there should be an extra_config parameter. This would just be a free-form hash that gets turned into the configuration JSON without any validation.

johnbellone commented 7 years ago

We will be releasing 2.3 in the next few days. PR are welcome for config options that are missing!

richid commented 7 years ago

After reading the Consul documentation some more I found a quick way around this so I'll leave it here in hopes that it helps someone else.

From the Consul docs:

When loading configuration, Consul loads the configuration from files and directories in lexical order. For example, configuration file basic_config.json will be processed before extra_config.json. Configuration specified later will be merged into configuration specified earlier. In most cases, "merge" means that the later version will override the earlier.

So in my wrapper cookbook I just defined some extra attributes:

default['consul']['extra_config']['retry_join_ec2']['region'] = 'us-west-2'
default['consul']['extra_config']['retry_join_ec2']['tag_key'] = 'opsworks:instance'
default['consul']['extra_config']['retry_join_ec2']['tag_value'] = 'consul-*'

And then tossed this into the wrapper cookbook's default recipe:

file "#{node['consul']['service']['config_dir']}/extra_config.json" do
  content JSON.pretty_generate(node['consul']['extra_config'], quirks_mode: true)
  mode '0640'
  owner node['consul']['config']['owner']
  group node['consul']['config']['group']
  notifies :reload, "consul_service[#{node['consul']['service_name']}]", :delayed
end

Works like a charm! Thanks again!

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.