Capistrano: Bundler does not use rvm gemset

I have a Ruby on Rails 3.2 application using bundler and capistrano for deployment. My server is Debian Squeeze with rvm and ruby ​​1.9.2. I read the rvm material for capistrano (http://beginrescueend.com/integration/capistrano/), where you can set the gemset to set :rvm_ruby_string, ' 1.9.2@my _gemset' .

But during deployment, the binder writes each stone to /var/www/my_app/shared/bundle . I thought that if I define rvm_ruby_string with the @ sign, the binder will use the gemset.

The deployment says that

  * 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" 

Where can I change --path /var/www/... to use gemset 1.9.2@my _gemset from rvm?

Maybe this is because I use several deployment environments (production, production ...). So here is my 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 

And in 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 

Maybe someone can help me.

+4
source share
2 answers

Both of you use package integration and rvm. Rvm will make sure that it uses the correct ruby ​​(convenient for managing rubies), the binder will separate all the gems into the shared / bundle directory. This is the default setting for the provider. I believe this is a good way to fix this, also because it works with the passenger out of the box, separates gems from each application and has rvm processing rubies.

If you really want to use RVM to separate gems, it is best to start with this Darcy blogpost (this applies to the passenger). As you can see, there is some effort in this work, but it is possible.

+5
source

capistrano-bundler 1.1.2 allows you to remove the -path flag from bundle arguments and set gems to the specified gemset.

In the end, my configurator looks like this:

 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' 
+7
source

Source: https://habr.com/ru/post/1396861/


All Articles