Which install method for rvm on production server?

Hi,

I read a lot of stuff about rvm so I want to use it on my production
server, but which installation method should I use? site-wide?

Thanks for your advice

On Feb 6, 11:06am, Fernando P. [email protected] wrote:

Hi,

I read a lot of stuff about rvm so I want to use it on my production
server, but which installation method should I use? site-wide?

I use a system wide deployment (
http://rvm.beginrescueend.com/deployment/best-practices/
)

Fred

I use a system wide deployment (
http://rvm.beginrescueend.com/deployment/best-practices/
)

Fred

Thank you Fred, I had missed that page.

By the way I read that it is suggested to use a different user per
application. Therefore, is there a “general rails deployment best
practices” somewhere? I might be missing other useful tips.

On Feb 6, 12:30pm, Fernando P. [email protected] wrote:

practices" somewhere? I might be missing other useful tips.

I tend to only have one application per server, so using a different
user per app doesn’t really apply. In principle it does sound like it
would reduce the possibility of them interfering with each other, or
security issues with one affecting other apps. Don’t know of any
general best practises document.

Fred

On my Leopard dev machine I have installed rvm+1.9.2 and everything
seems fine, function, rubygems, environment, etc.

But when I want to install my first gem (hint: rails 3) I get the
following error message:

$ gem install rails
ERROR: While executing gem … (Errno::EACCES)
Permission denied - /Users/fernando/.gem/specs

The ~/.gem directory belongs to root and seems to have been created on
the day I reinstalled my system, so it probably belongs to the system’s
ruby. I see a similar directory ~/.subversion, with same ownership and
date of creation, so I assume it was created by Leopard, or was it
Macports?

Therefore can I safely chown ~/.gem, or should I destroy this directory
and let rvm recreate a new one if needed?

Thanks

Fernando P. wrote in post #979907:

$ gem install rails
ERROR: While executing gem … (Errno::EACCES)
Permission denied - /Users/fernando/.gem/specs

From what I have read here and there, it seems that this directory was
chowned to root when I used evil “sudo gem install”

I delected the directory, and as expected rvm/rubygems recreated a new
one with proper permission.

I read a lot of stuff about rvm so I want to use it on my production
server, but which installation method should I use? site-wide?

I use a system wide deployment (
http://rvm.beginrescueend.com/deployment/best-practices/
)

Fred

Ok, so on my FreeBSD box, the site system wide install script crapped
out. No big deal I only need Ruby for my user that runs the application.

So I will use the “normal installation”.

I will use Nginx+Passenger. So I install passenger as non root.

Then when I want to install nginx, I should do:

$ sudo passenger-install-nginx-module

which will install in /opt/nginx.

Should I use a non sudo location or stick with sudo for nginx?

$ sudo passenger-install-nginx-module

which will install in /opt/nginx.

Should I use a non sudo location or stick with sudo for nginx?

Argh! With rvm’s normal installation I cannot use sudo.

Good, now I’m stuck.

I was thinking to do the same with an upcoming deployment. Does anyone
have
experience on this to point out possible downsides?

Jim ruther Nill wrote in post #981401:

use rvmsudo.

Thanks!

So far so good.

Just a last question.

I have my own script to remotely update and maintain my apps (I don’t
use capistrano and don’t intend to do so). But when I want to remotely
run “bundle install” it can’t find it. It’s certainly a PATH, profile,
bashrc, etc problem.

So can someone show me a good resource that will clear that for me once
and for all. I never know the difference between rc/profile, interactive
login and what have you.

I’d like to get that out of the way because every so often I run into
this problem and have to struggle to get things sorted out.

Hmmm, strange.

If I run rake remotely, the rake seems to be found but an error is
raised:

uninitialized constant Bundler

Adding a .rvmrc to the project did not help, neither did “rvm 1.9.2 exec
bundle install”.

use rvmsudo.

On Sun, Feb 13, 2011 at 10:32 PM, Fernando P.
[email protected]wrote:

This separation interactive/non-interactive is stupid to me, and
unnecessarily complicates things.

Is that related to bash? What if I use a different shell?

Argh! I have sourced .profile from with .bashrc but it still doesn’t
work.

It seems that the following line is key and is not being loaded:

[[ -s “$HOME/.rvm/scripts/rvm” ]] && . “$HOME/.rvm/scripts/rvm”

I enabled PermitUserEnvironment for ssh and added GEM_PATH as well as
PATH to ~/.ssh/environment, and still it had no effect at all.
Frustrating.

this will be handy - thanks for sharing :slight_smile:

On Sun, Feb 13, 2011 at 21:07, Fernando P. [email protected]
wrote:

To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.


*I love deadlines. Especially the whooshing sound they make as they pass
by.
*

I found a solution! In the script, do something such as:

source ~/.rvm/scripts/rvm && bundle install

And it will work.

All in all, even if I had to endure a bit of trial and error, I really
like the way rvm works and keeps things confined.

If one day my ruby and/or gems go South I can simply rm -r ~/.rvm and
everything goes away so that I can start a fresh install in a breeze.

Ha!

Using ssh and “gem env”, I discovered that rvm was not loaded. So it’s
definitely a bash_profile VS profile VS etc evil issue. God that’s
painful.

So when in a script I use:

ssh -t blabla ‘bundle install’

what kind of shell is created? Which files are loaded? Why can’t I get
the same environment as when I manually connect through ssh?

This separation interactive/non-interactive is stupid to me, and
unnecessarily complicates things.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs