Skip to content

Instantly share code, notes, and snippets.

@dipaktc
Created May 10, 2017 13:22
Show Gist options
  • Save dipaktc/459e5acd7e9716bba7f8bd55ad642cb5 to your computer and use it in GitHub Desktop.
Save dipaktc/459e5acd7e9716bba7f8bd55ad642cb5 to your computer and use it in GitHub Desktop.
# config valid only for current version of Capistrano
lock '3.4.0'
set :branch, 'master'
set :application, 'PROJECT-NAME'
set :repo_url, 'git@bitbucket.org:xx/xxxx.git'
set :whenever_identifier, ->{ "#{fetch(:application)}_#{fetch(:stage)}" }
set :whenever_roles, [:cron]
set :ssh_options, { :forward_agent => true }
set :sidekiq_role, :app
set :pty, false
set :linked_files, %w{config/database.yml config/unicorn.rb config/application.yml}
set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets vendor/bundle}
after 'deploy:publishing', 'deploy:restart'
namespace :deploy do
desc 'Restart application'
task :restart do
invoke 'unicorn:restart'
end
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
after :finishing, 'deploy:cleanup'
end
require 'airbrake/capistrano3'
after "deploy:finished", "airbrake:deploy"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment