# \[ANN\] mongrel\_cluster-0.1.1: the bird dog (capistrano suppor

**URL:** <https://www.ruby-forum.com/t/ann-mongrel-cluster-0-1-1-the-bird-dog-capistrano-suppor/59326>\
**Category:** Rails\
**Created:** [May 3, 2006, 6:57pm UTC](https://www.ruby-forum.com/t/ann-mongrel-cluster-0-1-1-the-bird-dog-capistrano-suppor/59326 "2006-05-03T18:57:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bktaylor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e95f7d/32.png) [@bktaylor](https://www.ruby-forum.com/u/bktaylor)\
**Post date:** [May 3, 2006, 6:57pm UTC](https://www.ruby-forum.com/t/ann-mongrel-cluster-0-1-1-the-bird-dog-capistrano-suppor/59326/1 "2006-05-03T18:57:20Z")

</div>

Hey y’all:

mongrel\_cluster provides management tools for running Mongrel behind  
a reverse-proxy/load balancer. It is an extraction from Rails  
Machine, a deployment service and Ruby library that simplifies Rails  
application deployment. This release fixes bugs and adds a Capistrano  
task library.

Changes:  
-changed pid file format to include port  
-only write configuration options that are explicitly specified or  
required.  
-removed some validation rules and delegate to mongrel\_rails.  
-added Capistrano task library.

Please rerun mongrel\_rails cluster::configure to ensure smooth  
operation.

_ **Capistrano Recipe** _

Add to config/deploy.rb:  
require ‘mongrel\_cluster/recipes’

Example usage:  
cap -a configure\_mongrel\_cluster

Variables  
mongrel\_servers: Number of Mongrel servers to start.  
mongrel\_port: Starting port to bind to.  
mongrel\_address: Address to bind to.  
mongrel\_environment: Rails environment to run as.  
mongrel\_config: Path to config file.  
use\_sudo: Whether or not tasks that can use sudo, ought to use sudo.  
Capistrano defaults to true.

Tasks (performed on :app role)  
configure\_mongrel\_cluster: Configure the cluster with variables. Uses  
sudo if use\_sudo is true.  
start\_mongrel\_cluster: Start Mongrel processes on the app server.  
Uses sudo if use\_sudo is true.  
stop\_mongrel\_cluster: Stop the Mongrel processes on the app server.  
Uses sudo if use\_sudo is true.  
restart\_mongrel\_cluster: Restart the Mongrel processes on the app  
server. Uses sudo if use\_sudo is true.  
restart: Calls restart\_mongrel\_cluster to allow Mongrel to be used  
with the standard Capistrano deploy task.  
spinner: Calls start\_mongrel\_cluster to allow Mongrel to be used with  
the standard Capistrano cold\_deploy task.

Good luck and let me know how it works for ya!

## Thanks, Bradley Taylor

Rails Machine  
Simplified web application deployment  
[http://railsmachine.com](http://railsmachine.com)

---

<div class="post-metadata">

**Author:** ![bktaylor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e95f7d/32.png) [@bktaylor](https://www.ruby-forum.com/u/bktaylor)\
**Post date:** [May 4, 2006, 4:56pm UTC](https://www.ruby-forum.com/t/ann-mongrel-cluster-0-1-1-the-bird-dog-capistrano-suppor/59326/2 "2006-05-04T16:56:39Z")

</div>

Uff, I got lost. I had mongrel\_cluster 0.1working fine, even with  
capistrano  
(my own hack). Then came mongrel\_cluster 0.1.1 and I tried to set it  
up,  
but somehow I messed up things and nothing worked anymore. So here what  
I  
did:

## on production machine: (debian linux, rails 1.1)

- installing mongrel\_cluster 0.1.1

## on development machine\*\*: (windows XP, raills 1.1)

- inststalling mongrel\_cluster 0.1.1

- recreating config file: mongrel\_rails cluster::configure

- modifying configfile manually to make it look like this: (will be more  
the  
one server later)

* * *

num-procs: 1024  
docroot: public  
timeout: 120  
cwd: /home/me/sites/myapp/current  
log\_file: log/mongrel.log  
port: 3000  
config\_script:  
debug: false  
environment: production  
servers: 1  
pid\_file: log/mongrel.pid  
address: 0.0.0.0  
mime\_map:

- deploy.rb: commented out my old restart and spinner tasks and added:  
require ‘mongrel\_cluster/recipes’

- deployment: rake deploy (fails because config file is at:  
/home/me/sites/myapp/current/config/mongrel\_cluster.yml)  
…  
executing “mongrel\_rails cluster::restart -C  
/home/me/sites/myapp/config/mongrel\_cluster.yml”  
…

then I thought I could give “cap -a configure\_mongrel\_cluster” a try,  
hoping  
it would put things into the right order, but I got this:

\*\* [out :: xx.xx.xx.xx] !!! Path to log file not valid: log/mongrel.log  
\*\* [out :: xx.xx.xx.xx] cluster::configure reported an error. Use -h to  
get  
help.

So what is wrong with the way I approached capistrano mongrel\_cluster  
?

regards  
Roberto

---

<div class="post-metadata">

**Author:** ![bktaylor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e95f7d/32.png) [@bktaylor](https://www.ruby-forum.com/u/bktaylor)\
**Post date:** [May 8, 2006, 9:52am UTC](https://www.ruby-forum.com/t/ann-mongrel-cluster-0-1-1-the-bird-dog-capistrano-suppor/59326/3 "2006-05-08T09:52:46Z")

</div>

bradley taylor wrote:

> Hey y’all:  
> mongrel\_cluster provides management tools for running Mongrel behind  
> a reverse-proxy/load balancer. It is an extraction from Rails  
> Machine, a deployment service and Ruby library that simplifies Rails  
> application deployment. This release fixes bugs and adds a Capistrano  
> task library.
> 
> Good luck and let me know how it works for ya!

This has been VERY helpful, thanks! Two things have come to mind that  
might be helpful to include in a future release:

1. Parse the mongrel\_cluster.yml file through ERB, like Rails does for  
the fixtures and database.yml file. Would allow for things like setting  
the CWD to ENV[‘HOME’], etc. Rails uses:

2. Provide a cluster command for starting up “missing” Mongrel servers.  
The issue is that “restart” only restarts processes that are actually  
running. And just running “start” will do _bad_ things if you just run  
it; it appears to put a new pid into the .pid file, but then fail to  
start up (since a process is running already on that port) – the net  
effect is that the process is now orphaned, since you don’t know the pid  
anymore.

I guess I’m looking for something like the fcgi spinner, that can start  
up Mongrel processes if they die. And allow restarts to turn into a  
plain old start, if the target process isn’t found.
