Ruby on Rails
Deployment Recipie For Capistrano On OCS Solutions (Version #11)

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:

  • You are user ‘joe’ with home directory ‘/home/joe’
  • Your rails app is ‘bletch’
  • Your OCS hosted domain is ‘grik.com’
  • Your home box is running linux and called ‘grak’
  • You are using subversion (SVN) for source code control (most likely OCS managed SVN service via webmin)

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 this deployment recipie (“deploy.rb” and lives in your rails environment directory):

set :application, ""
set :repository, "http://matthewmark.net/svn/matthewmark-app/code"
set :user, "iansmith"
set :keep_releases,3
set :use_sudo, false

#ocs specific dirs
set :rails_ocs_dir, "/home/iansmith/rails_sites"
set :rails_ocs_name, "mmbeta"

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:

  • You are user ‘joe’ with home directory ‘/home/joe’
  • Your rails app is ‘bletch’
  • Your OCS hosted domain is ‘grik.com’
  • Your home box is running linux and called ‘grak’
  • You are using subversion (SVN) for source code control (most likely OCS managed SVN service via webmin)

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 this deployment recipie (“deploy.rb” and lives in your rails environment directory):

set :application, ""
set :repository, "http://matthewmark.net/svn/matthewmark-app/code"
set :user, "iansmith"
set :keep_releases,3
set :use_sudo, false

#ocs specific dirs
set :rails_ocs_dir, "/home/iansmith/rails_sites"
set :rails_ocs_name, "mmbeta"