Getting your Github git project to dreamhost

Problem
You already have a project in github, but you want to move it to a different host (ie dreamhost)

Solution
Following the post here that describes how to setup a new git repository in dreamhost, the only difference after the initial setup :

ssh username@dreamhost_domain.com

mkdir -p ~/git/yourproject.git

cd ~/git/yourproject.git

git --bare init

is to edit your project’s .git/config file:
vi local_host/your_project/.git/config

and change the :
url = git@github.com:user_name/project_name.git

to the following:
ssh://dreamhost_username@dreamhost_domain/~/git/yourproject.git

Lastly you have to push for the first time to the server:
git push origin master

Optionally if you would like to check and/or checkout to a different pc you can use:
git clone ssh://dreamhost_username@dreamhost_domain/~/git/yourproject.git

Freezing gems (other than rails) on 2.3.4

Problem
Your host (ie dreamhost) for deploying applications doesn’t have the gems you are using in your development.

Solution
After freezing your rails gems with rake rails:freeze:gems, freeze the rest of your gems, not with rake gems:freeze gem=GEM_NAME, as used in previous versions of rails, but with:

rake gems:unpack

RubyGem version error: rack(0.3.0 not ~> 1.0.0)

Problem
Trying to deploy in dreamhost with capistrano you get the error:

RubyGem version error: rack(0.3.0 not ~> 1.0.0)

Solution
Log in with ssh to your dreamhost account and then install the newer version of rack that is not yet installed in dreamhost:

gem install rack

That assumes that you have followed the instructions for setting up your local gems in dreamhost (here) and you already have a ~/username/.gems directory.

You may probably need to also add the following to your config/environment.rb :

ENV[‘GEM_PATH’] = ‘/home/USERNAME/.gems’

Note 09-Sep-2009
It seems that according to the dreamhost wiki we need to add the following to the config/environment.rb, instead of the line above:

if ENV[‘RAILS_ENV’] == ‘production’
ENV[‘GEM_PATH’] = ‘/home/USERNAME/.gems’
require ‘/home/USERNAME/.gems/gems/rack-1.0.0/lib/rack.rb’
end

to use the locally installed rack-1.0.0 gem, instead of the rack installed by dreamhost.

undefined method `cache_template_loading=’ for ActionView::Base:Class

Problem
While developing on Rails 2.3.2 you want to deploy in dreamhost that uses 2.2.2 at the moment.

Solution
Although we could try to freeze the specific rails version we are using, it’s probably easier as a temporary solution, until dreamhost upgrades the rails version to do the following:

  • Make sure that we have the following line with the appropriate version of
  • RAILS_GEM_VERSION = '2.2.2' unless defined? RAILS_GEM_VERSION

    in the config/environment.rb file

  • Rename the application_controller.rb file back to application.rb
  • Comment out the following line from config/environments/production.rb
  • config.action_view.cache_template_loading = true