Skip to content

Instantly share code, notes, and snippets.

@vdaubry
Last active August 29, 2015 13:57
Show Gist options
  • Save vdaubry/9750386 to your computer and use it in GitHub Desktop.
Save vdaubry/9750386 to your computer and use it in GitHub Desktop.
deploy.rb
# config valid only for Capistrano 3.1
lock '3.1.0'
set :application, 'my-app'
set :repo_url, '[email protected]:my-app.git'
# Default deploy_to directory is /var/www/my_app
set :deploy_to, '/srv/www/my-app'
set :rvm_ruby_string, :local # use the same ruby as used locally for deployment
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
execute "mkdir -p #{release_path.join('tmp')}"
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