This is a work in progress...
Some Capistrano recipies for deploying Rails apps to VPSs.
It's called Badgercap because it's amusing to think of a badger wearing a cap.
Add this line to your application's Gemfile:
gem 'badgercap'
And then execute:
$ bundle
Or install it yourself as:
$ gem install badgercap
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
Badgercap knows about several server tools, all of which are documented inline and on the wiki.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request