Capistrano - clean up old releases

Viewed 43749

Usually when using capistrano, I will go and manually delete old releases from a deployed application. I understand that you can run cap deploy:cleanup but that still leaves 5 releases. Is this it's intended purpose? Is there another way to cleanup old releases to just 1 previous deploy?

4 Answers

You can use the :keep_releases variable to override the default of 5. Check this out.

You could do this automatically by setting this in your deploy.rb

set :keep_releases, 1
after "deploy:update", "deploy:cleanup" 

In the past(I don't know exactly which version) this callback was the default, but later the developer decided to leave it to the user to decide. In capistrano 3 it was added back to the default deploy flow.

Related