Peter Marklund

Peter Marklund's Home

Wed August 06, 2008
Programming

Faster Capistrano Subversion Deployments with remote_cache

This is old news, but if you are deploying an application with Capistrano from Subversion and you find yourself waiting impatiently for the checkout to happen everytime, try adding this to deploy.rb:

set :deploy_via, :remote_cache

With this setting Capistrano will keep a Subversion checkout under shared/cached-copy, and on each deploy just do an svn update followed by a local copy of the whole tree into releases. I found this to be significantly faster than the default checkout on each deploy.

I am planning to switch to Git and GitHub now, and I am curious to see if this setting will affect deployment speed with Git. Given that a git clone in my experience is blazingly fast, maybe the remote cache won't be needed?

Comments

David Backeus said over 6 years ago:

It will work on git. You will also want to set:
set :git_shallow_clone, 1

See this guide for more info:
http://github.com/guides/deploying-with-capistrano

--------------------------------------------------------------------------------

Damien said over 6 years ago:

Hum I got a stupid question.

At my work when we deploy new software or version of software,
our capistrano deploys a tag using an svn export...

Any particular reason for you to deploy using checkout
and several time on same branch ?

--------------------------------------------------------------------------------

Peter Marklund said over 6 years ago:

Damien,
dunno about export versus checkout. To me using export sounds more appropriate. However, sometimes I have been cd:ing into the current_path on the server, done an svn update db/migrate, and then run migrations with rake db:migrate manually. However, I think most of the time, and especially if you keep your migrations backwards compatible, then it's probably better to deploy with cap deploy:migrations so that Capistrano runs the migrations for you.

--------------------------------------------------------------------------------

Damien said over 6 years ago:

Oh I see, thank you for your answer :)

--------------------------------------------------------------------------------