23t*_*tux 4 capistrano ruby-on-rails bundler rvm ruby-on-rails-3
我有一个Ruby on Rails 3.2应用程序,使用bundler和capistrano进行部署.我的服务器是带有rvm和ruby 1.9.2的Debian Squeeze.我为capistrano(http://beginrescueend.com/integration/capistrano/)阅读了rvm的东西,你可以在其中设置gemset set :rvm_ruby_string, '1.9.2@my_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"
Run Code Online (Sandbox Code Playgroud)
我可以在哪里更改--path /var/www/...使用1.9.2@my_gemsetrvm中的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, "gitosis@mydomain.org: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
Run Code Online (Sandbox Code Playgroud)
在config/deploy/staging.rb中
set :rails_env, "staging"
set :rvm_ruby_string, '1.9.2@my_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
Run Code Online (Sandbox Code Playgroud)
也许有人可以帮助我.
capistrano-bundler 1.1.2允许您从bundler参数中删除--path标志,并将gem安装到指定的gemset.
我的配置到底是什么样的:
set :rvm_type, :system
set :rvm_ruby_version, "2.0.0-p353@#{fetch(:application)}"
set :bundle_path, nil
set :bundle_binstubs, nil
set :bundle_flags, '--system'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5221 次 |
| 最近记录: |