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).

Similar posts

Comments

releu commented 8 months ago

757fb0d5ec7560b6f25f5bd98eadc020?size=52

after \"deploy:update_code\", \"deploy:cleanup\" - wtf?

makaroni4 commented 8 months ago

E302c3320cd14b02cbe237b479d7f884?size=52

Haha typos – I copied this text from log file :smile:

IndigoCZ commented 8 months ago

02cd104e03bad8ca70746a6413bb1fe8?size=52

I think it would be much clearer to talk about 1TB of disk space rather than 1Tb of memory.

kirs commented 8 months ago

Ab074ca0a48f06ab110c374fc7db258e?size=52

Somebody just forgot to put keep_releases into the receipt. It's something really bad :)

IndigoCZ
kirs
makaroni4
releu