Commit 3b2f7d27 authored by Tim Rizzi's avatar Tim Rizzi Committed by Nick Gaskill

Add docs about reducing storage for Package

parent 96be2cfd
...@@ -258,7 +258,7 @@ being cleaned up is minimal. ...@@ -258,7 +258,7 @@ being cleaned up is minimal.
- [Delete registry repository](../../../api/container_registry.md#delete-registry-repository) - [Delete registry repository](../../../api/container_registry.md#delete-registry-repository)
- [Delete a registry repository tag](../../../api/container_registry.md#delete-a-registry-repository-tag) - [Delete a registry repository tag](../../../api/container_registry.md#delete-a-registry-repository-tag)
- [Delete registry repository tags in bulk](../../../api/container_registry.md#delete-registry-repository-tags-in-bulk) - [Delete registry repository tags in bulk](../../../api/container_registry.md#delete-registry-repository-tags-in-bulk)
- [Delete a package](../package_registry/index.md#delete-a-package) - [Delete a package](../package_registry/reduce_package_registry_storage.md#delete-a-package)
## Troubleshooting cleanup policies ## Troubleshooting cleanup policies
......
...@@ -210,65 +210,8 @@ from the GitLab server. ...@@ -210,65 +210,8 @@ from the GitLab server.
## Reduce storage usage ## Reduce storage usage
Blobs are kept forever on the GitLab server, and there is no hard limit on how much data can be For information on reducing your storage use on the Dependency Proxy, see
stored. [Reduce Dependency Proxy storage use](reduce_dependency_proxy_storage.md).
### Using 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.
## Docker Hub rate limits and the Dependency Proxy ## Docker Hub rate limits and the Dependency Proxy
......
---
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.
...@@ -12,6 +12,15 @@ With the GitLab Package Registry, you can use GitLab as a private or public regi ...@@ -12,6 +12,15 @@ With the GitLab Package Registry, you can use GitLab as a private or public regi
of [supported package managers](#supported-package-managers). of [supported package managers](#supported-package-managers).
You can publish and share packages, which can be consumed as a dependency in downstream projects. You can publish and share packages, which can be consumed as a dependency in downstream projects.
## Package workflows
Learn how to use the GitLab Package Registry to build your own custom package workflow:
- [Use a project as a package registry](../workflows/project_registry.md)
to publish all of your packages to one project.
- Publish multiple different packages from one [monorepo project](../workflows/working_with_monorepos.md).
## View packages ## View packages
You can view packages for your project or group. You can view packages for your project or group.
...@@ -77,46 +86,10 @@ when you view the package details: ...@@ -77,46 +86,10 @@ when you view the package details:
You can view which pipeline published the package, and the commit and user who triggered it. However, the history is limited to five updates of a given package. You can view which pipeline published the package, and the commit and user who triggered it. However, the history is limited to five updates of a given package.
## Download a package ## Reduce storage usage
To download a package: For information on reducing your storage use for the Package Registry, see
[Reduce Dependency Proxy storage use](reduce_package_registry_storage.md).
1. Go to **Packages & Registries > Package Registry**.
1. Select the name of the package you want to download.
1. In the **Activity** section, select the name of the package you want to download.
## Delete a package
You cannot edit a package after you publish it in the Package Registry. Instead, you
must delete and recreate it.
To delete a package, you must have suitable [permissions](../../permissions.md).
You can delete packages by using [the API](../../../api/packages.md#delete-a-project-package) or the UI.
To delete a package in the UI, from your group or project:
1. Go to **Packages & Registries > Package Registry**.
1. Find the name of the package you want to delete.
1. Click **Delete**.
The package is permanently deleted.
## Delete files associated with a package
To delete package files, you must have suitable [permissions](../../permissions.md).
You can delete packages by using [the API](../../../api/packages.md#delete-a-package-file) or the UI.
To delete package files in the UI, from your group or project:
1. Go to **Packages & Registries > Package Registry**.
1. Find the name of the package you want to delete.
1. Select the package to view additional details.
1. Find the name of the file you would like to delete.
1. Expand the ellipsis and select **Delete file**.
The package files are permanently deleted.
## Disable the Package Registry ## Disable the Package Registry
...@@ -135,15 +108,6 @@ You can also remove the Package Registry for your project specifically: ...@@ -135,15 +108,6 @@ You can also remove the Package Registry for your project specifically:
The **Packages & Registries > Package Registry** entry is removed from the sidebar. The **Packages & Registries > Package Registry** entry is removed from the sidebar.
## Package workflows
Learn how to use the GitLab Package Registry to build your own custom package workflow:
- [Use a project as a package registry](../workflows/project_registry.md)
to publish all of your packages to one project.
- Publish multiple different packages from one [monorepo project](../workflows/working_with_monorepos.md).
## Supported package managers ## Supported package managers
WARNING: WARNING:
......
---
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 Package Registry Storage **(FREE)**
Without cleanup, package registries become large over time. When a large number of packages and
their files are added:
- Fetching the list of packages becomes slower.
- They take up a large amount of storage space on the server, impacting your [storage usage quota](../../usage_quotas.md).
We recommend deleting unnecessary packages and files. This page offers examples of how to do so.
## Check Package Registry Storage Use
The Usage Quotas page (**Settings > Usage Quotas > Storage**) displays storage usage for Packages.
## Delete a package
You cannot edit a package after you publish it in the Package Registry. Instead, you
must delete and recreate it.
To delete a package, you must have suitable [permissions](../../permissions.md).
You can delete packages by using [the API](../../../api/packages.md#delete-a-project-package) or the UI.
To delete a package in the UI, from your group or project:
1. Go to **Packages & Registries > Package Registry**.
1. Find the name of the package you want to delete.
1. Click **Delete**.
The package is permanently deleted.
## Delete files associated with a package
To delete package files, you must have suitable [permissions](../../permissions.md).
You can delete packages by using [the API](../../../api/packages.md#delete-a-package-file) or the UI.
To delete package files in the UI, from your group or project:
1. Go to **Packages & Registries > Package Registry**.
1. Find the name of the package you want to delete.
1. Select the package to view additional details.
1. Find the name of the file you would like to delete.
1. Expand the ellipsis and select **Delete file**.
The package files are permanently deleted.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment