Created
August 10, 2012 13:41
-
-
Save simonmorley/3314266 to your computer and use it in GitHub Desktop.
Deploy.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler/capistrano' | |
set :whenever_environment, defer { stage } | |
require "whenever/capistrano" | |
load 'deploy/assets' | |
before 'deploy', 'rvm:install_rvm' | |
ssh_options[:forward_agent] = true | |
ssh_options[:port] = '64322' | |
set :rvm_ruby_string, ENV['GEM_HOME'].gsub(/.*\//,"") # Read from local system | |
require 'rvm/capistrano' | |
set :rvm_ruby_string, '1.9.3-p194' | |
set :user, 'ubuntu' | |
set :stages, %w(production playground) | |
set :default_stage, "playground" | |
set :application, "xxx" | |
require 'capistrano/ext/multistage' | |
set :domain, '10.8.0.1' | |
set :applicationdir, "/var/www/html/xxx" | |
set :scm, 'git' | |
set :repository, "[email protected]/xxx.git" | |
set :git_enable_submodules, 1 # if you have vendored rails | |
set :branch, 'master' | |
set :git_shallow_clone, 1 | |
set :scm_verbose, true | |
# roles (servers) | |
role :web, domain | |
role :app, domain | |
role :db, domain, :primary => true | |
# deploy config | |
#set :deploy_to, applicationdir | |
set :deploy_via, :remote_cache | |
# additional settings | |
default_run_options[:pty] = true # Forgo errors when deploying from windows | |
set :keep_releases, 1 | |
after "deploy:symlink", "deploy:update_crontab", "deploy:delayed_job", "deploy:cleanup" | |
namespace :deploy do | |
desc "Deploy your application" | |
task :default do | |
update | |
restart | |
end | |
desc "Update the crontab file" | |
task :update_crontab, :roles => :db do | |
run "cd #{release_path} && whenever --update-crontab #{application}" | |
end | |
desc "Restart the delayed_job process" | |
task :delayed_job, :roles => :app do | |
run "cd #{current_path} && ruby script/delayed_job restart #{rails_env}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment