Deploying With Capistrano

From OCS Support Wiki

Jump to: navigation, search

[edit] Introduction

Capistrano helps to ease the deployment procedure of your Rails application by automating the delivery of your application to the server and assisting with maintenance tasks like restarting Mongrel, etc. These instructions are specific to our shared hosting environment, but can be used on virtual dedicated server and dedicated servers with little to no modification.

These instructions are also specific to Webmin, but can be used on cPanel as well. Any restart tasks on cPanel need to be adjusted to kill dispatch.fcgi processes and not Mongrels.

[edit] Sample deploy.rb

set :application, "a_cool_app"
set :repository, "svn+ssh://me@acoolapp.com:/home/me/svn/a_cool_app/trunk"
role :app, "www.acoolapp.com"
role :web, "www.acoolapp.com"
role :db, "www.acoolapp.com"
set :deploy_to, "/home/me/rails_sites/a_cool_app"
set :user, "me"
set :use_sudo, false

In the above example, replace a_cool_app with your Rails application name, me with your Webmin/SSH/FTP username, and acoolapp.com with your website domain name. If you're using Subversion from another server other than inside Webmin you will need to change the repository line accordingly. We are also checking out the trunk in the example above. If you don't want to use your trunk, and instead want to use a branch or tag from your repository, you will need to change that accordingly as well.

Also note this file isn't complete, this is just the information you'll have to add to make your deployment work. You may want to add or modify other tasks to restart your Mongrel process or similar.

[edit] Additional Help