欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Capistrano试用 博客分类: Ruby capistranoSSHSVNWebUP 

程序员文章站 2024-02-22 16:50:04
...
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