Dreamhost, Rails 2.1.1, Freeze, Capistrano

Problem
With the imminent upgrade in Dreamhost to Rails 2.1.1 (dreamhost blog post here), you may want to freeze your Rails version to a previous version, using capistrano.

Solution
On your local development pc freeze the rails:

rake rails:freeze:gems

Add the new code to your svn repository:

svn commit -m 'freeze rails'

And then deploy to dreamhost using capistrano:

cap deploy

Your rails project located on dreamhost should be frozen to your current Rails version.

4 thoughts on “Dreamhost, Rails 2.1.1, Freeze, Capistrano

  1. What if you didn’t freeze your gems in time? (Now I am getting the error: /usr/lib/ruby/gems/1.8/bin/cap:17: undefined method `require_gem’ for main:Object (NoMethodError)

    Thanks for your help.

  2. tommyf,

    Can you see what rails version you have in your development pc?

    I presume you are using dreamhost as your production environment.

    If I understand the problem correctly you should be uninstalling the new rails gems, that you have upgraded, then try to freeze to the specific gem version you want to use in your production environment.

    So when you freeze to the specific version you want, all the necessary files are going to be copied into the vendor/rails directory.

    You should then be able to deploy in dreamhost for your specific rails version you want.

  3. Thanks for the response. Here are some answers:
    “Can you see what rails version you have your development pc?”

    Answer: Rails 2.0.2 (maybe I should upgrade that?)

    “I presume you are using dreamhost as your production environment.”

    Yes!

    “If I understand the problem correctly you should be uninstalling the new rails gems, that you have upgraded, then try to freeze to the specific gem version you want to use in your production environment.”

    How do I uninstall the new rails gems?

    “So when you freeze to the specific version you want, all the necessary files are going to be copied into the vendor/rails directory.”

    That makes sense, mostly. Thanks.

  4. Tommy,

    Looking again at your error, and seeing that you have upgraded to 2.0.2, I’ve got the impression that it could be something to do with your gem installation.

    Have you tried to install any gem recently?
    Or have a gem remote list?
    (gem list –remote)

    I had a similar problem and had to upgrade to gem version 1.3.0, for it to work.

    If that’s the case have a look here.

Leave a Reply