jump to navigation

Scrape mongrel status from Apache’s mod_proxy_balancer January 4, 2008

Posted by John Dewey in Apache, Capistrano, Code, Command Line, Configuration, Example, Rails, Rake, WebServers.
1 comment so far

Access to Apache’s load balancer manager (mod_proxy_balancer) is typically protected.  Rather than maintaining an ever changing list of ACLs or configuring HTTP authentication, I wrote a simple scraper Rake task.

This task is bundled with all of our rails applications as a svn external, and included in our common Capistrano tasks.This task is a quick and dirty solution to checking the status of your Mongrels.

Feel free to modify, and provide a pastie.http://pastie.caboo.se/135223

P.S. The SAs can plug this into their monitoring software as well.

Track which mongrel handled a request December 26, 2007

Posted by John Dewey in Code, Configuration, Example, Mongrel, Rails, WebServers.
add a comment

I wrote a plugin which collects system information, and returns the data as HTML comments at the bottom of the page. When running multi-system / multi-Mongrel environments, knowing which server and Mongrel handled a request is paramount.

Unfortunately, getting a handle on this information is difficult, since ‘request.port’, ‘request.env[‘HTTP_HOST’], and ‘request.env[‘SERVER_PORT’], display the origin port, when your Mongrels are behind a reverse proxy.

Ezra clued me into a nice hack.You can add the following code to environment.rb, or in our case the plugin’s init.rb.

Apache mod_rewrite maintenance.html woes December 15, 2007

Posted by John Dewey in Apache, Configuration, Rails, WebServers.
add a comment

Every self.respecting Rails site, has a configuring Rails with Apache section.

The recipe contains a mod_rewrite rule, allowing staff to dynamically enable or disable maintenance mode. The mod_rewrite rule, however, does not work on Solaris, OS X or systems with a ‘/system’ directory.

I have notified the Pragmatic Studio folks, and Charles (who wrote the documentation hosted at http://mongrel.rubyforge.org/).  Below are further details of the problem, along with a solution.  Hopefully the word gets out.

Rails environment file “inheritance” December 15, 2007

Posted by John Dewey in Code, Configuration, Example, Rails.

Wouldn’t it be nice if  Rails could inherit behavior from a given environment file? Here is a DRY approach when adding new environments:

Add the following to your new environment file:

eval File.read("#{RAILS_ROOT}/..../production.rb")