I beat Dreamhost. How to really get rails 3, bundler and dreamhost working.

Posted: May 17th, 2010 | Author: | Filed under: ruby, web | Tags: , , , , | 13 Comments »

Please check out my earlier post so you can get the whole git/capistrano setup working as well.

So I’ve been trying to get rails 3 running with bundler on Dreamhost for a while. I’ve had a few posts on here about how to do it. In the end, they didn’t work completely. I’ve sent requests into Dreamhost to upgrade rubygems to 1.3.6 so the newest versions of bundler would work. I was told ‘No’ but go to this wiki site.

I wasn’t too happy about that since the top of the page has a big warning ‘DON’T DO THIS’. If you’re here looking at this you probably have the tech knowhow to do this and realize the world won’t end when you do.

So here’s the step by step directions for how I got it working.
You can check out the original wiki instructions at http://wiki.dreamhost.com/RubyGems.

Add this to your .bashrc
This will setup your shell to use local gems installed in your .gems directory, setup the path to check there first and opt/bin as well. Next we need to install a newer version of rubygems.

This will get rubygems installed and make sure you run your version before dreamhost’s. You then install bundler and rake. These are the only two gems I install in the system as I prefer to have all of my apps use their own gem versions. Putting everything into system is a big mess and a dependency nightmare on updates.

Next we need to make sure your app is setup to use the bundler gem. You need to modify your environment.rb and boot.rb

Make sure you change the application name to your name. Really you’re only adding the single line for the GEM_PATH

I was using the suggestions in the wiki but I eventually figured out that Dreamhost wasn’t properly picking up my gems even with the changed GEM_PATH. Adding the ‘Gem.clear_paths’ to boot.rb allowed the gems to be seen. This is what finally cracked the problem.

Hopefully this works for you.


13 Comments on “I beat Dreamhost. How to really get rails 3, bundler and dreamhost working.”

  1. 1 *blog » Blog Archive » rails 3, bundler, git and dreamhost said at 12:04 pm on May 19th, 2010:

    [...] UPDATE: How to setup your Dreamhost shell account update available here. [...]

  2. 2 grigio said at 6:53 am on June 11th, 2010:

    I’m not lucky as you, I got some problems with paths and bundler I got this in testpage:

    no such file to load — bundler/rubygems_ext

    and this in console:

    $ nice -n19 ~/.gemlocal/bin/bundle install
    Fetching source index from http://rubygems.org/

    Yikes! One of your processes (bundle, pid 24146) was just killed because your
    processes are, as a whole, consuming too much memory. If you believe you’ve
    received this message in error, please contact Support.

    Do u have some suggestions?
    Thanks for the tips anyway

  3. 3 Onno said at 3:58 am on June 18th, 2010:

    Are u using private server?

    I switched to Dreamhost PS after I found I was unable to install a new version of Bugzilla. Processes got killed each time.

    Also if you switch you get a lot of free memory for some time (2gb/2months)

  4. 4 katz said at 6:35 am on July 28th, 2010:

    Why don’t you guys try BurstNet. Cheap enough to run a rails app without processes getting killed.

  5. 5 Rafael Souza said at 5:59 am on August 30th, 2010:

    With this steps did you get the app working with Passenger?

    Gems installation works very well, but Passenger is throwing that rack activation error (You have already activated rack 1.1.0, but your Gemfile requires rack 1.2.1. Consider using bundle exec.)

  6. 6 jgeiger said at 7:02 am on August 30th, 2010:

    http://blog.joeygeiger.com/2010/08/06/dreamhost-you-win-or-lose-really/

    Dreamhost needs to upgrade their servers. Until this happens, Rails 3 is a no-go.

  7. 7 Matthew said at 3:02 am on November 12th, 2010:

    http://wiki.dreamhost.com/Bundler#Packaging_Your_Gems

    Essentially, run “bundle package” on your machine, then on dreamhost, from your project, type “gem install –ignore-dependencies vendor/cache/*.gem”. That seems to get around Dreamhost’s memory limitations, now just stuck trying to work out how to install up-to-date sqlite libs.

    Also, I would suggest adding “source .bashrc” to ~/.bash_profile so that you use the right gem in interactive shells, too :)

  8. 8 Adinda said at 8:41 pm on December 7th, 2010:

    I think I almost there. Got Passanger error message:

    Permission denied – /root/.gems

    I tried using the full path instead of ~/.gems in environment.rb, restarted the passenger and I still have the same error. Not sure if it’s been restarted or not. What I do to restart is simply modifying tmp/restart.txt. Any idea? Thanks!

  9. 9 Gordon Anderson said at 9:03 am on December 14th, 2010:

    hi

    Thanks for the info, I’ve run into the wrong version of rack issue but found a better option for installing the gems with bundle that prevents memory issues killing the process

    bundle install –path vendor/cache –local

    Cheers

    Gordon

  10. 10 Gordon Anderson said at 6:18 am on December 30th, 2010:

    The machine I have been allocated, pisces.dreamhost.com, now has Rails 3 on it. Using the instructions above I was able to install and get working a Rails 3 skeleton app which uses passenger. At last….. :)

  11. 11 Boban Jovanoski said at 7:51 am on January 14th, 2011:

    Same here: I get Permission denied – /root/.gems error message, and I also did bundle package && bundle install –local
    Any ideas ?

  12. 12 Joc said at 8:19 pm on January 16th, 2011:

    For those getting the “permission denied” error on Dreamhost, trying using the command “bundle install –deployment” on the remote server after doing “bundle package” on your local computer.

    This installs the gems in vendor/bundle and changes a setting which tells passenger where to find the gems.

    HTH Joc

  13. 13 T said at 6:17 pm on April 1st, 2011:

    Thank you!
    Had it all setup, but your suggested edits to boot.rb and environment.rb did the trick.


Leave a Reply