Skip to content

Instantly share code, notes, and snippets.

@ngw
Created February 26, 2014 10:52
Show Gist options
  • Save ngw/b3bb7387e1a96561cf35 to your computer and use it in GitHub Desktop.
Save ngw/b3bb7387e1a96561cf35 to your computer and use it in GitHub Desktop.
require 'capistrano/bundler'
# config valid only for Capistrano 3.1
lock '3.1.0'
set :application, 'walter_sobchak'
set :repo_url, 'git@github.com:thefoolsrl/walter_sobchak.git'
# Default branch is :master
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }
# Default deploy_to directory is /var/www/my_app
set :deploy_to, '/home/deployer/apps/walter_sobchak'
# Default value for :scm is :git
set :scm, :git
set :branch, 'feature/deploy'
# Default value for :log_level is :debug
# set :log_level, :debug
# Default value for :linked_files is []
# set :linked_files, %w{config/database.yml}
# Default value for linked_dirs is []
# set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
set :keep_releases, 5
namespace :deploy do
desc 'Start application'
task :start do
on roles(:app), in: :sequence, wait: 5 do
run "#{sudo} service nginx restart"
end
end
desc 'Stop application' do
task :stop do
on roles(:app), in: :sequence, wait: 5 do
run "#{sudo} service nginx stop"
end
end
end
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
execute :touch, release_path.join('tmp/restart.txt')
end
end
after :publishing, :restart
after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
# Here we can do anything such as:
# within release_path do
# execute :rake, 'cache:clear'
# end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment