A couple Capistrano tweaks to speed up deploys:
- All changes occur in
current
folder, git clones directly to this folder and usesreset
to deploy. - Symlinks in
deploy:finalize_update
all happen in one ssh connection - Rollback uses git as well
This overrides the following default capistrano tasks:
deploy:update_code
- Usesgit reset
instead of the standard:scm
and:deploy_via
providers.deploy:finalize_update
- Concatenates all symlink commands fromshared_children into a single ssh command. Also adds support for
mapped_shared_children` so you can add additional symlinks like this:
set :mapped_shared_children, {
'config/database.yml' => 'config/database.yml'
}
deploy:create_symlink
- This is now a no-op, there are no longer individual release directories.deploy:rollback
,deploy:rollback:repo
,deploy:rollback:cleanup
- Goes back to the previous place thatHEAD
was pointing (HEAD@{1}
). You don't want to do this if you go and monkey around with yourcurrent
folder manually.deploy:create_symlink
- This is now a no-op, there are no longer individual release directories.
Add this line to your application's Gemfile:
gem 'capistrano-fast_deploy'
And then execute:
$ bundle
Or install it yourself as:
$ gem install capistrano-fast_deploy
Add the following to your deploy.rb:
require 'capistrano/fast_deploy'
It should just work automatically. deploy:update_code
will "unsymlink"
your current directory. After that you can safely delete your releases
folder if you like.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request