Ruby on Rails
Deployment Recipie For Capistrano On OCS Solutions

Under Construction

If you use the shared hosting service OCS for rails, here is some info that I have figured out about how to deal with their environment and have automated deployment through capistrano. I use their webmin admin tools and I have no idea if this will work with Cpanel.

Assumptions:

When we get done, you are going present users with a URL like
http://grik.com/bletch/

This URL will be the root of your running rails instance. The objective when we are done is for you to be able to do something like this on your home box ‘grik’:

rake remote:exec ACTION=deploy_ocs

Get the capistrano world installed on your machine. Test this by doing

cap -h

and insure that you get the capistrano help info.

Apply the capistrano magic (on grik) to your checked out copy of the rails instance.


cap —apply-to /path/on/grik/to/bletch bletch

Use the OCS supplied script


ocs-install-rails

to build the necessary directory structures. After you do the ocs-install-rails and give your project name, you’ll have a directory like this


/home/joe/rails_sites/bletch

What I recommend is creating another, parallel directory

/home/joe/bletch.capistrano

This is where we will end up pointing capistrano to deploy to and then we’ll patch it up with symlinks at the end.

Start by looking at the top of my deployment recipie. This should be in a file called “deploy.rb” and lives in your rails environment directory:

set :application, ""
set :repository, "http://grik.com/svn/your-repo/code"
set :user, "joe"
set :keep_releases,3
set :use_sudo, false

#ocs specific dirs
set :rails_ocs_dir, "/home/joe/rails_sites"
set :rails_ocs_name, "grik"

You’ll note that I had some trouble with the application name and the repository. This is because I don’t keep my rails directories (app

, db

, public

, and the like) at the top level of my svn repository and this was the only way to express that I had an intermediate layer called ‘code’.