I got the Mongrel recipes from somewhere else -- I sadly don't remember where -- and modified them a bit.
1
2 namespace :deploy do
3 namespace :mongrel do
4 [ :stop, :start, :restart ].each do |t|
5 desc "#{t.to_s.capitalize} the mongrel appserver"
6 task t, :roles => :app do
7 run "mongrel_rails cluster::#{t.to_s} --clean -C #{mongrel_conf}"
8 end
9 end
10 end
11
12 namespace :apache do
13 desc "Start Apache"
14 task :start, :roles => :web do
15 sudo "/etc/init.d/httpd start > /dev/null"
16 end
17
18 desc "Stop Apache"
19 task :stop, :roles => :web do
20 sudo "/etc/init.d/httpd stop > /dev/null"
21 end
22
23 desc "Restart Apache"
24 task :restart, :roles => :web do
25 sudo "/etc/init.d/httpd restart > /dev/null"
26 end
27 end
28
29 desc "Custom restart task for mongrel cluster"
30 task :restart do
31 deploy.mongrel.restart
32 deploy.apache.restart
33 end
34
35 desc "Custom start task for mongrel cluster"
36 task :start, :roles => :app do
37 deploy.mongrel.start
38 deploy.apache.start
39 end
40
41 desc "Custom stop task for mongrel cluster"
42 task :stop, :roles => :app do
43 deploy.apache.stop
44 deploy.mongrel.stop
45 end
46
47 end