Rails Shared Hosting Gotcha #3,942

Running Rails in a shared hosting environment is a prickly one. This fact has been well documented for years now. But I like to torture myself sometimes. I read a quote recently that I am reminded of: "if it hurts, do it more often".

Well, I'm running, or attempting to run, three Rails sites on a few different shared hosting servers at Dreamhost. Generally they run OK but sometimes they die and I cannot bring them back to life without a few hours of frantic keyboard strokes. Usually these times coincide with Dreamhost updating one of the following: rails, ruby or rubygems. Updating ruby and rubygems does not happen regularly enough to cause much pain, but I swear to fucking god it seems like they are updating rails every 3 months and every time my apps crash. Yes I have frozen my rails. Yes I am specifying a RAILS_GEM_VERSION in my environment.rb. The problem persists.

The latest failure occurred when rails was updated to 2.1.1. I watched it happen first only on one of the sites, then, when Dreamhost came around to updating the other server that I have apps on, those apps crashed as well. This was the interesting error I received:

RubyGem version error: actionpack(2.0.2 not = 1.13.6)

The code was still running through my frozen rails, but on one of the requirements it was falling out of my frozen rails and trying to require a more recent version of actionpack. You bastard!

/home/user-name/domain.com/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb 495 in `require'

Turns out the fix was easy enough though, but it required manually freezing my rails instead of using the rake task (rake rails:freeze:gems) since the version of rails I was freezing to (1.2.6) was no longer installed on my server.

Step one was to download the version I wanted from github. Then upload it to my app's vendor directory, unpack it, rename it to 'rails' and then touch tmp/restart.txt to tell passenger to reload my app.

Hey, it worked. Really weird because I froze rails back in June of this year to Rails 1.2.6, and everything was fine then.

Dreamhost's support was surprisingly silent on helping me with this. First they let me support request sit in their queue for over 3 days, then they replied with a "hey not our fault, your scripts are borked" reply. Great. Well it's over 5 days later now and I can fix it my own damn self, thank you very much.

Currently looking for VPS plans. Word on the street is slicehost which starts at a mere $20/month for 256 MB of VPS goodness. Hmmm....... there will be more on this topic I am sure.

<

p>Update: I was talking with a coworker about this and he reminded me that the older frozen Rails would not include the actionwebservice directory whereas if you freeze Rails now, it does. Also, the Rails 1.6 that I downloaded from github also included the actionwebservice directory. That seems to be the major difference between the frozen rails that was failing for me vs. the frozen rails that's running fine now.

11:03 PM | 8 Comments

Comments

  1. Here's my SliceHost referral link:

    https://manage.slicehost.com/customers/new?referrer=32e30f9f165bb87e03b3083da62da36c

    Grant Hutchins on
  2. You saved my ass...

    We also host our website as a rails app on dreamhost and had the same error. After I manually updated rails in the vendor folder, everything worked again.

    Oh yeah.. the mod_rails (passenger) checkbox was unchecked in my dreamhost control panel?!?! So I had to re-enable that. Don't know what they did.

    Cheers

    Rasmus on
  3. Thanks for your shameless plug Grant :p

    Glad this helped you Rasmus, I was banging my head against a wall for a few hours with this one. It only made it worse that Dreamhost refused to help.

    justin on
  4. Seriously, I owe you one. This fix just saved my butt as well!

    Thanks A TON!!!

    Eric Murrell on
  5. Thanks a bunch, Justin. I was just warned about Dreamhost a few months ago and then I get burned by this yesterday while out of town. I've got one site I'm hosting for a client that I haven't wanted to move, but now, I'll work expeditiously at setting up a VPS, most likely with another company.

    Mike on
  6. Thanks, this brought my site back up again. I've been meaning to move my rails apps to my Media Temple VPS for a while and i knew it would bite me..

    Ian on
  7. Thanks for that - saved my ass on my 3 Dreamhost Rails sites too.

    Tis a shame - makes me really think twice about using Rails for anything any more. Most of the sites I make are fairly low budget, so using a VPS isn't really an option. But why should I miss out on using all the good stuff Rails has to offer, simply because hosting it is either expensive or a pain?

    Makes me think more and more about just using one of the PHP frameworks and having done with it - if only because then I can be pretty sure that sites will stay up. I quite like the look of Akelos framework (akelos.org), though haven't tried it yet.

    Dave S on
  8. Dave S, For my personal blog I have opted for a PHP platform since I was tired of dealing with fixing a down Rails site, however I absolutely hate making coding changes on it and tend to just not touch it at all.

    I've experienced more Rails downtime since I posted this entry, and am receiving the same sub-part support. Something must've changed with Dreamhost because in the past my sites were always fixed within a few hours. I hope they realize they're scaring their customers away.

    justin on
Comments are not accepted on this entry.