Talk about bloat

I just woke up and wanted to some bugfixing. When I deployed the change, I noticed a line in the output about the server’s disk being full. I peeked in with the ncdu command and found out that half of the server’s disk was occupied by old releases. Not only that, with each release, the individual release folder would grow, from a tiny 2MB on the first release to 200MB on the latest.

When I dug deeper, the docs folder seemed to be the main offender. When I generate my docs with ex_doc, some assets in the form of css and js files are generated. For some reason, these do not get deleted. So every release will carry have a shitton of cruft from older releases, bloating the folder massively.

I’m suspecting this is the intended behaviour, since in ex_doc you can go back in time and look at docs for older releases. Since I’m not working on my docs right now but instead push several releases a day sometimes, I get versions of the docs that are almost completely the same.

Maybe there is a way to only generate docs on Semver minor releases.

EDIT: I edited my build script to exclude the docs for now, since I haven’t needed them until now. I also added a call to the mix phx.digest.clean command, which cleans up old assets.
The foldersize shrunk down to 50MB. Thats still a lot, but only a fourth of the last release, and I’m perfectly fine with that for now.

EDIT2: Just looked into the releases folder and the folders are down to 500k now! mind blown

Published * Last updated