Shovel—Rails Deployment with Capistrano (for Dreamhost)

NOTE: See also my TextDrive Recipe

Download Shovel Capistrano Task for Dreamhost

Description

This is a Capistrano task you can use for your Dreamhost account. It was previously called Switchtower.

Easily and automatically deploy your Rails application to your Dreamhost account. You can easily rollback to previous versions, do database migrations, and complete other complicated tasks.

Dreamhost now offers Subversion hosting via HTTP, but I have not tried it yet, but it should work even better with Capistrano deployment.

Setup

On the Server (for SVN+SSH)

Make a directory for Subversion on your server and make a new project for your site.

# On your Dreamhost server
mkdir svn
mkdir svn/rails.topfunky.com
svnadmin create ~/svn/rails.topfunky.com

You must name your Subversion project with the domain name of your application. If you use another naming scheme, you must edit deploy.rb to match.

Also, go to your Dreamhost control panel and set the web root to “whatever_domain.com/current/public”.

On Your Local Machine

Import your local files to the Subversion repository.

# On your local machine
svn import rails.topfunky.com svn+ssh://funky_chicken@topfunky.com/home/.my_server/funky_chicken/svn/rails.topfunky.com

# Checkout a new copy from Subversion
svn co svn+ssh://... # See above for url

# Create Capistrano files
cap -A .

# Get my customized deploy.rb
# Overwrite the existing one
cd rails.topfunky.com/config
wget http://topfunky.net/svn/shovel/dreamhost/deploy.rb

TIP You may have to enter your password up to 3 times. Use the resource below to cache your SSH password instead.

Finally, edit deploy.rb with your username, application, etc.

Setup

rake remote:exec ACTION=setup

Deploy

rake deploy

It may give you warnings about not finding a local subversion repository…don’t worry. Capistrano does the sync’ing on the server, so it will work fine there.

Troubleshooting

  • Dreamhost will make the “current” folder. Delete it and let Capistrano make it as a symlink to the current release.

Other Resources

Contact

Send fixes or enhancements to Geoffrey Grosenbach.

Nuby on Rails

Geoffrey Grosenbach / Ruby / Code / Graphics / Design / Rails / Merb / Javascript / CSS

Ads by The Lounge

Manufactured with

Subscribe

Subscribe (RSS)