Skip to content

Instantly share code, notes, and snippets.

@dleavitt
Created August 30, 2011 21:26
Show Gist options
  • Save dleavitt/1182096 to your computer and use it in GitHub Desktop.
Save dleavitt/1182096 to your computer and use it in GitHub Desktop.
Deployment Script
### deploy.rb
# setup rvm
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require "rvm/capistrano"
set :rvm_ruby_string, 'ruby-1.9.2-p290'
set :rvm_bin_path, "#{rvm_path}/bin"
# setup bundler
require 'bundler/capistrano'
# require 'new_relic/recipes'
# setup cron
set :whenever_environment, defer { stage }
set :whenever_identifier, defer { "#{application}_#{stage}" }
set :whenever_command, "bundle exec whenever"
require "whenever/capistrano"
# setup multistage
set :stages, %w(production staging)
set :default_stage, "staging"
require 'capistrano/ext/multistage'
# app details
set :application, "APP NAME"
# deployment details
set :deploy_via, :remote_cache
set :user, 'hyfn'
set :use_sudo, false
set :domain, 'hyfnrsx1.com'
server domain, :app, :web, :db, :primary => true
# repo details
set :scm, :subversion
set :repository, "https://hyfn.svn.beanstalkapp.com/REPO PATH"
set :keep_releases, 5
# workaround for https://github.com/capistrano/capistrano/issues/81
before "deploy:assets:precompile", "bundle:install"
# remove old releases
after "deploy", "deploy:cleanup"
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
# deploy/production.rb
set :deploy_to, "/home/sites/SERVER PATH"
# deploy/staging.rb
set :rails_env, "staging"
set :deploy_to, "/home/sites/SERVER PATH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment