diff options
Diffstat (limited to 'doc/user/packages/dependency_proxy/reduce_dependency_proxy_storage.md')
-rw-r--r-- | doc/user/packages/dependency_proxy/reduce_dependency_proxy_storage.md | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/doc/user/packages/dependency_proxy/reduce_dependency_proxy_storage.md b/doc/user/packages/dependency_proxy/reduce_dependency_proxy_storage.md new file mode 100644 index 00000000000..cd04d2e696b --- /dev/null +++ b/doc/user/packages/dependency_proxy/reduce_dependency_proxy_storage.md @@ -0,0 +1,74 @@ +--- +stage: Package +group: Package +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments +--- + +# Reduce Dependency Proxy Storage **(FREE)** + +There's no automatic removal process for blobs. Unless you delete them manually, they're stored +indefinitely. Since this impacts your +[storage usage quota](../../usage_quotas.md), +it's important that you clear unused items from the cache. This page covers several options for +doing so. + +## Check Dependency Proxy Storage Use + +The Usage Quotas page (**Settings > Usage Quotas > Storage**) displays storage usage for Packages, which includes the Dependency Proxy, +however, the storage is not yet displayed. + +## Use the API to clear the cache + +To reclaim disk space used by image blobs that are no longer needed, use the +[Dependency Proxy API](../../../api/dependency_proxy.md) +to clear the entire cache. If you clear the cache, the next time a pipeline runs it must pull an +image or tag from Docker Hub. + +## Cleanup policies + +### Enable cleanup policies from within GitLab + +> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/340777) in GitLab 14.6 + +You can enable an automatic time-to-live (TTL) policy for the Dependency Proxy from the user +interface. To do this, navigate to your group's **Settings > Packages & Registries > Dependency Proxy** +and enable the setting to automatically clear items from the cache after 90 days. + +### Enable cleanup policies with GraphQL + +> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/294187) in GitLab 14.4. + +The cleanup policy is a scheduled job you can use to clear cached images that are no longer used, +freeing up additional storage space. The policies use time-to-live (TTL) logic: + +- The number of days is configured. +- All cached dependency proxy files that have not been pulled in that many days are deleted. + +Use the [GraphQL API](../../../api/graphql/reference/index.md#mutationupdatedependencyproxyimagettlgrouppolicy) +to enable and configure cleanup policies: + +```graphql +mutation { + updateDependencyProxyImageTtlGroupPolicy(input: + { + groupPath: "<your-full-group-path>", + enabled: true, + ttl: 90 + } + ) { + dependencyProxyImageTtlPolicy { + enabled + ttl + } + errors + } +} +``` + +See the [Getting started with GraphQL](../../../api/graphql/getting_started.md) +guide to learn how to make GraphQL queries. + +When the policy is initially enabled, the default TTL setting is 90 days. Once enabled, stale +dependency proxy files are queued for deletion each day. Deletion may not occur right away due to +processing time. If the image is pulled after the cached files are marked as expired, the expired +files are ignored and new files are downloaded and cached from the external registry. |