Skip to content

e1senh0rn/capistrano-recipes

 
 

Repository files navigation

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

Included Tasks

  • cap db:create_yaml

  • cap db:mysql:setup

  • 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

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_recipes'
require 'capistrano/ext/multistage' # only require if you've installed Cap ext gem

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

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

About

Useful Capistrano recipes

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%