A mechanism to cleanup object storage for orphaned pages deployments
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
The following discussion from !137645 (merged) should be addressed:
-
@perlun started a discussion: (+1 comment) One thing I've thought about: because of the bug ( #432689 (closed)), our environments (SaaS and on-premise) will now contain a number of "stale"
artifacts.zipfiles in thepages_deploymentsdirectory. Should we provide some form of migration script to clean up this when the 16.7 (or whichever release this gets merged into) is installed?🤔 (I'd preferably not see this as a blocker for getting this merged, but it would be good to make a conscious decision about this before considering #432689 (closed) done)
Given there will no be a variety of artifacts lingering for uses of page deployments, we'll need to clean these up.
Implementation Plan
The problem is actually common for other types of objects in the object storage as well, e.g. artifacts. Ideally we would have a maintenance task that users can run to clean their buckets.
Some ways to implement this:
- Create a post migration script which reads every PagesDeployment, resolves their file paths, then grabs a list of all currently present files related to PagesDeployments, and deletes the ones that don't have a corresponding record.
- Create a rake task which will perform it (it probably can call the same underlying service as the post-migration)
- Expand this task to other types of artifacts.
Please break this issue down to:
- Proof of concept
- Manual rake task
- Post-deployment migration