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

Restart consul service after installation #450

Closed maxnasonov closed 7 years ago

maxnasonov commented 7 years ago

Currently it doesn't seem that the service is restarted after installation. Is it done on purpose (e.g. not to break a cluster)? Is it worth to have an option (as a parameter) to restart the service?

I've verified on 2.3.0 but 3.0.0's code looks the same.

georgiou commented 7 years ago

Looking at the update from 2.3.0 to 3.0.0 I see a service reload but since the systemd service file has an ExecReload=/bin/kill -HUP $MAINPID it doesn't switch to the new version

legal90 commented 7 years ago

Hi @maxnasonov, Yes, this cookbook's recipes don't trigger a consul service restart. You are right - it was done intentionally, in order not to break a cluster on the version upgrade: https://github.com/johnbellone/consul-cookbook/issues/288

But you can try to use that trick, allowing to override any parameter of the resource defined in another recipe:

include_recipe "consul::default"

r = resources(:consul_installation => node['consul']['version'])
r.notifies :restart, "consul_service[#{service_name}]"

UPDATE: taken from here: https://raymii.org/s/articles/Chef_-_overwrite_templates_in_wrapper_cookbooks.html

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.