使用Capistrano在Dreamhost上部署mod_rails
Posted by leeseon, Mon May 19 14:44:00 UTC 2008
虽然以前Capistrno 在windows下不能使用,但是自从2.0以后,其实就是可以使用的了。而且现在的2.3还加入了对git的支持。
而且从InfoQ 上得知Tom Copeland 已经使用Capistrano来更新mod_rails了,的确如它所说,只是给这个应用程序建立了一个“restart.txt”文件,就会导致Passenger Phusion/mod_rails重启这个应用程序。的确很简单明了不是吗?
最终的deploy.rb文件看起来会象下面这样
-
set :scm, :subversion
-
set :repository, "http://yoursvn/trunk"
-
set :svn_username, "svnuser"
-
set :svn_password, "svnpassword"
-
-
role :app, "www.yourdomain.com"
-
role :web, "www.yourdomain.com"
-
role :db, "www.yourdomain.com" , :primary => true
-
-
set :deploy_to, "/home/yourusername/"
-
set :user, "yourusername"
-
set :password, "yourpassword"
-
-
set :use_sudo, false
-
-
namespace :deploy do
-
desc "restarting mod_rails with restart.txt"
-
task :restart, :roles => :app, :except => { :no_release => true } do
-
run "touch #{current_path}/tmp/restart.txt"
-
end
-
-
[:start, :stop].each do |t|
-
desc "#{t} task is a no-op with mod_rails"
-
task t, :roles => :app do ; end
-
end
-
end

![my Atom 1.0 feed [Valid Atom 1.0]](/images/valid-atom.png)

