Peter Marklund

Peter Marklund's Home


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?

4 comment(s)


Damien said 2008-08-06 07:06:

Oh I see, thank you for your answer :)

Peter Marklund said 2008-08-06 07:01:

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 2008-08-06 06:52:

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 ?

David Backeus said 2008-08-06 02:31:

It will work on git. You will also want to set: set :git_shallow_clone, 1 See this guide for more info: