I’m having some issues with defining a service for my app and notifying it to restart. The relevant parts of my recipe are:
link “/etc/init.d/x-ipan” do
to "/opt/x/ipan/shared/ipan"
end
service “x-ipan” do
supports :status => true, :restart => true, :reload => true
action :enable
end
Tidy up, remove the old name
service “ipan.staging” do
action :disable
end
file “/etc/init.d/ipan.staging” do
action :delete
end
nginx_site “ipan.staging” do
enable true
source "nginx.conf.erb"
variables :root => IPAN_ROOT,
:app_name => “ipan_staging”,
:server_name => “ipan.staging.x.com”,
:default => false
end
unicorn_config “/opt/x/ipan/shared/unicorn.rb” do
listen “’#{IPAN_ROOT}/tmp/unicorn.sock’” => {:backlog => 2048}
owner "ipan"
group "x"
preload_app true
worker_processes 16
working_directory IPAN_ROOT
pid "#{IPAN_ROOT}/tmp/pids/unicorn.pid"
stderr_path "#{IPAN_ROOT}/log/error.log"
stdout_path “#{IPAN_ROOT}/log/out.log”
seamless_upgrades true
notifies :reload, resources(:service => “x-ipan”)
end
The chef-client debug log is as follows.
[Thu, 26 Aug 2010 11:03:54 +0100] DEBUG: template[/opt/x/ipan/shared/ipan] content has not changed.
[Thu, 26 Aug 2010 11:03:54 +0100] DEBUG: Processing link[/etc/init.d/x-ipan] on stg1all01.x.com
[Thu, 26 Aug 2010 11:03:54 +0100] DEBUG: link[/etc/init.d/x-ipan] using Chef::Provider::Link
[Thu, 26 Aug 2010 11:03:54 +0100] DEBUG: Processing service[x-ipan] on stg1all01.x.com
[Thu, 26 Aug 2010 11:03:54 +0100] DEBUG: service[x-ipan] using Chef::Provider::Service::Debian
[Thu, 26 Aug 2010 11:03:54 +0100] DEBUG: service[x-ipan] supports status, running
[Thu, 26 Aug 2010 11:03:54 +0100] DEBUG: Executing /etc/init.d/x-ipan status
[Thu, 26 Aug 2010 11:03:54 +0100] DEBUG: ---- Begin output of /etc/init.d/x-ipan status ----
[Thu, 26 Aug 2010 11:03:54 +0100] DEBUG: STDOUT: * IPAN unicorn daemon is running
[Thu, 26 Aug 2010 11:03:54 +0100] DEBUG: STDERR:
[Thu, 26 Aug 2010 11:03:54 +0100] DEBUG: ---- End output of /etc/init.d/x-ipan status ----
[Thu, 26 Aug 2010 11:03:54 +0100] DEBUG: Ran /etc/init.d/x-ipan status returned 0
[Thu, 26 Aug 2010 11:03:54 +0100] DEBUG: service[x-ipan]: not enabling, already enabled
…
[Thu, 26 Aug 2010 11:03:54 +0100] INFO: Writing updated content for template[/opt/x/ipan/shared/unicorn.rb] to /opt/x/ipan/shared/unicorn.rb
Then at the end of the run I get:
[Thu, 26 Aug 2010 11:03:55 +0100] ERROR: Re-raising exception: ArgumentError - Cannot find a provider for servicex-ipan on ubuntu version 10.04
/usr/lib/ruby/1.8/chef/platform.rb:322:in find_provider' /usr/lib/ruby/1.8/chef/platform.rb:250:in
find_provider_for_node’
/usr/lib/ruby/1.8/chef/runner.rb:40:in build_provider' /usr/lib/ruby/1.8/chef/runner.rb:50:in
run_action’
/usr/lib/ruby/1.8/chef/runner.rb:124:in converge' /usr/lib/ruby/1.8/chef/runner.rb:118:in
each’
/usr/lib/ruby/1.8/chef/runner.rb:118:in converge' /usr/lib/ruby/1.8/chef/client.rb:304:in
converge’
/usr/lib/ruby/1.8/chef/client.rb:106:in run' /usr/lib/ruby/1.8/chef/application/client.rb:212:in
run_application’
/usr/lib/ruby/1.8/chef/application/client.rb:202:in loop' /usr/lib/ruby/1.8/chef/application/client.rb:202:in
run_application’
/usr/lib/ruby/1.8/chef/application.rb:62:in `run’
/usr/bin/chef-client:26
Any thoughts? Could it be something to do with the fact that the notifies is coming from inside the unicorn cookbook? (I’d hope not - services are global I thought)
-ash