I beat Dreamhost. How to really get rails 3, bundler and dreamhost working.
Posted: May 17th, 2010 | Author: jgeiger | Filed under: ruby, web | Tags: bundler, dreamhost, git, rails 3, ruby | 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.
[...] UPDATE: How to setup your Dreamhost shell account update available here. [...]
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
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)
Why don’t you guys try BurstNet. Cheap enough to run a rails app without processes getting killed.
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.)
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.
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
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!
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
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…..
Same here: I get Permission denied – /root/.gems error message, and I also did bundle package && bundle install –local
Any ideas ?
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
Thank you!
Had it all setup, but your suggested edits to boot.rb and environment.rb did the trick.