Quite often we see the C:\Octopus folder take up dozens or even 100s of GB of space. Can we clean up old deployments and free up some space?
By default Octopus will keep everything until the end of time. You can delete old releases and deployments by using the retention policy feature in Octopus Deploy. Please see this documentation here on how to set them: https://octopus.com/docs/administration/retention-policies.
I like to have a default retention policy for all the environments in the lifecycle.
But override that for production to keep a little more. It all depends on your requirements.
A couple of notes:
- The package retention policy on the server will not delete any packages tied to a release. If you set your package retention policy to 10 days and the deployment retention policy to 120 days it could be 120 days before the package is removed.
- Octopus will not remove any releases which appear on a dashboard. The query to determine this can be at times a little generous on what appears on a dashboard. It tends to err on the side of caution.
If you are turning on retention policies for the first time I recommend slow rolling it. If you’ve been using Octopus Deploy for 600 days, then set the retention policies to 570 days. Let that clear up old releases, then knock it down to 540 days. Repeat until you are to where you want to be.
You can trigger retention policies manually by going to the tasks page and searching for the latest retention policy task.
Click on that task to view the task details. Then click on the … in the top right corner and click on re-run.
If your server is filling up and you don’t want to wait for retention policies to run for all the releases you can also archive/move old packages out of the C:\Octopus\Packages folder. I’ve seen folks write a simple PS script to loop through all the files, find everything older than a year and move them to an archive. After you move them out of that folder you can run the re-indexer to remove old references from Octopus’ database.