Ubuntu, Ruby, RVM, Rails, and You
ryanbigg.com
ryanbigg.com
I really wish the RoR book I was reading had told me that before I spent multiple hours trying to properly setup Rails.
Ruby is a language that moves very, very quickly. On "cutting-edge" distros like Fedora and Arch it's not nearly as much of an issue, but not having to wait to get new language versions is very convenient.
More importantly, though, is that the version of RubyGems distributed through Debian's (and Debian descendents like Ubuntu's) package repositories is crippled. Gem normally includes a very important command called 'gem update --system' that lets you upgrade gem itself. The opinion of the Debian package maintainers is that all upgrades should be handled through the package manager. This makes sense from a system administration perspective, but it's a huge pain when you're trying to do Ruby development, because important gems like Rails often require a fairly new version of RubyGems. (And Ruby libraries get updated much more frequently than the language itself.)
For the above reasons, doing Ruby stuff on Debian/Ubuntu without using RVM is a huge pain. Even if you manage to get everything working, an update to gem or something else may break it a week later.
While RVM isn't as essential on other distros (like Fedora, which I did Ruby dev on for a long time before learning about RVM), it's still massively convenient. You can ensure that you have a consistent development environment across computers and operating systems (which I find is especially useful when deploying to a server, since I use different Linux distros for everyday use than I do for hosting things), you can easily switch between Ruby versions (I have one project still on 1.8.7, and I do the rest of my stuff on 1.9.x--switching between them is as simple as typing rvm $VERSION), and it deals with all of the icky bits of managing multiple versions of gems (to go with your multiple versions of Ruby) for you.
RVM is awesome, and makes lots of the headaches that surround Ruby development go away. Use it.
and later
> "This makes sense from a system administration perspective, but it's a huge pain when you're trying to do Ruby development"
It's a developer's world.
Having been a Rails programmer working on some internals projects in the company that I used to work, I like both Ruby and Rails.
But now I'm' working as an operations guy (ie, a sysadmin) in a new company, we came short of adopting redmine and maybe opening the road for more ruby and rails software to be used, we already use puppet and so every sysadmin now knows ruby, so it would be good to include some more ruby to internal use, but it was just a pain in the ass to maintain the rails-based infrastructure, in both Debian and CentOS, the distributions that we use. Fedora and Arch is not used in the servers, so it cannot be used.
This is old, and just touches one aspect of the problems (shared hosting, which I do not deal with), but it does have some good rants, specially the point 2 of "How it could be better": http://blog.dreamhost.com/2008/01/07/how-ruby-on-rails-could...
I'll follow up after I'm done with Christmas celebrations, but to think that a random hodgepodge of flavor-of-the-week deploy scripts slapped together by a webdev and scraped from github are somehow better or more maintainable than the collaborative output of some of the world's smartest and most committed developers is flatly-ridiculous.
Follow http://planet.debian.org for a week and tell me these people don't know what they're doing.
I'm really not interested in getting into some back-and-forth flamewar about this. (There's been plenty enough of that on the Debian mailing lists and elsewhere already.) I trust that the people maintaining Debian are very smart and do, in general, know what they're doing. But I don't trust that the people maintaining Debian know how to deploy Ruby/Rails better than the people in the Ruby/Rails community.
EDIT: Well, since you cannot answer in this thread feel free to answer in my first comment in this thread above if you wish.
EDIT2: I found this article about the matter, I found it to be good, I agree with him in the large picture: http://rcrowley.org/articles/dependencies.html
RVM automates the compilation step. I'm not sure why I'd want to do that by hand instead.
Gem installation is done on a per-app basis using bundler[0] or RVM's gemsets, so the gems for each application are kept separate anyway.
Running different applications on different versions of Ruby at once is also easy with project-level rvmrc files.
And if for whatever reason you want different RVM installs for different users that's easy too: RVM only installs for a single user by default.
Now, granted, I don't do anything like run a shared hosting service, and there may be cases where RVM lacks the flexibility to do what's required, but I've never run into them.
Fortunately RVM gives the best of all worlds: it's consistent between distros and operating systems (I develop on OS X and deploy onto Ubuntu and Cent OS--everything works the same in both places). Switching between ruby versions is as simple as `rvm 1.9.2`. You can easily specify a ruby version to use for different scripts, ensuring that whatever is best for a particular program can be used. And most importantly, it just works.
RVM is in my mind the biggest improvement to ruby development in the last couple of years. I'm sorry if the Debian packagers feel its encroaching on their territory, but it serves our needs as they do not.
technomancy summed it up: "The rubygems devs have asked nicely to get Debian to fix these issues, and have been turned down flatly... Debian is the only distributor who breaks rubygems when packaging it."
Must we go through this whole debate again?
As far as it goes, you can certainly install Ruby with apt-get or aptitude, but I think the response then would be "Why bother?", assuming you're not going to use it anyhow.
One other thing: rvm doesn't really "manage" the system Ruby. You can issue the command 'rvm system', but what that really does is remove the rvm directories from your $PATH. rvm itself never touches the Ruby interpreter or libraries installed via APT.
This tutorial, and some others on this guys blog helped me do just that. http://kris.me.uk/2010/08/30/rails3-hosting-all-in-one.html
If you could include a bit about installing rvm system wide and maybe setting up passenger, it would have saved me a lot of time and grief a week ago.
I spent a good amount of time trying to get this to work a few days ago, but had issues with rvm. Thought this post might help, but in a fresh 10.10 install if rvm is used when trying gem install rails I get the following
: While executing gem ... (Errno::EACCES) Permission denied
It shouldn't be denied though since it's in the home directory. The only way I could get an up to date ruby and rails installed was by removing rvm (rvm implode) and manually installing 1.9.2 and then following the update-alternatives instructions located here: http://ubuntuforums.org/showthread.php?p=10274200#post102742...
Is anybody else successfully accomplishing it the way this blog suggests? The internet is relatively sparse with up to date instructions for installing rails without problems on Ubuntu, it makes me miss the rolling release model of arch where everything just worked instantly.
I would try rvmsudo gem install rails, who knows...
Also remember, when you run the rvm install script or any of the following rvm commands, dont sudo it for a normal installation.
Even upstream doesn't seem to be interested that much. On the download page, there's:
For example, on Debian or Ubuntu apt-get provides an easy and elegant solution: % sudo apt-get install ruby1.9.1-full
It definitely is confusing / silly to the outside observer... There's rvm - how hard is it to automate package building reusing it's elements? If it's not - why isn't it done? If it is - why all the packages hate, instead of pressuring upstream to improve the situation?
If really need the absolute latest version of Rails go on, have a separate install compiled from source, but there's no need to be rude with the packagers. I'm trying to learn Rails 3 and I found that JRuby works really fine with Rails 3, and using Warbler gives me nices WAR files to deploy on Tomcat, and I don't mess my default Ruby install.
apt installs Ruby using a non-standard configuration too, when you do `apt-get install ruby1.8`, the executable is `ruby1.8`. Nobody in their right minds these days would install it with the `1.8` suffix.
Ruby version management is best taken care of with RVM, as that's better built for it than a general package manager such as apt.
Also "In the name of this package, `1.9.1' indicates the Ruby library compatibility version. This package currently provides the `1.9.2' branch of Ruby, which is compatible with the `1.9.1' branch." (http://packages.debian.org/sid/ruby1.9.1)
http://toranbillups.com/blog/archive/2010/09/01/How-to-insta...
Although I had to install more dependencies to get everything to work. I don't remember exactly what problems I had without some of the dependencies, but I had compiled them here: http://rohitarondekar.com/articles/installing-rails3-beta3-o...
In addition I used Passenger as well