Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Capistrano deploy recipes
Ruby

This branch is 27 commits behind lest:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.gitignore
.rspec
.travis.yml
Gemfile
Gemfile.lock
MIT-LICENSE
README.md
Rakefile
capistrano-deploy.gemspec

README.md

Capistrano deploy recipes TravisCI

Inspired by https://github.com/blog/470-deployment-script-spring-cleaning.

Quickstart with Git and Rails

Minimal Capfile for Rails deploy using Git:

require 'capistrano-deploy'
use_recipes :git, :rails

server 'server name or ip address', :web, :app, :db, :primary => true
set :user, 'user for deploy'
set :deploy_to, '/deploy/to/path'
set :repository, 'your git repository'

To setup:

cap deploy:setup

Then when you push some changes to git repository simply run:

cap deploy

Or if you have migrations:

cap deploy:migrations

To look through the changes to be deployed:

cap deploy:pending

Multistage

Basic usage:

use_recipe :multistage

set :default_stage, :development

stage :development do
  ...
end

stage :production do
  ...
end

You can also pass options that allow setting variables and default stage:

stage :development, :branch => :develop, :default => true
stage :production,  :branch => :master

When branches are specified for stages and git recipe is used it will automatically select stage based on current local branch.

Bundle

Use recipe:

use_recipe :bundle

And add callback to run bundle install on each deploy:

after 'deploy:update', 'bundle:install'

Passenger

Use recipe:

use_recipe :passenger

It will automatically do touch tmp/restart.txt on each deploy.

Unicorn

Use recipe:

use_recipe :unicorn

You can setup callback to reload unicorn after deploy is done:

after 'deploy:restart', 'unicorn:reload'

Whenever

Use recipe:

use_recipe :whenever

To automatically update crontab file:

after 'deploy:restart', 'whenever:update_crontab'

You can also clear crontab file with command:

cap whenever:clear_crontab
Something went wrong with that request. Please try again.