Created
June 14, 2016 13:09
-
-
Save carloscortegagna/e4e4c6c49b414646276401dbb5aa9380 to your computer and use it in GitHub Desktop.
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
lock '3.2.1' | |
# Configuration | |
set :application, 'travel-mesh' | |
set :repo_url, "git@github.com:NetBookingCom/travel-mesh.git" | |
set :executener, fetch(:user) | |
set :admin_executener, fetch(:user) | |
set :use_sudo, false | |
set :normalize_asset_timestamps, false | |
set :scm, :git | |
set :deploy_via, :remote_cache | |
set :port, 22 | |
set :scm_verbose, true | |
set :keep_releases, 3 | |
set :bundle_without, [:development, :test] | |
set :unicorn_binary, "/usr/bin/bundle exec unicorn" | |
set :pty, true | |
set :linked_dirs, %w{ bin log tmp/pids pids tmp/cache tmp/sockets vendor/bundle public/system public/static } | |
namespace :deploy do | |
task :start do | |
on roles(:all) , :except => { :no_release => true } do | |
#execute "cd #{release_path} && bundle install --path #{shared_path} --deployment --without development test" | |
execute "cd #{current_path} && #{fetch(:try_sudo)} #{fetch(:unicorn_binary)} -c #{fetch(:unicorn_config)} -E #{fetch(:rails_env)} -D" | |
end | |
end | |
task :stop do | |
on roles(:all) , :except => { :no_release => true } do | |
begin | |
execute "#{fetch(:try_sudo)} kill `cat #{fetch(:unicorn_pid)}`" | |
rescue | |
puts "\tUNICORN PID #{fetch(:unicorn_pid)} not exists" | |
end | |
end | |
end | |
task :graceful_stop do | |
on roles(:app) , :except => { :no_release => true } do | |
execute "#{fetch(:try_sudo)} kill -s QUIT `cat #{fetch(:unicorn_pid)}`" | |
end | |
end | |
task :reload do | |
on roles(:app) , :except => { :no_release => true } do | |
execute "#{fetch(:try_sudo)} kill -s USR2 `cat #{fetch(:unicorn_pid)}`" | |
end | |
end | |
task :restart do | |
on roles(:all) , :except => { :no_release => true } do | |
invoke 'deploy:stop' | |
sleep 2 | |
invoke 'deploy:start' | |
end | |
end | |
task :logs do | |
on roles(:all) , :except => { :no_release => true } do | |
execute "tail -n 100 -f #{File.join(current_path, 'log', "#{fetch(:rails_env)}.log")}" | |
end | |
end | |
end | |
after 'deploy:finished', 'deploy:restart' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment