Skip to content

Instantly share code, notes, and snippets.

Created September 3, 2013 08:32
Show Gist options
  • Save anonymous/6421162 to your computer and use it in GitHub Desktop.
Save anonymous/6421162 to your computer and use it in GitHub Desktop.
example
#TODO:
# 1. Set up unicorn as service
# 2. Set nginx config
# 3. Create deploy
require "debugger"
$:<< File.join(File.dirname(__FILE__), 'stack')
$:<< File.join(File.dirname(__FILE__), 'lib')
require "capistrano_vars"
deployment do
# mechanism for deployment
delivery :capistrano do
if ENV['STAGE'].nil?
puts('ERROR: assign a stage to load, ex.: STAGE=staging sprinkle...')
return
end
set :stage, ENV['STAGE']
recipes 'Capfile'
recipes "config/#{ENV['STAGE']}"
end
# source based package installer defaults
source do
prefix '/usr/local'
archives '/usr/local/sources'
builds '/usr/local/build'
end
end
# Require the stack base
%w(postgresql essential ruby git nginx py_sw_properties unicorn user).each do |lib|
require lib
end
# ===============
# = Web servers =
# ===============
# What we're installing to your server
# Take what you want, leave what you don't
# Build up your own and strip down your server until you get it right.
policy :db_server, :roles => :db do
requires :database
end
policy :application_server, :roles => :app do
requires :user
requires :ruby
requires :scm
requires :webserver
requires :http_server
requires :bundler
end
# Depend on a specific version of sprinkle
begin
gem 'sprinkle', ">= 0.7.4"
rescue Gem::LoadError
puts "sprinkle 0.7.4 required.\n Run: `sudo gem install sprinkle`"
exit
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment