evertrue / zookeeper-cookbook

Chef cookbook for installing and managing Zookeeper.
https://supermarket.chef.io/cookbooks/zookeeper
Apache License 2.0
81 stars 119 forks source link

Usage instructions #102

Closed synhershko closed 8 years ago

synhershko commented 10 years ago

Especially for the service recipe (how-to + exhibitor support).

Running it now (using a wrapper cookbook here: https://github.com/synhershko/Isengard.Cookbooks/blob/master/isengard-zookeeper/recipes/as_service.rb) I get:

================================================================================
Error executing action `enable` on resource 'runit_service[zookeeper]'
================================================================================

RuntimeError
------------
Could not locate main runit sv_bin at "/sbin/sv". Did you remember to install runit before declaring a "runit_service" resource? 

Try adding the following to the top of your recipe:

include_recipe "runit"

Cookbook Trace:
---------------
/var/lib/aws/opsworks/cache.stage2/cookbooks/runit/libraries/provider_runit_service.rb:71:in `load_current_resource'

Resource Declaration:
---------------------
# In /var/lib/aws/opsworks/cache.stage2/cookbooks/zookeeper/recipes/service.rb

46:   runit_service 'zookeeper' do
47:     default_logger true
48:     options({
49:       exec: executable_path
50:     })
51:     action [:enable, :start]
52:   end
53: when 'exhibitor'

Compiled Resource:
------------------
# Declared in /var/lib/aws/opsworks/cache.stage2/cookbooks/zookeeper/recipes/service.rb:46:in `from_file'

runit_service("zookeeper") do
provider Chef::Provider::Service::Runit
action [:enable, :start]
supports {:restart=>true, :reload=>true, :status=>true}
retries 0
retry_delay 2
service_name "zookeeper"
pattern "zookeeper"
status_command "/sbin/sv status /etc/service"
sv_bin "/sbin/sv"
sv_dir "/etc/sv"
service_dir "/etc/service"
lsb_init_dir "/etc/init.d"
options {:exec=>"/opt/zookeeper/zookeeper-3.4.6/bin/zkServer.sh"}
log true
default_logger true
restart_on_update true
run_template_name "zookeeper"
log_template_name "zookeeper"
check_script_template_name "zookeeper"
finish_script_template_name "zookeeper"
sv_templates true
service_mirror # Declared in 

service("zookeeper") do
provider Chef::Provider::Service::Simple
action [:nothing]
supports {:restart=>true, :reload=>true, :status=>true}
retries 0
retry_delay 2
service_name "zookeeper"
pattern "zookeeper"
start_command "/sbin/sv start /etc/service/zookeeper"
stop_command "/sbin/sv stop /etc/service/zookeeper"
status_command "/sbin/sv status /etc/service/zookeeper"
restart_command "/sbin/sv restart /etc/service/zookeeper"
end

cookbook_name "zookeeper"
recipe_name "service"
end

It may be broken, but more lilkely I'm missing something

jakedavis commented 10 years ago

Yeah, this is a bug I think. We'll need to add a depends on runit in the metadata and include_recipe 'runit::default' in the service recipe. This is actually slightly tricky because I believeeee adding that recipe would break our use case internally (not sure though), since when we set up the service we have some network restrictions that might prevent runit::default from being able to work. I'll get a PR going by Tuesday.

synhershko commented 10 years ago

Cool. Is there a workaround i could use? On Aug 31, 2014 7:12 PM, "Jake Davis" notifications@github.com wrote:

Yeah, this is a bug I think. We'll need to add a depends on runit in the metadata and include_recipe 'runit::default' in the service recipe. This is actually slightly tricky because I believeeee adding that recipe would break our use case internally (not sure though), since when we set up the service we have some network restrictions that might prevent runit::default from being able to work. I'll get a PR going by Tuesday.

— Reply to this email directly or view it on GitHub https://github.com/SimpleFinance/chef-zookeeper/issues/102#issuecomment-53992630 .

jakedavis commented 10 years ago

Yep. If you include_recipe 'runit::default' anytime before you call the service recipe, you're good to go.

synhershko commented 10 years ago

Worked like a charm. I think the best resolution for this is to define this cookbook as one that needs to be wrapped, and having doco about how to install it as a service. While at it, doco on installing Exhibitor would be nice to have too!

synhershko commented 10 years ago

Other items I'm missing docs for (not Chef / ruby expert) is how / where to set ZK's myid (if at all?), how to point it at fellow ensemble members, and how to use discover_zookeepers from other cookbooks (if it's still around at all?)

jeffbyrnes commented 10 years ago

:+1: for more docs. This is definitely a cookbook meant for wrapping, along with the exhibitor cookbook.

jakedavis commented 10 years ago

Yo PRs accepted :) nah but I can try to work on this hopefully in the next couple of days. It definitely could use some improvements to the docs.

jeffbyrnes commented 10 years ago

@jakedavis I'd be happy to help out, but currently grinding on some Archiva stuff :rage1:

jeffbyrnes commented 8 years ago

Closing, as the README is pretty well-fleshed out now.