hectcastro / chef-statsd

A Chef cookbook to install StatsD.
Apache License 2.0
38 stars 50 forks source link

sv error #38

Open iongion opened 10 years ago

iongion commented 10 years ago

I've ran out of options, I have no idea what is wrong, my node is

Ubuntu Server 12.04 LTS

Cheffile has

cookbook "chef-statsd",       git: "https://github.com/hectcastro/chef-statsd",     ref: "v1.1.10"

I provision the vagrant box but when it arrives at statsd installation, all hell breaks lose

[2014-10-14T14:20:57+00:00] DEBUG: Checking status of service statsd

================================================================================
Error executing action `start` on resource 'runit_service[statsd]'
================================================================================

Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of /usr/bin/sv start /etc/service/statsd ----
STDOUT: timeout: down: /etc/service/statsd: 0s, normally up, want up
STDERR:
---- End output of /usr/bin/sv start /etc/service/statsd ----
Ran /usr/bin/sv start /etc/service/statsd returned 1
Cookbook Trace:
---------------
/tmp/vagrant-chef-2/chef-solo-1/cookbooks/runit/libraries/provider_runit_service.rb:183:in `start_service' ==> vagranteu3_1204_193p0:
Resource Declaration:
---------------------
# In /tmp/vagrant-chef-2/chef-solo-1/cookbooks/chef-statsd/recipes/default.rb
 58: runit_service "statsd" do
 59:   action [:enable, :start]
 60:   default_logger true
 61:   options ({
 62:     :user => node['statsd']['username'],
 63:     :statsd_dir => node['statsd']['dir'],
 64:     :conf_dir => node['statsd']['conf_dir'],
 65:     :nodejs_bin => node['statsd']['nodejs_bin']
 66:   })
 67: end
Compiled Resource:

------------------
# Declared in /tmp/vagrant-chef-2/chef-solo-1/cookbooks/chef-statsd/recipes/default.rb:58:in `from_file'

runit_service("statsd") do
  provider Chef::Provider::Service::Runit
  action [:enable, :start]
  updated true
  supports {:restart=>true, :reload=>true, :status=>true}
  retries 0
  retry_delay 2
  guard_interpreter :default
  service_name "statsd"
  enabled true
  pattern "statsd"
  status_command "/usr/bin/sv status /etc/service"
  sv_bin "/usr/bin/sv"
  sv_dir "/etc/sv"
  service_dir "/etc/service"
  lsb_init_dir "/etc/init.d"
  options {:user=>"statsd", :statsd_dir=>"/usr/share/statsd", :conf_dir=>"/etc/statsd", :nodejs_bin=>"/bin/node"}
  log true
  default_logger true
  restart_on_update true
  run_template_name "statsd"
  log_template_name "statsd"
  check_script_template_name "statsd"
  finish_script_template_name "statsd"
  sv_templates true
  service_mirror # Declared in

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

  cookbook_name :"chef-statsd"
  recipe_name "default"
end
[2014-10-14T14:21:05+00:00] INFO: Running queued delayed notifications before re-raising exception
[2014-10-14T14:21:05+00:00] DEBUG: Re-raising exception: Mixlib::ShellOut::ShellCommandFailed - runit_service[statsd] (chef-statsd::default line 58) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /usr/bin/sv start /etc/service/statsd ----
STDOUT: timeout: down: /etc/service/statsd: 0s, normally up, want up
STDERR:
---- End output of /usr/bin/sv start /etc/service/statsd ----
Ran /usr/bin/sv start /etc/service/statsd returned 1
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/mixlib-shellout-1.6.0/lib/mixlib/shellout.rb:272:in `invalid!' ==> vagranteu3_1204_193p0:   /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/mixlib-shellout-1.6.0/lib/mixlib/shellout.rb:259:in `error!' ==> vagranteu3_1204_193p0:   /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/mixin/shell_out.rb:43:in `shell_out!'
  /tmp/vagrant-chef-2/chef-solo-1/cookbooks/runit/libraries/provider_runit_service.rb:183:in `start_service'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/provider/service.rb:90:in `block in action_start'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/mixin/why_run.rb:52:in `call'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/mixin/why_run.rb:52:in `add_action'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/provider.rb:156:in `converge_by'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/provider/service.rb:89:in `action_start'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/provider.rb:121:in `run_action'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/resource.rb:648:in `run_action'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/runner.rb:49:in `run_action'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/runner.rb:81:in `block (2 levels) in converge'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/runner.rb:81:in `each'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/runner.rb:81:in `block in converge'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/resource_collection.rb:98:in `block in execute_each_resource'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/resource_collection.rb:96:in `execute_each_resource'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/runner.rb:80:in `converge'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/client.rb:345:in `converge'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/client.rb:431:in `do_run'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/client.rb:213:in `block in run'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/client.rb:207:in `fork'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/client.rb:207:in `run'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/application.rb:236:in `run_chef_client'

  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/application/solo.rb:226:in `block in run_application'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/application/solo.rb:218:in `loop'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/application/solo.rb:218:in `run_application'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/application.rb:55:in `run'
  /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/bin/chef-solo:25:in `<top (required)>'
  /opt/ruby/1.9.3-p0/bin/chef-solo:19:in `load'
  /opt/ruby/1.9.3-p0/bin/chef-solo:19:in `<main>'
