<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: daemon_controller: a library for robust daemon management</title>
	<atom:link href="http://blog.phusion.nl/2008/08/25/daemon_controller-a-library-for-robust-daemon-management/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.phusion.nl/2008/08/25/daemon_controller-a-library-for-robust-daemon-management/</link>
	<description></description>
	<lastBuildDate>Fri, 12 Mar 2010 16:01:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Ryan Schlesinger</title>
		<link>http://blog.phusion.nl/2008/08/25/daemon_controller-a-library-for-robust-daemon-management/comment-page-2/#comment-9296</link>
		<dc:creator>Ryan Schlesinger</dc:creator>
		<pubDate>Fri, 21 Aug 2009 23:49:11 +0000</pubDate>
		<guid isPermaLink="false">http://blog.phusion.nl/?p=43#comment-9296</guid>
		<description>I&#039;m trying to automate starting thinking_sphinx.  TS provides rake tasks for start/stopping/rebuilding and I would like to use these withing daemon_controller if possible.  Obviously rake starts up the rails environment before running the TS tasks which doesn&#039;t work at all when I&#039;m trying to run them from within daemon_controller.  Is there an easy way to make this work?  Should I just write some scripts that know how to do the TS tasks I&#039;m interested in from daemon_controller?</description>
		<content:encoded><![CDATA[<p>I&#8217;m trying to automate starting thinking_sphinx.  TS provides rake tasks for start/stopping/rebuilding and I would like to use these withing daemon_controller if possible.  Obviously rake starts up the rails environment before running the TS tasks which doesn&#8217;t work at all when I&#8217;m trying to run them from within daemon_controller.  Is there an easy way to make this work?  Should I just write some scripts that know how to do the TS tasks I&#8217;m interested in from daemon_controller?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ashley Moran</title>
		<link>http://blog.phusion.nl/2008/08/25/daemon_controller-a-library-for-robust-daemon-management/comment-page-2/#comment-1085</link>
		<dc:creator>Ashley Moran</dc:creator>
		<pubDate>Tue, 09 Sep 2008 09:55:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.phusion.nl/?p=43#comment-1085</guid>
		<description>Awesome! But... it doesn&#039;t work if the controlled daemon creates its own pid dir.  Ramaze does this, and the following controller will not start:

CONTROLLERS[:mock_news_sniffer] = DaemonController.new(
   :identifier    =&gt; &quot;RamazeApp&quot;,
   :start_command =&gt; &quot;ramaze --daemonize start --port 2999 #{app_path}&quot;,
   :stop_command  =&gt; &quot;ramaze --daemonize stop --port 2999 #{app_path}&quot;,
   :ping_command  =&gt; lambda { TCPSocket.new(&quot;localhost&quot;, 2999) },
   :pid_file      =&gt; File.join(Dir.tmpdir, &quot;ramaze.pids/ramaze_app.pid&quot;),
   :log_file      =&gt; File.join(Dir.tmpdir, &quot;ramaze.pids/ramaze_app.log&quot;),
   :timeout       =&gt; 25
)

because it can&#039;t access the lock dir.

But works if you put this in front of it:
FileUtils.mkdir_p(File.join(Dir.tmpdir, &quot;ramaze.pids&quot;))

Otherwise working great for me!</description>
		<content:encoded><![CDATA[<p>Awesome! But&#8230; it doesn&#8217;t work if the controlled daemon creates its own pid dir.  Ramaze does this, and the following controller will not start:</p>
<p>CONTROLLERS[:mock_news_sniffer] = DaemonController.new(<br />
   :identifier    =&gt; &#8220;RamazeApp&#8221;,<br />
   :start_command =&gt; &#8220;ramaze &#8211;daemonize start &#8211;port 2999 #{app_path}&#8221;,<br />
   :stop_command  =&gt; &#8220;ramaze &#8211;daemonize stop &#8211;port 2999 #{app_path}&#8221;,<br />
   :ping_command  =&gt; lambda { TCPSocket.new(&#8220;localhost&#8221;, 2999) },<br />
   :pid_file      =&gt; File.join(Dir.tmpdir, &#8220;ramaze.pids/ramaze_app.pid&#8221;),<br />
   :log_file      =&gt; File.join(Dir.tmpdir, &#8220;ramaze.pids/ramaze_app.log&#8221;),<br />
   :timeout       =&gt; 25<br />
)</p>
<p>because it can&#8217;t access the lock dir.</p>
<p>But works if you put this in front of it:<br />
FileUtils.mkdir_p(File.join(Dir.tmpdir, &#8220;ramaze.pids&#8221;))</p>
<p>Otherwise working great for me!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gary Iams</title>
		<link>http://blog.phusion.nl/2008/08/25/daemon_controller-a-library-for-robust-daemon-management/comment-page-2/#comment-1067</link>
		<dc:creator>Gary Iams</dc:creator>
		<pubDate>Mon, 08 Sep 2008 21:50:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.phusion.nl/?p=43#comment-1067</guid>
		<description>Hi Hongli,

I&#039;m experiencing some heartache with daemon_controller and BackgrounDrb, and was wondering if you (and the rest of the readers) could lend me your eyes.  The situation is this: I&#039;m attempting to set BackgrounDrb up as an initializer for my project, and have it configured as follows:

config/backgroundrb.yml:
---
:backgroundrb:
  :ip: 0.0.0.0
  :port: 11111
  :debug_log: true
  :log: foreground  # log to console

intializers/backgroundrb.rb:
BACKGROUNDRB_PORT = 11111

backgroundrb = DaemonController.new(
  :identifier =&gt; &#039;BackgrounDrb job server/scheduler&#039;,
  :start_command =&gt; &#039;script/backgroundrb start&#039;,
  :stop_command =&gt; &#039;script/backgroundrb stop&#039;,
  :ping_command =&gt; lambda { TCPSocket.new(&#039;localhost&#039;, BACKGROUNDRB_PORT) },
  :pid_file =&gt; &quot;tmp/pids/backgroundrb_#{BACKGROUNDRB_PORT}.pid&quot;,
  :log_file =&gt; &quot;log/backgroundrb_#{BACKGROUNDRB_PORT}.log&quot;,
  :log_file_activity_timeout =&gt; 20
)

backgroundrb.start unless backgroundrb.running?

When I attempt to fire up the web server, it bombs with the following backtrace:
** Starting Rails with development environment...
(wait 15 seconds)
Exiting
[...]/plugins/daemon_controller/lib/daemon_controller.rb:321:in `start_without_locking&#039;: Daemon &#039;BackgrounDrb job server/scheduler&#039; failed to start in time. (DaemonController::StartTimeout)
        from [...]/plugins/daemon_controller/lib/daemon_controller.rb:163:in `start&#039;
	from [...]/plugins/daemon_controller/lib/daemon_controller/lock_file.rb:34:in `exclusive_lock&#039;
	from [...]/plugins/daemon_controller/lib/daemon_controller/lock_file.rb:29:in `open&#039;
	from [...]/plugins/daemon_controller/lib/daemon_controller/lock_file.rb:29:in `exclusive_lock&#039;
	from [...]/plugins/daemon_controller/lib/daemon_controller.rb:162:in `start&#039;
	from [...]/config/initializers/backgroundrb.rb:14

There are two oddities that I noticed while trying to get to the root cause of this problem:
1) The ruby process for the BackgrounDrb daemon starts the same way I would normally run it by hand, save for the timeout.  With the exception originating in file locking territory, this makes me think BackgrounDrb is causing the issue, yet I know that version 1.0.4 requires no args other that &#039;start&#039; to start it.
2) If I start BackgrounDrb manually from a console, and then load its DaemonController declaration into an irb session, I can stop/start it as one would expect.


Thanks for a great daemon management solution,
--
-gary</description>
		<content:encoded><![CDATA[<p>Hi Hongli,</p>
<p>I&#8217;m experiencing some heartache with daemon_controller and BackgrounDrb, and was wondering if you (and the rest of the readers) could lend me your eyes.  The situation is this: I&#8217;m attempting to set BackgrounDrb up as an initializer for my project, and have it configured as follows:</p>
<p>config/backgroundrb.yml:<br />
&#8212;<br />
:backgroundrb:<br />
  :ip: 0.0.0.0<br />
  :port: 11111<br />
  :debug_log: true<br />
  :log: foreground  # log to console</p>
<p>intializers/backgroundrb.rb:<br />
BACKGROUNDRB_PORT = 11111</p>
<p>backgroundrb = DaemonController.new(<br />
  :identifier =&gt; &#8216;BackgrounDrb job server/scheduler&#8217;,<br />
  :start_command =&gt; &#8217;script/backgroundrb start&#8217;,<br />
  :stop_command =&gt; &#8217;script/backgroundrb stop&#8217;,<br />
  :ping_command =&gt; lambda { TCPSocket.new(&#8216;localhost&#8217;, BACKGROUNDRB_PORT) },<br />
  :pid_file =&gt; &#8220;tmp/pids/backgroundrb_#{BACKGROUNDRB_PORT}.pid&#8221;,<br />
  :log_file =&gt; &#8220;log/backgroundrb_#{BACKGROUNDRB_PORT}.log&#8221;,<br />
  :log_file_activity_timeout =&gt; 20<br />
)</p>
<p>backgroundrb.start unless backgroundrb.running?</p>
<p>When I attempt to fire up the web server, it bombs with the following backtrace:<br />
** Starting Rails with development environment&#8230;<br />
(wait 15 seconds)<br />
Exiting<br />
[...]/plugins/daemon_controller/lib/daemon_controller.rb:321:in `start_without_locking&#8217;: Daemon &#8216;BackgrounDrb job server/scheduler&#8217; failed to start in time. (DaemonController::StartTimeout)<br />
        from [...]/plugins/daemon_controller/lib/daemon_controller.rb:163:in `start&#8217;<br />
	from [...]/plugins/daemon_controller/lib/daemon_controller/lock_file.rb:34:in `exclusive_lock&#8217;<br />
	from [...]/plugins/daemon_controller/lib/daemon_controller/lock_file.rb:29:in `open&#8217;<br />
	from [...]/plugins/daemon_controller/lib/daemon_controller/lock_file.rb:29:in `exclusive_lock&#8217;<br />
	from [...]/plugins/daemon_controller/lib/daemon_controller.rb:162:in `start&#8217;<br />
	from [...]/config/initializers/backgroundrb.rb:14</p>
<p>There are two oddities that I noticed while trying to get to the root cause of this problem:<br />
1) The ruby process for the BackgrounDrb daemon starts the same way I would normally run it by hand, save for the timeout.  With the exception originating in file locking territory, this makes me think BackgrounDrb is causing the issue, yet I know that version 1.0.4 requires no args other that &#8217;start&#8217; to start it.<br />
2) If I start BackgrounDrb manually from a console, and then load its DaemonController declaration into an irb session, I can stop/start it as one would expect.</p>
<p>Thanks for a great daemon management solution,<br />
&#8211;<br />
-gary</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: เร็วส์ หกสิบหก &#187; Blog Archive &#187; นั่งเทียนเขียนข่าว#1</title>
		<link>http://blog.phusion.nl/2008/08/25/daemon_controller-a-library-for-robust-daemon-management/comment-page-1/#comment-974</link>
		<dc:creator>เร็วส์ หกสิบหก &#187; Blog Archive &#187; นั่งเทียนเขียนข่าว#1</dc:creator>
		<pubDate>Fri, 05 Sep 2008 19:06:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.phusion.nl/?p=43#comment-974</guid>
		<description>[...] daemon_controller: a library for robust daemon management [...]</description>
		<content:encoded><![CDATA[<p>[...] daemon_controller: a library for robust daemon management [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hongli</title>
		<link>http://blog.phusion.nl/2008/08/25/daemon_controller-a-library-for-robust-daemon-management/comment-page-1/#comment-968</link>
		<dc:creator>hongli</dc:creator>
		<pubDate>Fri, 05 Sep 2008 17:33:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.phusion.nl/?p=43#comment-968</guid>
		<description>We consider daemon_controller production-ready. We just haven&#039;t had the chance to write a proper website for it, or to register a RubyForge project.</description>
		<content:encoded><![CDATA[<p>We consider daemon_controller production-ready. We just haven&#8217;t had the chance to write a proper website for it, or to register a RubyForge project.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Pugh</title>
		<link>http://blog.phusion.nl/2008/08/25/daemon_controller-a-library-for-robust-daemon-management/comment-page-1/#comment-966</link>
		<dc:creator>Eric Pugh</dc:creator>
		<pubDate>Fri, 05 Sep 2008 15:57:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.phusion.nl/?p=43#comment-966</guid>
		<description>Are you planning on pushing a gem out for this, or is this considered too raw yet for that?  Seems like it could really simplify deployment issues that we face when you step beyond just a basic Mongrel + Database!</description>
		<content:encoded><![CDATA[<p>Are you planning on pushing a gem out for this, or is this considered too raw yet for that?  Seems like it could really simplify deployment issues that we face when you step beyond just a basic Mongrel + Database!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: daemon_controller memcached configuration &#171; Gem Install That</title>
		<link>http://blog.phusion.nl/2008/08/25/daemon_controller-a-library-for-robust-daemon-management/comment-page-1/#comment-930</link>
		<dc:creator>daemon_controller memcached configuration &#171; Gem Install That</dc:creator>
		<pubDate>Thu, 04 Sep 2008 18:59:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.phusion.nl/?p=43#comment-930</guid>
		<description>[...] &amp; Gems, Rails, Ruby, configuration.  trackback  The Phusion guys created a sweeet library (daemon_controller) to control servers or daemons. I created a daemon_memcache class which controls [...]</description>
		<content:encoded><![CDATA[<p>[...] &amp; Gems, Rails, Ruby, configuration.  trackback  The Phusion guys created a sweeet library (daemon_controller) to control servers or daemons. I created a daemon_memcache class which controls [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hongli</title>
		<link>http://blog.phusion.nl/2008/08/25/daemon_controller-a-library-for-robust-daemon-management/comment-page-1/#comment-733</link>
		<dc:creator>hongli</dc:creator>
		<pubDate>Fri, 29 Aug 2008 16:31:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.phusion.nl/?p=43#comment-733</guid>
		<description>Yes, you can trap any signal. SIGABRT is reserved for aborting with a backtrace, and SIGQUIT in the development version is reserved for showing the backtrace without aborting. Though things will continue to work fine if you override those signals.</description>
		<content:encoded><![CDATA[<p>Yes, you can trap any signal. SIGABRT is reserved for aborting with a backtrace, and SIGQUIT in the development version is reserved for showing the backtrace without aborting. Though things will continue to work fine if you override those signals.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Saimon Moore</title>
		<link>http://blog.phusion.nl/2008/08/25/daemon_controller-a-library-for-robust-daemon-management/comment-page-1/#comment-731</link>
		<dc:creator>Saimon Moore</dc:creator>
		<pubDate>Fri, 29 Aug 2008 14:22:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.phusion.nl/?p=43#comment-731</guid>
		<description>In my case, practically all of my daemons are running a single instance of my rails app so whenever my app code changes they need restarting if I&#039;m testing them. So for dev mode I can work with this solution using mongrel.


For production, then yes, I&#039;ll be using god for handling the daemons.

Does passenger support trapping of any signals? (i.e. could I trap a USR1/2 signal to restart the daemons?)</description>
		<content:encoded><![CDATA[<p>In my case, practically all of my daemons are running a single instance of my rails app so whenever my app code changes they need restarting if I&#8217;m testing them. So for dev mode I can work with this solution using mongrel.</p>
<p>For production, then yes, I&#8217;ll be using god for handling the daemons.</p>
<p>Does passenger support trapping of any signals? (i.e. could I trap a USR1/2 signal to restart the daemons?)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hongli</title>
		<link>http://blog.phusion.nl/2008/08/25/daemon_controller-a-library-for-robust-daemon-management/comment-page-1/#comment-729</link>
		<dc:creator>hongli</dc:creator>
		<pubDate>Fri, 29 Aug 2008 12:37:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.phusion.nl/?p=43#comment-729</guid>
		<description>Yeah that seems right, though it won&#039;t work on Phusion Passenger because in Phusion Passenger, at_exit hooks are never called. If you&#039;re on an environment where the pool of Rails processes is dynamic (e.g. Glassfish, or in the hypothetical case where Phusion Passenger does support at_exit) then the daemon may be shut down prematurely. It&#039;ll be started by the next connect attempt, but it may cause a slight delay for your users. Because of this I&#039;m tempted to keep my daemons running, they usually don&#039;t use a lot of memory anyway.

Yeah, I&#039;m on IRC from time to time. My nick is FooBarWidget, irc.freenode.net. Usually in #passenger, #rails-contrib or #rubyonrails.</description>
		<content:encoded><![CDATA[<p>Yeah that seems right, though it won&#8217;t work on Phusion Passenger because in Phusion Passenger, at_exit hooks are never called. If you&#8217;re on an environment where the pool of Rails processes is dynamic (e.g. Glassfish, or in the hypothetical case where Phusion Passenger does support at_exit) then the daemon may be shut down prematurely. It&#8217;ll be started by the next connect attempt, but it may cause a slight delay for your users. Because of this I&#8217;m tempted to keep my daemons running, they usually don&#8217;t use a lot of memory anyway.</p>
<p>Yeah, I&#8217;m on IRC from time to time. My nick is FooBarWidget, irc.freenode.net. Usually in #passenger, #rails-contrib or #rubyonrails.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
