RVM error with deploying Rails app via Capistrano

Adrian picture Adrian · Mar 9, 2011 · Viewed 13.5k times · Source

History:

  • Read into Deploying Rails3 app to a Mediatemple DV server.
  • Installed RVM on the server, ruby, and essential gems.
  • Site works fine if I FTP it up.
  • All good.

I then decided to do a proper deployment and setup for GIT/cap deploy as per "Agile Web Development with Rails".

  • Attempted deploy with cap, but had errors with gems not available to the production site.
  • Read around and realised I should probably go for a system wide RVM install.
  • Removed all gems and RVM.
  • Installed RVM system wide.
  • Error on cap deploy "bash: /home/foo/.rvm/bin/rvm-shell: No such file or directory", which makes sense - there is no .rvm/ in the home directory.
  • Thinking something was hanging over from initially installing RVM to use as a user, I removed the user, deleting the home directory, and recreated the user with permissions.
  • Same error on cap deploy "bash: /home/foo/.rvm/bin/rvm-shell: No such file or directory"

The situation now is:

For foo, .bashrc contains the last line:

[[ -s '/usr/local/lib/rvm' ]] && source '/usr/local/lib/rvm'

When I issue:

type rvm | head -1

the response is "rvm is a function".

/etc/rvmrc contains

if [[ ! -s "$HOME/.rvm/scripts/rvm" ]]; then
  umask g+w
  export rvm_selfcontained=0
  export rvm_prefix="/usr/local/"
fi

Running out of ideas here, and hoping for some suggestions.

Answer

mpapis picture mpapis · Mar 16, 2011

Next time try to add this in your capistrano:

set :rvm_type, :system