Is there any help to be expected from chef or from an existing cookbook for
starting background processes? I cannot find a way to start my server after
deploying without having chef just hang there until I kill the server. I
have tried a few different things: batch start command; ruby’s Process.spawn
command. The best I get is a separate process but not one that is detached
from the chef-client process.
Is there any help to be expected from chef or from an existing cookbook for starting background processes? I cannot find a way to start my server after deploying without having chef just hang there until I kill the server. I have tried a few different things: batch start command; ruby’s Process.spawn command. The best I get is a separate process but not one that is detached from the chef-client process.
Unless I miss-understand, this resource is for controlling applications that can already run as services. I have a plain java executable that I want to spawn and fork. I do not see how I can do this.
Is there any help to be expected from chef or from an existing cookbook for starting background processes? I cannot find a way to start my server after deploying without having chef just hang there until I kill the server. I have tried a few different things: batch start command; ruby’s Process.spawn command. The best I get is a separate process but not one that is detached from the chef-client process.
On Friday, August 23, 2013 at 8:58 AM, Florian Hehlen wrote:
Brad,
Unless I miss-understand, this resource is for controlling applications that can already run as services. I have a plain java executable that I want to spawn and fork. I do not see how I can do this.
Cheers,
Florian
What you really should do, is use something like runit, daemontools, systemd, upstart, etc. to manage the service. These options all provide a framework for starting/stopping the service, and restarting it if it crashes. Other people using your systems will have a standard way to check if the service is running and so on.
If you’re not going to do that, then you need to create a wrapper script to properly daemonize your service on your own. In principle it’s pretty simple, but there’s a lot of little details you need to get right. Chef’s daemonization code is here: https://github.com/opscode/chef/blob/master/lib/chef/daemon.rb For an example of daemonizing a java program, take a look at https://github.com/opscode/chef-solr
Thanks for the links. I got over my initial issue with a simple Process.spawn followed by Process.detach. This is obviously not enough for a production environment. But at the moment I am in the startup phase of the project and getting up and going is more important than making things bullet-proof.
I will definitely take a look at the cookbooks you suggest. I am still new to Ruby and have to admit struggle when looking at other people’s code. This is part of why my first attempts were not working. I also find myself very alone in the windows/chef world which does not help when looking for online help.
On Friday, August 23, 2013 at 8:58 AM, Florian Hehlen wrote:
Brad,
Unless I miss-understand, this resource is for controlling applications that can already run as services. I have a plain java executable that I want to spawn and fork. I do not see how I can do this.
Cheers,
Florian
What you really should do, is use something like runit, daemontools, systemd, upstart, etc. to manage the service. These options all provide a framework for starting/stopping the service, and restarting it if it crashes. Other people using your systems will have a standard way to check if the service is running and so on.
If you’re not going to do that, then you need to create a wrapper script to properly daemonize your service on your own. In principle it’s pretty simple, but there’s a lot of little details you need to get right. Chef’s daemonization code is here: https://github.com/opscode/chef/blob/master/lib/chef/daemon.rb For an example of daemonizing a java program, take a look at https://github.com/opscode/chef-solr
On Aug 24, 2013, at 12:52 AM, Florian Hehlen wrote:
Daniel,
Thanks for the links. I got over my initial issue with a simple Process.spawn followed by Process.detach. This is obviously not enough for a production environment. But at the moment I am in the startup phase of the project and getting up and going is more important than making things bullet-proof.
I will definitely take a look at the cookbooks you suggest. I am still new to Ruby and have to admit struggle when looking at other people’s code. This is part of why my first attempts were not working. I also find myself very alone in the windows/chef world which does not help when looking for online help.
Thanks for the links. I got over my initial issue with a simple
Process.spawn followed by Process.detach. This is obviously not enough for
a production environment. But at the moment I am in the startup phase of
the project and getting up and going is more important than making things
bullet-proof.
I will definitely take a look at the cookbooks you suggest. I am still new
to Ruby and have to admit struggle when looking at other people's code.
This is part of why my first attempts were not working. I also find myself
very alone in the windows/chef world which does not help when looking for
online help.
cheers,
FLorian
--
[ Julian C. Dunn jdunn@aquezada.com * Sorry, I'm ]
[ WWW: http://www.aquezada.com/staff/julian * only Web 1.0 ]
[ gopher://sdf.org/1/users/keymaker/ * compliant! ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]