/badgercap

Some Capistrano helpers for VPSs

Primary LanguageRubyMIT LicenseMIT

This is a work in progress...

Badgercap

Some Capistrano recipies for deploying Rails apps to VPSs.

Home RDocs Wiki Gem

It's called Badgercap because it's amusing to think of a badger wearing a cap.

Installation

Add this line to your application's Gemfile:

gem 'badgercap'

And then execute:

$ bundle

Or install it yourself as:

$ gem install badgercap

Usage

Badgercap runs on Capistrano. Common practice is to do everything in a file called config/deploy.rb file, and you are welcome to do so. I, however, prefer to keep my deployment configuration in a single Capfile in the root of the Rails project, require the necessary recipies, and use them there.

So use Badgercap in your deployment script, and run cap deploy as usual.

Here's a very simple Capfile sprinkled with Badgercap. It deploys a Rails 3 app called pilot onto one VPS (such as those provided by Linode), which is running Ubuntu with Ruby 1.9.3 via RVM, MySQL, serving 3 instances of the app on Unicorn behind a single NginX. The Unicorns and NginX are monitored by monit. A user called deployer will deploy the app.

# Capfile

load 'deploy' # Loads the default Capistrano deploy tasks
load 'deploy/assets' # if you want to compile assets on the server

# Load only the recipies you need
load 'badgercap/capistrano/ubuntu'
load 'badgercap/capistrano/rvm'
load 'badgercap/capistrano/nginx'
load 'badgercap/capistrano/unicorn'
load 'badgercap/capistrano/postgresql'
load 'badgercap/capistrano/monit'

server "example.com", :app, :web, :db, default: true

Recipes

Badgercap knows about several server tools, all of which are documented inline and on the wiki.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request