Minicap replaces the stock capistrano recipes with a small, git-centric deployment strategy that eschews the power and flexibility of capistrano's (excellent, btw) default recipes, and replaces them with something smaller, faster and easier to grok.
Minicap is formalization of some work we've been doing with side project deployments at well.ca, originally inspired by Chris Wanstrath's take on the subject. I got tired of maintaining separate yet nearly identical
deploy.rb files in every side project, and realized where there was commonality, there was an opportunity to factor some behaviour up into stock recipes. Now the project
deploy.rb files just contain a bunch of
set statements, and a few (very minor) amendments to the minicap recipes.
Minicap requires that you use git as a repository, and that
git is present
on the server. Deployments are not atomic (but since they're based on
git reset --hard, they're pretty damn close).
Minicap also has two features that the stock deployment recipes lack;
Better (or at least more transparent) support for shared files. Since your deployment is just a git repo, files that need to persist between deployments can just live right in your server's working copy. Minicap has an optional task (enabled by enabling
look_for_orphans) which scans for untracked files on your remote repo. Since any shared files should probably be in your
.gitignoreanyway, this really just reinforces a best practice.
Checking for unpushed changes. If you enable
pedantic_remote, deployments will fail if your local HEAD is newer than the branch pulled down on the remote server. This is usually indicative of your forgetting to do a
git pushbefore a
cap deploy, and helps prevent those 'why didn't my deployment change anything?' moments.
First, install minicap
gem install minicap
Then set up your project to use minicap, by making your project's
Capfile look like
require 'rubygems' require 'minicap' load 'config/deploy'
Copy the contents of minicap's
examples/deploy.rb as a jumping off point for your project's
- Transparent support for templated files. No more jumping through hoops to get a
database.ymlfile up to production
- Built-in notification emails, ala cap-gun