Purging Old Packages from NuGet Gallery

Topics: General
Oct 24, 2012 at 2:58 PM

We currently run a locally hosted NuGet Gallery for our company.  We have been having an issue with NuGet running very slow and the NuGet Gallery box becoming CPU bound.  When we had less packages within our NuGet Gallery, it ran much better, but is now becoming a hindrance.

I realize why you are not able to delete packages from NuGet Gallery's, but I believe this only applies to a Public Gallery.

My Question:  Is there a script that the Offical NuGet Gallery (http://nuget.org) uses to actually delete a package from the Feed?  (Delete from DB, and Packages Directory - NOT just hide / not list)  I know there is a way to request a true delete be done on their feed, but on my local feed I would like to have the ability to do this myself.  We need to purge our old packages that we will never use again.

Just to give you an idea on how bad this currently is, we only have 250 or so projects, but have over 59,500 packages.  That's more than NuGet.org itself!  We really only need to keep 2,500 or so of those packages.

Oct 31, 2012 at 2:05 AM

We have an implementation that is pretty specific to our Azure hosting configuration.  But the workflow is:

  1. For each version of the package:
    1. DELETE PackageAuthors for the package
    2. DELETE PackageDependencies for the package
    3. DELETE PackageStatistics for the package
    4. DELETE PackageFrameworks for the package
    5. DELETE Packages for the package
    6. Back up the package file in our backup blob storage (in case we need to recover it)
    7. Delete the package from the production blob storage
  2. DELETE PackageOwnerRequests for the package registration
  3. DELETE PackageRegistrationOwners for the package registration
  4. DELETE PackageRegistrations for the package registration

I hope this helps!

 

Nov 1, 2012 at 3:27 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.