Skip to content

Instantly share code, notes, and snippets.

Created November 29, 2013 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/7707266 to your computer and use it in GitHub Desktop.
Save anonymous/7707266 to your computer and use it in GitHub Desktop.
set :application, 'my_app_name'
set :repo_url, 'git@bitbucket.org:my-username/my-repo.git'
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }
set :deploy_to, '/path/to/app'
set :scm, :git
set :branch, "master"
set :user, "deploy" # deploying user on server
# set :scm_passphrase, ""
set :rails_env, "production"
set :deploy_via, :copy
set :ssh_options, { :forward_agent => true}
# set :format, :pretty
# set :log_level, :debug
set :pty, true
# set :linked_files, %w{config/database.yml}
# set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }
set :keep_releases, 5
server "server-ip" #, user: '', roles: %w{web app db} #:app, :web, :db, :primary => true
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
# Your restart mechanism here, for example:
# execute :touch, release_path.join('tmp/restart.txt')
end
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment