Restrict number of releases when deploying with capistrano by makaroni4
The problem is simple – for large application one need to restrict number of releases saved on production server because sometimes it takes huge amount of space. In my case it were 714 releases folder (for 9 months of running project).
On production server I use #ubuntu so to check out space usage we need to run:
df -h
# => Filesystem Size Used Avail Use% Mounted on
# => /some/path 1.4T 288G 1.1T 22% /
To check size of specific folder you can run:
du -hs /folder
h in this commands stands for human and displays sizes like 100M for megabytes for example.
As you can see there is more than 1Tb of free memory BUT it was vice versa before I cleaned up old releases. Actually we don't need to run rm -rf. If you use #capistrano for deploying application you can specify number of releases to keep like this:
set :keep_releases, 15
after "deploy:update_code", "deploy:cleanup"
So this is how I save freed 1Tb of memory (disk space).
Comments
releu commented 8 months ago
after \"deploy:update_code\", \"deploy:cleanup\"- wtf?makaroni4 commented 8 months ago
Haha typos – I copied this text from log file
IndigoCZ commented 8 months ago
I think it would be much clearer to talk about 1TB of disk space rather than 1Tb of memory.
makaroni4 commented 8 months ago
@IndigoCZ, I will fix that, thank you!
kirs commented 8 months ago
Somebody just forgot to put keep_releases into the receipt. It's something really bad :)