24

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.

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Adrian
  • 734
  • 1
  • 5
  • 14
  • 3
    Resolved. I just got rid if RVM. Works great now. I'll save RVM for my development machine... – Adrian Mar 10 '11 at 09:13

3 Answers3

78

Next time try to add this in your capistrano:

set :rvm_type, :system
mpapis
  • 52,729
  • 14
  • 121
  • 158
  • 12
    Very helpful. Alternatively you can set :rvm_type to :user if you are deploying to a server with a single-user rvm install. – Casey Watson Jul 19 '11 at 18:38
  • @mpapis how do you know if you have a single-user rvm install or system install? I don't remember which one I did. – JohnMerlino May 10 '13 at 20:56
  • you can check after logging in to server and running `echo $rvm_path` – mpapis May 10 '13 at 21:01
  • @mpapis what exactly does this command do? It says "use_sudo is set to 'false' but sudo is needed to install rvm_type: system", but im not sure of consequences of rvm_type: system – JohnMerlino May 13 '13 at 19:09
  • Now if I already have RVM installed in /usr/local, multiuser installation, why do I need to add this to deploy.rb for every deploy? – JohnMerlino May 13 '13 at 19:12
  • `/usr/local` corresponds to `:system` installation, the default changed long time ago to be `:user` installation so you need to tell the script to use `:system` - because that is your type of installation. – mpapis May 13 '13 at 19:16
  • I'm still not seeing the connection between rvm and capistrano. When you have a moment, can you take a look at this question: http://stackoverflow.com/questions/16549477/capistrano-and-managing-rvm-patch-levels-and-ruby-versions thanks – JohnMerlino May 14 '13 at 17:41
5

It seems like rvm-shell is not in your rvm install directory. Run this command

rvm get head

Then you'll get it right in your rvm bin directory.

imonyse
  • 151
  • 2
  • 3
0

I just wanted to add to @imonyse's comment.

the head branch of rvm might be a tad too unstable for some deploys. I know our deprecated SLES boxes have a tendency to choke on it. It might be advisable to get the most recent stable version.

rvm get stable

Also don't do this on a really old server running production code as it may have undesired consequences.

engineerDave
  • 3,887
  • 26
  • 28