Question

$ bundle exec cap -S branch=master production deploy --dry-run
/Users/myname/.rvm/lib/rvm/capistrano.rb:5: RVM - Capistrano integration was extracted to a separate gem, install: `gem install rvm-capistrano` and remove the `$LOAD_PATH.unshift` line, note also the 'set :rvm_type, :user' is now the default (instead of :system). (RuntimeError)

That's what I get. Not sure what's going on. Thoughts?

EDIT my deploy.rb

# RVM is used for ruby 1.9.2 - this is so cap can see the rvm gemset.
$LOAD_PATH.unshift "lib", File.expand_path('./lib', ENV['rvm_path'])

set :stages, %w(sandbox qa production)
require 'capistrano/ext/multistage'
require 'bundler/capistrano'
require 'airbrake/capistrano'
require 'chef/capistrano'
require 'secure_files/capistrano'
require "rvm/capistrano"

set :rvm_ruby_string, '1.9.2'
set :rvm_bin_path, '/usr/local/rvm/bin'
set :user, "root"
set :scm, :git
set :repository,  "git@github.com:Myact/fbadapter.git"
set :deploy_to, '/var/www/fbadapter'
set :deploy_via, :remote_cache
set :rails_env, Proc.new {stage}
set :application, 'fbadapter'
set :default_environment, Proc.new { { 'RAILS_ENV' => stage } }
set :rake, "bundle exec rake --trace"
set :foreman_bin, 'bundle exec foreman'
set :rake, "#{foreman_bin} run rake"  
set :rails, "#{foreman_bin} run rails"
set :app_user, 'www-data'

set :bundle_without,  [:development, :test, :ops, :darwin]

# this must be set before foreman/capistrano is read
set :foreman_roles, [:app]
require "foreman/capistrano"

after 'multistage:ensure' do
 role_from_chef :db, 'app', :limit => 1, :primary => true # perform db operations on one of the app servers
 role_from_chef :web, 'app'
 role_from_chef :app
 role_from_chef :queue
 role_from_chef :cron
end


before 'deploy:symlink', 'deploy:assets:precompile', 'deploy:migrate'
after 'deploy:symlink', :set_application_permissions

after 'deploy', 'deploy:cleanup', 'campfire:deploy_stop'
after 'rollback', 'campfire:deploy_rollback'

desc 'Changes the permissions for the release path to be used with www-data'
task :set_application_permissions do
  run "chown -R #{app_user}:#{app_user} #{release_path}/*"
end

# These services are monitored by monit, but interacting with them that way
# is hugging-every-cat crazy. This means we're assuming two thin procs per
# app server; if that changes then remember to change this too.

namespace :deploy do
  task :stdout_logger do 
    run "cd #{release_path} && #{rails} plugin install https://github.com/ddollar/rails_log_stdout.git"
  end

  before 'deploy:symlink', 'deploy:stdout_logger'
end
Was it helpful?

Solution

Here is what I have in mine. These are the only lines I have to use the rvm-capistrano gem. I do the deploys as a non-sudo user too if that helps.

set :rvm_ruby_string, '<interpreter>@<gemset>'

# Load RVM's capistrano plugin.
require "rvm/capistrano"
set :rvm_path, "$HOME/.rvm"

Since you're running bundle exec, make sure rvm and rvm-capistrano gems are in your Gemfile. Also change the rvm_ruby_string below as suits your needs.

I'm fairly sure you need to remove this line too

LOAD_PATH.unshift "lib", File.expand_path('./lib', ENV['rvm_path'])

I also noticed you are using the "root" user to do the deploy. Fairly sure that's not going to work unless the rvm is installed for the root user. If you must use the root user I'd use an rvm wrapper if possible.

RVM Wrappers

Good luck!

OTHER TIPS

Can you post your new deploy.rb file? Also, confirm that rvm-capistrano gem really is installed?

Also, if you haven't add require "rvm/capistrano" to the top of your deploy.rb file. That is what is working for me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top