Created
July 4, 2013 14:47
-
-
Save danielld75/5928412 to your computer and use it in GitHub Desktop.
deploy.rb
This file contains hidden or 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
# set :application, "parpp" | |
# set :repository, "set your repository location here" | |
# set :scm, :git # You can set :scm explicitly or Capistrano will make an intelligent guess based on known version control directory names | |
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none` | |
# role :web, "your web-server here" # Your HTTP server, Apache/etc | |
# role :app, "your app-server here" # This may be the same as your `Web` server | |
# role :db, "your primary db-server here", :primary => true # This is where Rails migrations will run | |
# role :db, "your slave db-server here" | |
# if you want to clean up old releases on each deploy uncomment this: | |
# after "deploy:restart", "deploy:cleanup" | |
# if you're still using the script/reaper helper you will need | |
# these http://github.com/rails/irs_process_scripts | |
# If you are using Passenger mod_rails uncomment this: | |
# 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 | |
require 'bundler/capistrano' | |
set :repository, "git://github.com/danielld75/parpp.git" | |
set :use_sudo, false | |
set :scm, :git | |
set :branch, "master" | |
set :ssh_options, {:forward_agent => true} | |
set :keep_releases, 5 | |
set :application, "parpp" | |
set :deploy_to, "/var/lib/parpp" | |
set :deploy_via, :remote_cache | |
set :user, "octocat" | |
set :unicorn_binary, "bundle exec unicorn" | |
set :unicorn_config, "#{current_path}/config/unicorn.rb" | |
set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid" | |
role :web, "[email protected]" | |
role :app, "[email protected]" | |
role :db, "[email protected]", :primary => true | |
default_run_options[:pty] = true | |
namespace :deploy do | |
task :start, :roles => :app, :except => { :no_release => true } do | |
run "cd #{current_path} && #{try_sudo} #{unicorn_binary} -c #{unicorn_config} -E #{rails_env} -D" | |
end | |
task :stop, :roles => :app, :except => { :no_release => true } do | |
run "#{try_sudo} kill `cat #{unicorn_pid}`" | |
end | |
task :graceful_stop, :roles => :app, :except => { :no_release => true } do | |
run "#{try_sudo} kill -s QUIT `cat #{unicorn_pid}`" | |
end | |
task :reload, :roles => :app, :except => { :no_release => true } do | |
run "#{try_sudo} kill -s USR2 `cat #{unicorn_pid}`" | |
end | |
task :restart, :roles => :app, :except => { :no_release => true } do | |
stop | |
start | |
end | |
# task :db do | |
# run "cp /var/lib/parpp/config/database.yml /var/lib/parpp/current/config/database.yml" | |
# run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}" | |
# end | |
end | |
desc "Create the configs symlinks." | |
task :configs_symlink do | |
['database.yml', 'unicorn.rb'].each do |config| | |
run "cd #{release_path} && ln -snf #{shared_path}/#{config} #{release_path}/config/#{config}" | |
end | |
end | |
after 'deploy:update_code', 'configs_symlink' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment