capistrano 多机部署

Posted by wxianfeng Thu, 12 Apr 2012 03:39:00 GMT

核心使用 task 指令 实现多机部署

# encoding:utf-8
# >cap local deploy
# >cap remote deploy

set :application, "entos"
set :deploy_to, "/data/projects/entos"

set :scm, "git"
set :repository,  "git@114.255.155.167:entos.git"
set :branch, "master"
set :use_sudo, false
set :rails_env,"production"

task :remote do
  set :user, "entsea"
  set :deploy_via, :remote_cache
  set :copy_exclude, %w(external)
  server "114.255.155.166", :web, :app, :db, :primary => true
end

task :local do
  set :user, 'zzq'
  set :deploy_via, :remote_cache
  set :copy_exclude, %w(external)
  server '192.168.10.105', :web, :app, :db, :primary => true
end

namespace :deploy do
  task :start do; end
  task :stop do; end

  desc "Creating ln -s , example: database.yml"
  task :create_sync do
    run "ln -s #{shared_path}/config/database.yml #{current_path}/config/database.yml"
  end

  desc "Restarting unicorn"
  task :restart, :roles => :app, :except => { :no_release => true } do
    # run "/bin/sh restart_server.sh"
  end
end

after "deploy:symlink", "deploy:create_sync"

This entry was posted on Thu, 12 Apr 2012 03:39:00 GMT and Posted in , , . You can follow any any response to this entry through the Atom feed. You can leave a comment or a trackback from your own site.

Tags , ,


Trackbacks

Use the following link to trackback from your own site:
http://blog.wxianfeng.com/trackbacks?article_id=232

Comments

  1. Avatar
    Passenger ships Ancona Patras almost {{count}} years ago:

    I savor, cauuse I found exactly what I was having a look for.
    You’ve ended my four day lengthy hunt! God Bless you man.
    Have a great day. Bye

  2. Avatar
    Passenger ships Ancona Patras almost {{count}} years ago:

    I savor, cause I found exactly whqt I was having a look for.
    You’ve ended my four day lengthy hunt! God Blsss you man.
    Have a great day. Bye

  3. Avatar
    http://27.124.27.101 about {{count}} years ago:

    Heⅼlo ᴠery nice site!! Guy .. Beautiful ..
    Wonderful .. Ӏ’ll bookmark уouг site and tаke thе feeds alsо?
    I аm satiszfied to search ߋut a lοt of elpful informati᧐n right here ԝithin the publish, ԝe wаnt develop extra techniques іn thiѕ regard,
    tһank yoou fߋr sharing. . . . . .

  4. Avatar
    http://27.124.27.101 about {{count}} years ago:

    Helplo very nice site!! Guy .. Beautiful .. Wonderful ..

    I’ll bookmark үoսr site and take the feeds aⅼso? І am satisfied to search out a
    lott of helpfull іnformation rіght heгe ѡithin tһe publish, we want develop extra techniques іn this regard, thank you fⲟr
    sharing. . . . . .

Leave a comment