Capistrano - clean up old releases

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.


If you want to delete all releases except the last 3 for example you can run:

cap deploy:cleanup -s keep_releases=3

Tags:

Capistrano