Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Battle-tested capistrano recipes for ruby, rubygems, apache, passenger, delayed_job, juggernaut, thinking_sphinx, mongodb, whenever, among other popular tools
Ruby

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
LICENSE
README.textile
Rakefile
VERSION.yml
cap-recipes.gemspec

README.textile

cap-recipes

INSTALLATION

DESCRIPTION

This is a collection of capistrano recipes which will grow to encompass many useful recipes. The intended use for these recipes is for a ruby project which deploys using Phusion Passenger and caches using memcached. In addition, recipes for the management of various daemon processes will be included as needed. Feel free to contribute to this and make it better!

Currently included:

  • Phusion Passenger (Setup and Deployment)
  • Apache Server
  • Memcache Process
  • Juggernaut Daemon
  • Backgroundrb Server

SYNOPSIS

To include any of these into your deploy.rb configuration file for Capistrano:

require ‘cap_recipes/tasks/passenger’ require ‘cap_recipes/tasks/apache’ require ‘cap_recipes/tasks/backgroundrb’ require ‘cap_recipes/tasks/juggernaut’ require ‘cap_recipes/tasks/memcache’

Or to include and activate all of them:

require ‘cap_recipes’

USAGE

Passenger

Configuration

  • base_ruby_path – the base path to the ruby installation [default: “/usr”]

The following files and folders are expected to exist:

  • “#{base_ruby_path}/lib/ruby”
  • “#{base_ruby_path}/bin/ruby”
  • “#{base_ruby_path}/bin/gem”

Tasks

deploy :start :stop :restart :with_migrations :copy_config :tail install :passenger :gems sweep :cache :log :gems

Apache

Configuration

  • apache_init_path – the path to the init.d apache file [default: ‘/etc/init.d/apache2’]

Tasks

apache :stop :start :restart :install

Backgroundrb

Configuration

  • backgroundrb_log – the path to the backgroundrb log file
  • backgroundrb_host – the background host machine ip [default: ‘localhost’]
  • backgroundrb_env – the rails environment [default: ‘production’]

Tasks

tasks: backgroundrb :stop :start :restart :copy_config :tail

Juggernaut

Configuration

  • juggernaut_config – path to juggernaut config file [default: “#{current_path}/config/juggernaut.yml”]
  • juggernaut_pid – path to juggernaut pid file [default: “#{current_path}/tmp/pids/juggernaut.pid”]
  • juggernaut_log – path to juggernaut log file [default: “#{current_path}/log/juggernaut.log”]

Tasks

tasks: juggernaut :start :stop :restart :copy_config :tail

Memcache

Configuration

  • memcache_init_path – path to memcache config file [default: “/etc/init.d/memcache”]

Tasks

tasks: memcache :start :stop :restart :install

EXAMPLE

Here is a sample deploy.rb file using cap_recipes:


# =============================================================================
# GENERAL SETTINGS
# =============================================================================

set :application,  "app_name"
set :deploy_to,  "/var/apps/#{application}"
set :scm, :git
set :repository, "git@repos.site.com:/home/git/repos.git"

# =============================================================================
# CAP RECIPES
# =============================================================================

# Note this happens after the general settings have been defined
require 'rubygems'
require 'cap_recipes' 

# PASSENGER
set :base_ruby_path, '/opt/ruby-enterprise' # defaults to "/usr"
set :apache_init_path, '/etc/init.d/apache2' # defaults to "/etc/init.d/apache2"

# BACKGROUNDRB
set :backgroundrb_log, "/var/log/backgroundrb.log" # defaults to "#{release_path}/log/backgroundrb.log"
set :backgroundrb_host, "worker.site.com" # defaults to localhost
set :backgroundrb_env, "staging" # defaults to production

# JUGGERNAUT
set :juggernaut_config, "/some/path/juggernaut.yml" # defaults to "#{current_path}/config/juggernaut.yml"
set :juggernaut_pid, "/some/path/juggernaut.pid" # defaults to "#{current_path}/tmp/pids/juggernaut.pid"
set :juggernaut_log, "/var/log/juggernaut.log" # defaults to #{release_path}/log/juggernaut.log

# MEMCACHE
set :memcache_init_path, "/etc/init.d/memcache" # defaults to "/etc/init.d/memcache"

LICENSE:

(The MIT License)

Copyright © 2008 Nathan Esquenazi

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
‘Software’), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Something went wrong with that request. Please try again.