- From: AJ Christensen <
>
- To:
- Subject: [chef] Re: Re: Re: How to create services with the service resource?
- Date: Thu, 16 Aug 2012 17:38:57 +1200
On 16 August 2012 15:43, Steve Bennett
<
>
wrote:
>
On 16 August 2012 13:24, AJ Christensen
>
<
>
>
wrote:
>
> You are correct in assuming that the service resource (when told to
>
> use the Simple or Init Service Providers)
>
>
Sorry, what do you mean "when told to..."? A comprehensive example in
>
the doco would be really helpful.
you can specify 'provider Chef::Provider::Service::Simple or ::Init'
in the resource declaration. I'm sure this is in the docs somewhere
(it's how you change the provider for any resource)
If you're using the Debian provider or whatever, that has additional
behaviour for enable/disable.
>
>
>
> can be used to define and
>
> run services.
>
>
Great!
>
>
> Please post the relevant debug output surrounding any problems you're
>
> having with the service resource and provider.
>
>
115.146.94.40 [2012-08-16T03:21:44+00:00] INFO: Processing
>
service[atom-dataset-provider] action enable
>
(/var/chef/cache/cookbooks/atom-dataset-provider/recipes/default.rb
>
line 94)
>
115.146.94.40 [2012-08-16T03:21:44+00:00] ERROR:
>
service[atom-dataset-provider]
>
(/var/chef/cache/cookbooks/atom-dataset-provider/recipes/default.rb
>
line 94) has had an error
>
115.146.94.40 [2012-08-16T03:21:44+00:00] ERROR:
>
service[atom-dataset-provider]
>
(/var/chef/cache/cookbooks/atom-dataset-provider/recipes/default.rb:94:in
>
`from_file') had an error:
>
115.146.94.40 service[atom-dataset-provider]
>
(/var/chef/cache/cookbooks/atom-dataset-provider/recipes/default.rb
>
line 94) had an error: Chef::Exceptions::Exec: /usr/sbin/update-rc.d
>
atom-dataset-provider defaults returned 1, expected 0
Looks like your init script isn't working correctly for action :enable
-- or... you haven't dropped an init script off? Perhaps?
You've only posted the INFO level output there. Re-run with -l debug.
What is the output of:
`/usr/sbin/update-rc.d atom-dataset-provider defaults` ?
--AJ
>
>
>
> Additionally, using bash scripts as your start/stop command is uh.. a
>
> little suboptimal? Have you considered using a process supervision
>
> system, e.g.; Runit, Upstart, Monit, s6, .. (...?)
>
>
It's probably ok for my current dev/testing purposes - my learning
>
curve is steep enough already :)
>
>
> Feel free to make edits (need an account) based on my comments here,
>
> although I'd love to know what problems you were having or what
>
> documentation in particular is lacking.
>
>
Sure - like much of the Chef doco, it's just lacking explicitness, and
>
doesn't give any guidance on typical uses. Consider this description:
>
>
----
>
Service
>
Manage a service.
>
----
>
>
The reader has to read between the lines to work out what this
>
resource does and doesn't do. Here's a quick suggestion:
>
----
>
Service
>
A wrapper around the service subsystem (init.d, upstart etc as
>
appropriate), allowing you to start and stop existing system services,
>
or define new services.
>
----
>
>
And the Providers section assume that the reader knows (and cares)
>
what a Provider is, when they just came here to create a service. I
>
don't know enough about providers (see!) to really help, but an
>
improved text might look something like:
>
----
>
Providers
>
The Service resource uses a different subsystem Provider depending on
>
the platform. You can override this (for example, to use Upstart even
>
when it's not the default) as follows:...
>
----
>
>
I have edited some of the other doco already, but prefer to only make
>
changes when I'm confident what I'm talking about
>
>
Steve [former tech writer, perpetual critic...]
>
>
>
>
>
> Cheers,
>
>
>
> --AJ
>
>
>
> On 16 August 2012 15:00, Steve Bennett
>
> <
>
>
> wrote:
>
>> Hi,
>
>> I naively assumed (and am not the only one:
>
>> http://lists.opscode.com/sympa/arc/chef/2012-05/msg00267.html) that
>
>> the service resource could be used to define, then run services:
>
>>
>
>> ...
>
>> service "atom-dataset-provider" do
>
>> start_command "/opt/atom-dataset-provider/current/provider.sh"
>
>> stop_command "/opt/atom-dataset-provider/current/kill_provider.sh"
>
>> action [:enable]
>
>> end
>
>>
>
>> end
>
>> restart_command do
>
>> current_release = release_path
>
>> service "atom-dataset-provider" do
>
>> action [:restart]
>
>> end
>
>> end
>
>>
>
>>
>
>> But apparently it doesn't. In that case:
>
>
>
>>
>
>> Thanks,
>
>> Steve
Archive powered by MHonArc 2.6.16.