Jaap Haagmans The all-round IT guy

2Feb/110

Make Capistrano clean up!

I got a call today from one of my clients that his diskspace was filling up quite a bit. After a quick inspection, I noticed that there were 12 releases in the Capistrano tree. I forgot to tell capistrano to clean up old releases after its work was done. So, for future reference, make sure you add this line to any deploy script:

after 'deploy', 'deploy:cleanup'

This will make sure there are no more than 4 old releases in the Capistrano tree at all time. If, for any reason, you'd like to keep another number of releases, you can set the keep_releases variable like this:

set :keep_releases, 2