I have a Rails application configured to deploy via Capistrano and RVM. When I run a cap my_stage deploy (this applies for all my stages), Capistrano bundle installs to /var/www/my_app/shared/bundle, even though I have specified in my config/deploy.rb file that I want it to use the 1.9.2@my_app gemset.
This is contrary to my expectations - I expect Capistrano to deploy into my user's home directory: ~/.rvm/gems/ruby-1.9.2-p290@my_gemset/gems.
Am I doing something wrong? Or is this expected behaviour.
Here is my deploy file:
require 'capistrano/ext/multistage'
require 'bundler/capistrano'
set :stages, %w(local development staging production)
set :default_stage, "local"
set :application, "My Rails App"
set :repository, "[email protected]:MyApp/my_app.git"
set :scm, :git
set :deploy_to, "/var/www/my_app"
set :use_sudo, false
ssh_options[:keys] = [File.join(ENV["HOME"], ".ssh", "my_key.pem")]
# RVM
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require 'rvm/capistrano'
set :rvm_ruby_string, '1.9.2@my_app'
set :rvm_type, :user
set :user, 'my_user'
Here is my .rvmrc file in my Rails app:
rvm_trust_rvmrc_flags=1
rvm use 1.9.2@my_app
Thanks, Max
rake db:migratefrom the deployment directory because RVM was looking for gems in~/.rvm/..., but Capistrano had installed them to<deployment_root>/shared/bundle. I worked around this by runningbundle exec rake db:migrate, which first loads Bundle options from<deployment_root>/.bundle/config. However, I would still like an explanation of this behavior. - maxenglander