Capistrano 2.0, What Happened to My Mongrel Recipes?

Did you upgrade to Capistrano 2.0 only to find your Mongrel cluster recipes aren’t working?

Bleh… same here.

Turns out you need to namespace your Mongrel cluster recipes to “deploy”.

Apply this patch and you should be good to go:

1
2
3
cd $GEMPATH/mongrel_cluster-0.2.1/lib/mongrel_cluster/
wget http://scie.nti.st/dist/mongrel_cluster_recipes.rb.diff
patch -p0 < mongrel_cluster_recipes.rb.diff
Change path as needed.

Here’s the patch for reference:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
--- recipes.rb.orig     2007-09-03 17:37:28.000000000 -0700
+++ recipes.rb  2007-09-03 17:37:48.000000000 -0700
@@ -1,3 +1,6 @@
+# This is the stock mongrel_cluster/recipes files except adapted for
+# Capistrano 2.0.  We must namespace each task to "deploy".
+
 Capistrano.configuration(:must_exist).load do
   set :mongrel_servers, 2
   set :mongrel_port, 8000
@@ -8,6 +11,8 @@
   set :mongrel_group, nil
   set :mongrel_prefix, nil

+  namespace :deploy do
+
   desc <<-DESC
   Configure Mongrel processes on the app server. This uses the :use_sudo
   variable to determine whether to use sudo or not. By default, :use_sudo is
@@ -72,9 +77,11 @@
   task :spinner, :roles => :app do
     start_mongrel_cluster
   end
+
+  end

   def set_mongrel_conf
     set :mongrel_conf, "/etc/mongrel_cluster/#{application}.yml" unless mongrel_conf
   end

-end
\ No newline at end of file
+end

Comments