This document describes the storage of the package registry and how it can be managed.
The package registry has a build-in deduplication of uploaded blobs. If two identical files are uploaded only one blob is saved on the filesystem. This ensures no space is wasted for duplicated files.
If two packages are uploaded with identical files, both packages will display the same size but on the filesystem they require only half of the size. Whenever a package gets deleted, only the references to the underlying blobs are removed. The blobs get not removed at this moment, so they still require space on the filesystem. When a new package gets uploaded the existing blobs may get referenced again.
These unreferenced blobs get deleted by a clean up job.
The config setting
OLDER_THAN configures how long unreferenced blobs are kept before they get deleted.
Package registries can become large over time without cleanup. It's recommended to delete unnecessary packages and set up cleanup rules to automatically manage the package registry usage. Every package owner (user or organization) manages the cleanup rules which are applied to their packages.
|Enabled||Turn the cleanup rule on or off.|
|Type||Every rule manages a specific package type.|
|Apply pattern to full package name||If enabled, the patterns below are applied to the full package name (|
|Keep the most recent||How many versions to always keep for each package.|
|Keep versions matching||The regex pattern that determines which versions to keep. An empty pattern keeps no version while |
|Remove versions older than||Remove only versions older than the selected days.|
|Remove versions matching||The regex pattern that determines which versions to remove. An empty pattern or |
Every cleanup rule can show a preview of the affected packages. This can be used to check if the cleanup rules is proper configured.
Regex patterns are automatically surrounded with
Do not include any
$ token in the regex patterns as they are not necessary.
The patterns are case-insensitive which matches the behaviour of the package registry in Gitea.
|Match every possible version.|
|Match versions that start with |
|Match only the version |
|Match versions that are either named or start with |
|Match versions that contain |
|Match versions that either start with |
|Match versions of the package |
How the cleanup rules work
The cleanup rules are part of the clean up job and run periodically.
The cleanup rule:
- Collects all packages of the package type for the owners registry.
- For every package it collects all versions.
- Excludes from the list the # versions based on the Keep the most recent value.
- Excludes from the list any versions matching the Keep versions matching value.
- Excludes from the list the versions more recent than the Remove versions older than value.
- Excludes from the list any versions not matching the Remove versions matching value.
- Deletes the remaining versions.