我有一個使用bundler和capistrano進行部署的Ruby on Rails 3.2應用程序。我的服務器是rvm和ruby 1.9.2的Debian Squeeze。我讀了capistrano的rvm資料(http://beginrescueend.com/integration/capistrano/),您可以在這裏設置格式爲set :rvm_ruby_string, '[email protected]_gemset'
。Capistrano:Bundler不使用rvm gemset
但是在部署過程中,bundler會將每個gem寫入/var/www/my_app/shared/bundle
。我想如果我用@符號定義rvm_ruby_string,bundler會使用gemset。
從部署的輸出稱
* executing "cd /var/www/my_app/releases/20120216145728 && bundle install --gemfile /var/www/my_app/releases/20120216145728/Gemfile --path /var/www/my_app/shared/bundle --deployment --quiet --without development test"
我在哪裏可以改變--path /var/www/...
使用來自RVM的[email protected]_gemset
寶石?
也許是因爲我正在使用多個環境進行部署(分段,生產......)。因此,這裏是我的deploy.rb
# RVM bootstrap
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require 'capistrano/ext/multistage'
require 'bundler/capistrano'
require 'rvm/capistrano'
set :rvm_bin_path, "/usr/local/rvm/bin"
set :rvm_type, :system
set :stages, %w(production staging)
set :default_stage, "staging"
set :application, "my_app"
set :repository, "[email protected]:my_app.git"
set :scm, :git
set :user, "my_deploy_user"
set :use_sudo, false
set :ssh_options, { :forward_agent => true }
default_run_options[:pty] = true
namespace :deploy do
task :start do
end
task :stop do
end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
而且在配置/部署/ staging.rb
set :rails_env, "staging"
set :rvm_ruby_string, '[email protected]_gemset'
set :deploy_to, "/var/www/my_app"
role :web, "stage.mydomain.de" # Your HTTP server, Apache/etc
role :app, "stage.mydomain.de" # This may be the same as your `Web` server
role :db, "stage.mydomain.de", :primary => true # This is where Rails migrations will run
也許有人可以幫助我。
我看到你的下方標示正確的答案。你有什麼解決方案? DId你只是使用共享/捆綁而不是rvm gemset? – Donato 2015-06-18 03:13:29