Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Useful Capistrano recipes

branch: master
README.rdoc

Capistrano Recipes

Useful Capistrano recipes including:

  • Create MySQL database and user on server (via prompts)

  • Create standalone copy of database.yml in shared path (via prompts)

  • Log rotation and tailing commands

  • Restart and profile Phusion Passenger application server

  • Configure, start/stop/restart Unicorn application server

  • Send commands to God or Bluepill monitoring tools

  • Send commands to Thinking Sphinx

Included Tasks

  • cap db:create_yaml

  • cap db:mysql:setup

  • cap db:mysql:dump

  • cap db:mysql:fetch_dump

  • cap db:mysql:restore

  • cap log:rotate

  • cap log:tail

  • cap passenger:bounce

  • cap passenger:memory

  • cap passenger:status

  • cap nginx:setup

  • cap nginx:start

  • cap nginx:stop

  • cap nginx:restart

  • cap nginx:status

  • cap unicorn:start

  • cap unicorn:stop

  • cap unicorn:restart

  • cap unicorn:setup

  • cap symlinks:make

  • cap god:setup

  • cap god:implode

  • cap god:restart

  • cap god:reload

  • cap god:status

  • cap god:terminate

  • cap god:start

  • cap god:stop

  • cap god:quit

  • cap bluepill:install

  • cap bluepill:init

  • cap bluepill:start

  • cap bluepill:restart

  • cap bluepill:stop

  • cap bluepill:status

  • cap sphinx:config

  • cap sphinx:start

  • cap sphinx:stop

  • cap sphinx:rebuild

  • cap sphinx:index

  • cap sphinx:symlinks

Installation

Easy as pie…

Ensure you have the Capistrano gem installed:

sudo gem install capistrano

Optionally install the Capistrano extensions gem to give you multistage support:

sudo gem install capistrano-ext

Install this gem:

sudo gem install capistrano-recipes --source=http://gemcutter.com

To setup the initial Capistrano deploy file, go to your Rails app folder via command line and enter:

capify .

Configuration

Inside the newly created config/deploy.rb, add:

require 'capistrano/ext/multistage' # only require if you've installed Cap ext gem

# This one should go at the end of your deploy.rb
require 'capistrano_recipes'

RVM

RVM is enabled by default. You can disable it by setting :using_rvm to false, or leverage it by setting your rvm_ruby_string to appropriate ones (default is ree)

If using_rvm is true, the rvm recipe will load rvm's own capistrano extensions so you don't have to worry about it during deploy. Just make sure you have everything set up right, like .rvmrc on project root and system-wide install on the servers.

See (rvm.beginrescueend.com/rvm/install) for more info.

Nginx

If you're using nginx as your web server, set :web_server to :nginx and deploy:setup will generate the appropriate configuration file for it based on your other variables, such as :application_uses_ssl, etc.

Passenger

If you're running Phusion Passenger (www.modrails.com) be sure you add this line to config/deploy.rb:

set :server, :passenger

Unicorn

If you're running Unicorn (unicorn.bogomips.org/) be sure to add this line instead:

set :server, :unicorn

Contributors (thank you!)

  • Rogério Augusto

  • Leonardob Bighetti

Copyright

Copyright © 2009-2011 Webficient LLC, Phil Misiowiec. See LICENSE for details.

Something went wrong with that request. Please try again.