user3185333
user3185333

Reputation: 47

Rails app with passenger and capistrano picking wrong gemset

I am trying to deploy rails app with Capistrano. App is deployed, bundle install is run in
~/.rvm/bin/rvm default do bundle install --path /home/pro/www/shared/bundle --without development test --deployment --quiet

But when I run the app, its using default gemset and not the gems from shared/bundled. I am getting following error

Message from application: <p>It looks like Bundler could not find a gem. Maybe you didn't install all the gems that this application needs. To install your gems, please run:</p>


Could not find rake-11.2.2 in any of the sources (Bundler::GemNotFound)

<pre>  /home/pro/.rvm/gems/ruby-2.3.1@gemset/gems/bundler-1.12.5/lib/bundler/spec_set.rb:95:in `block in materialize&#39;

I am not understanding the problem here. MY deploy.rb file has:

set :application, 'rails_a[['
set :repo_url, '[email protected]:user/app.git'
# set :rvm_ruby_version, 'ruby-2.3.1@gemset'

set :stages, %w(production) set :deploy_to, '/home/pro/www'

Upvotes: 1

Views: 429

Answers (2)

Divya Sharma
Divya Sharma

Reputation: 556

Capistrano and RVM

[ruby]
$:.unshift(File.expand_path(‘./lib’, ENV['rvm_path']))
require "rvm/capistrano"
set :rvm_ruby_string, ‘[email protected]′
set :rvm_type, :user
[/ruby]

Here @rails3.2 is gemset. when capistrano will invoke bundle install it will take this gemset. so You need to set rvm_ruby_string

Upvotes: 0

Minato
Minato

Reputation: 4533

The problem might be with your configuration. Since rvm sets the $GEM_HOME env variable according to the ruby version, and bundler defaults it's path(i.e. BUNDLE_PATH) to $GEM_HOME (in development at least). You can override this in bundler config.

Inside your application directory.

bundle config --local path /home/pro/www/shared/bundle

The local flag will keep the changes specific to your Application, you should also remove .bundle from your .gitignore to push your bundle configs to your deployment server.

Have a look at the bundle config documentation.

This is also a nice blog post.

Upvotes: 0

Related Questions