Speed up Capistrano deployments using a remote cached copy of repository

Posted About 13 years ago. Visible to the public.

You can seriously speed up deployments with Capistrano when using a local git repository on the server you are deploying to.

Simply add

set :deploy_via, :remote_cache
set :copy_exclude, [ '.git' ]

to your config/deploy.rb and Capistrano will create a clone in shared/cached-copy. This will be updated using git pull when deploying which transfers less bytes and is usually much faster. If deploy_via is set to use default settings (being "export"), Capistrano will do a full clone of the repository from your git host otherwise.

You will notice that this speeds up the deployment but unfortunately keeps the .git directory containing all repository information in each an every release. You can save the bytes by adding set :copy_exclude, [ '.git' ] to exclude this directory when cloning from the local repository.

Thomas Eisenbarth
Last edit
About 10 years ago
Keywords
Deployment
License
Source code in this card is licensed under the MIT License.
Posted by Thomas Eisenbarth to makandra dev (2011-05-02 10:05)