`
hideto
  • 浏览: 2678071 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Capistrano试用

    博客分类:
  • Ruby
阅读更多
1,客户端机器安装Capistrano
gem install -y capistrano


2,应用到项目
cd D:\projects\beyondrails
capify .


3,修改config\deploy.rb
DEPLOY_PATH = "/var/www/vhosts/hideto/html/www.beyondrails.com"

set :application, "beyondrails"
set :repository, "https://beyondrails.googlecode.com/svn/trunk/beyondrails"
set :scm_username, "hideto.bj"
set :scm_password, "######"

set :deploy_to, DEPLOY_PATH
set :user, "hideto"
set :password, "######"
ssh_options[:port] = 2048

role :app, "120.72.34.135"
role :web, "120.72.34.135"
role :db,  "hideto", :primary => true


desc "Restart the web server for www.beyondrails.com"
task :restart, :roles => :app do
  run "cd ~;./restart-www.beyondrails.com.sh"
  quit
end

desc "Stop the web server for www.beyondrails.com"
task :stop, :roles => :app do
  run "cd ~;./stop-www.beyondrails.com.sh"
end

desc "Update and restart web server for www.beyondrails.com"
task :update_and_restart, :roles => :app do
  run "cd #{DEPLOY_PATH};svn up"
  run "cd #{DEPLOY_PATH};rake db:migrate"
  run "cd ~;./restart-www.beyondrails.com.sh"
end


4,调用task
cap update_and_restart
cap stop
cap restart
分享到:
评论
1 楼 hideto 2008-06-16  
需要注意的是必须在一条run命令中执行cd到某一目录,可能cap的实现就是一条run命令执行一次ssh连接,所以放在多条run命令下的话上下文就无法保持了

相关推荐

Global site tag (gtag.js) - Google Analytics