[2014-10-14T14:21:05+00:00] ERROR: Running exception handlers
[2014-10-14T14:21:05+00:00] ERROR: Exception handlers complete
[2014-10-14T14:21:05+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2014-10-14T14:21:05+00:00] DEBUG: Mixlib::ShellOut::ShellCommandFailed: runit_service[statsd] (chef-statsd::default line 58) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /usr/bin/sv start /etc/service/statsd ----
STDOUT: timeout: down: /etc/service/statsd: 0s, normally up, want up
STDERR:
---- End output of /usr/bin/sv start /etc/service/statsd ----
Ran /usr/bin/sv start /etc/service/statsd returned 1
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/mixlib-shellout-1.6.0/lib/mixlib/shellout.rb:272:in `invalid!' ==> vagranteu3_1204_193p0: /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/mixlib-shellout-1.6.0/lib/mixlib/shellout.rb:259:in `error!'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/mixin/shell_out.rb:43:in `shell_out!'
/tmp/vagrant-chef-2/chef-solo-1/cookbooks/runit/libraries/provider_runit_service.rb:183:in `start_service' ==> vagranteu3_1204_193p0: /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/provider/service.rb:90:in `block in action_start'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/mixin/why_run.rb:52:in `call'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/mixin/why_run.rb:52:in `add_action'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/provider.rb:156:in `converge_by'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/provider/service.rb:89:in `action_start' ==> vagranteu3_1204_193p0: /opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/provider.rb:121:in `run_action'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/resource.rb:648:in `run_action'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/runner.rb:49:in `run_action'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/runner.rb:81:in `block (2 levels) in converge'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/runner.rb:81:in `each'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/runner.rb:81:in `block in converge'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/resource_collection.rb:98:in `block in execute_each_resource'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/resource_collection.rb:96:in `execute_each_resource'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/runner.rb:80:in `converge'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/client.rb:345:in `converge'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/client.rb:431:in `do_run'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/client.rb:213:in `block in run'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/client.rb:207:in `fork'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/client.rb:207:in `run'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/application.rb:236:in `run_chef_client'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/application/solo.rb:226:in `block in run_application'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/application/solo.rb:218:in `loop'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/application/solo.rb:218:in `run_application'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/application.rb:55:in `run'
/opt/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/chef-11.16.2/bin/chef-solo:25:in `<top (required)>'
/opt/ruby/1.9.3-p0/bin/chef-solo:19:in `load'
/opt/ruby/1.9.3-p0/bin/chef-solo:19:in `<main>'
[2014-10-14T14:21:05+00:00] ERROR: runit_service[statsd] (chef-statsd::default line 58) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /usr/bin/sv start /etc/service/statsd ----
STDOUT: timeout: down: /etc/service/statsd: 0s, normally up, want up
STDERR:
---- End output of /usr/bin/sv start /etc/service/statsd ----
Ran /usr/bin/sv start /etc/service/statsd returned 1
[2014-10-14T14:21:05+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
hectcastro commented 10 years ago

It looks like runit is having difficulty starting the statsd service. The template for the script that it executes is here:

https://github.com/hectcastro/chef-statsd/blob/develop/templates/default/sv-statsd-run.erb

You may want to take a look at how it is rendered on your machine to see if the paths for things like the Node.js binary and statsd configuration files look OK. The rendered template should be in /etc/service/statsd.

PaulOstazeski commented 9 years ago

I'm seeing the same problem. In my case, the error is caused by node (nodejs) being installed to /usr/bin/node instead of /usr/local/bin/node.

iongion commented 9 years ago

Sorry guys for not coming with a reply earlier, yes, as PaulOstazeski says, this is the issue, nodejs being located in a wrong path

PaulOstazeski commented 9 years ago

Since this commit in April, node["nodejs"]["dir"] has been removed. If the node executable is in the user's PATH variable, does it matter what the full path is?

hectcastro commented 9 years ago

Support for node["statsd"]["nodejs_bin"] has been added to this cookbook since https://github.com/hectcastro/chef-statsd/commit/5452a1a59474c3411e1eff3ae1d67eaeb555b2c8. Are you able to override that to make things work?

PaulOstazeski commented 9 years ago

Yes, overriding that attribute works.

PaulOstazeski commented 9 years ago

I would think that the upstream node cookbook would publish an attribute defining the path to node (the executable) (I think that the path varies depending on if a user chooses a package install or a source install), but it does not publish such an attribute so far as I can see.