我只使用一個文件:config/deploy.rb
與多個任務。如果您不使用它,請忽略RVM業務。就像這樣:
task :staging do
set :rails_env, 'staging'
role :app, "staging.example.com"
role :web, "staging.example.com"
role :db, "staging.example.com", :primary => true
end
task :production do
set :rails_env, 'production'
set :branch, 'master'
# RVM integration as specified at https://rvm.beginrescueend.com/integration/capistrano/
$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # Add RVM's lib directory to the load path.
require "rvm/capistrano"
set :rvm_ruby_string, '[email protected]'
set :rvm_type, :user
role :app, "prod.example.com"
role :web, "prod.example.com"
role :db, "prod.example.com", :primary => true
end
然後部署具有cap staging deploy
和cap production deploy
。
這是更好的方法,但我不能讓它工作 但在命令行中,我得到以下 '$帽生產部署:安裝 *執行'生產「 觸發開始回調'部署:安裝」 *執行'多級:確保' 沒有指定階段。請指定以下其中一項:生產,審查,分期(例如'cap production deploy:setup') $ cap staging deploy:setup *正在執行'staging' 觸發'deploy:setup'的啓動回調* *正在執行'multistage:ensure ' 沒有指定階段。請指定以下其中一項:製作,審覈,分期(例如'cap production deploy:setup')' – 2012-03-13 11:40:15