Over the lifetime of a component hundreds maybe thousands of versions are created and filled with files. These versions are used in deployments (or sometimes not) and after a certain period of time they are just filling up disk space in your codestation as they are not needed anymore.
Artifact Cleanup Settings
Managing when to clean up these versions IBM UrbanCode Deploy provides artifact cleanup settings. This settings are used to decide when a version needs to be archived.
Let’s first have a look at the system settings.
This settings can be found in Settings > System Settings > Artifact Cleanup.
Here the configuration of the various settings is done. A value of -1 means that the versions are kept indefinitely, other values mean the given days or number of versions.
In this example:
- Daily Cleanup Start Time: when to start the cleanup process. Please be aware that the time provided is the time at your IBM UrbanCode Deploy Server.
- Default Application Snapshot Retention (days): Number of days application snapshots are kept, they can be overriden by component and environment settings.
- Default Version Retention for Component (days): Number of days component versions are kept.
- Default Number of Versions to Retain for Component: Only the latest versions up to this number for each Component is kept.
- Default Version Retention for Environment (days): Number of days environment versions are kept, they can be overidden by environment settings.
- Default Number of Versions to Retain for Environment: Number of versions to retain.
- Archive Path: Provide the file location (path) where the archive (compressed file) of a component version is written.
- With the Preview Version Cleanup button you can get a preview which versions for the selected component will be archived with the actual settings.
A word of Caution:
If you want to just remove versions from your system without archiving, leave the Archive Path empty. This means that the component versions will be deleted, and no archives created.
So please take care if you want to keep the archived versions!
Please look at Artifact cleanup settings for more details on the system settings.
Component Cleanup Configuration
The system settings can be overwritten in Component > Basic Settings of each component.
The default setting is Inherit Cleanup Settings and by removing the checkbox two properties are provided:
- Days to keep Versions: Number of days to keep the versions of the component
- Number of Versions to keep: Number of Versions to keep of the component
Environment Cleanup Configuration
Here the environment related settings can be overwritten by unchecking the Use Default Artifact Cleanup Settings
The following settings can be set:
- Days to Retain Application Snapshots: Overwrite the Application Snapshot retention setting
- Days to Retain Versions: Number of Days to keep a Version
- Number of Versions to Retain Number of Component Versions to keep
As these settings can be overwritten on environment and component level, with IBM UrbanCode Deploy Version 7.3.0 a new Cleanup Configuration page was provided to control and override individual settings if needed (except the Archive Path and Start Time).
In this example we see the component view filtered.
Note: This feature allows you to edit cleanup settings of multiple components and environments at once.
In this example I have selected several components and want to change their settings. Either I can select Inherit Cleanup Settings to reset to System settings, or provide new values.
For more details, please look at Configuring cleanup settings.
Cleaning up and Restoring Component Versions
How IBM UrbanCode Deploy decides now which artifact version will be archived or not?
Based on the settings configured on the different levels, IBM UrbanCode Deploy decides with the following decision flow when a component version is to be archived.
First it retrieves the settings from System Settings, then from each individual component, which overrode them and finally it checks the environment to which the component has been deployed.
Based on the values a decision is made to archive or to keep. More details how the decision flow works with examples can be found in IBM UrbanCode Deploy component version cleanup documentation.
Archiving and Restoring
When a component version is selected for archiving it will be zipped and put into a file at the location defined in the system settings. Then the data is removed from IBM UrbanCode Deploy datastorage. It is not possible to archive it again, as the data is removed.
Note: The archive contains only the files which are used in the component version, all meta data, like Version name, properties and more are still in the IBM UrbanCode Deploy Server database (which you also should backup regularly).
View Component Versions
In the versions tab of the component the the archived versions are indicated with (archived):
Restore from Backup
To restore a version, click on the version link (from above) to see the details.
Select "Restore from Backup"
A dialog appears and shows the originaly used archive name.
By pressing ok it will then restore the component version by accessing the archive file from the Archive Path.
This restored component version then can be used again for deployments. If this version is again selected for archiving the existing archive file will be overwritten.
Archived Files Management
IBM UrbanCode Deploy does not provide any functionality of managing the archived files, like moving or restoring from/to cold storage, or deleting all files older than x years. This does not mean, that managing them outside of IBM UrbanCode Deploy is not possible or supported.
There is no negative impact on the performance or functionality of IBM UrbanCode Deploy Server when you remove the archive files.
If a given version of a component is needed, use your tool of choice to put it back into the Archive Path and proceed with the restore process as described in Archiving and Restoring.
If you try to the version and the file is no more accessible in the Archive Path you will just get an message that this given filename does not exist.
In this case, put the file back to the Archive Path and try again.
There are many backup tools from the open source community (for example Amanda, Areca, Back in Time, Bacula) or professional enterprise software like Tivoli Storage Manager or others. There is a high chance that you will have one running in your data center or using the tools provided by your cloud provider.
We propose to use backup-tools for archiving (cold storage) and to remove the files from IBM UrbanCode Deploy archive location to free up space.
What is in Part 2?
In the second part of this articles, we will have a more hands-on approach on handling the archived files.