debian-mirror-gitlab/doc/administration/packages/index.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

206 lines
6.8 KiB
Markdown
Raw Normal View History

2020-06-23 00:09:42 +05:30
---
stage: Package
2023-01-13 00:05:48 +05:30
group: Package Registry
2022-11-25 23:54:43 +05:30
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
2020-06-23 00:09:42 +05:30
---
2021-04-29 21:17:54 +05:30
# GitLab Package Registry administration **(FREE SELF)**
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
To use GitLab as a private repository for a variety of common package managers, use the Package Registry.
You can build and publish
packages, which can be consumed as dependencies in downstream projects.
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
## Supported formats
The Package Registry supports the following formats:
2021-01-29 00:20:46 +05:30
2021-11-11 11:23:49 +05:30
| Package type | GitLab version |
|-------------------------------------------------------------------|----------------|
| [Composer](../../user/packages/composer_repository/index.md) | 13.2+ |
| [Conan](../../user/packages/conan_repository/index.md) | 12.6+ |
| [Go](../../user/packages/go_proxy/index.md) | 13.1+ |
| [Maven](../../user/packages/maven_repository/index.md) | 11.3+ |
| [npm](../../user/packages/npm_registry/index.md) | 11.7+ |
| [NuGet](../../user/packages/nuget_repository/index.md) | 12.8+ |
| [PyPI](../../user/packages/pypi_repository/index.md) | 12.10+ |
| [Generic packages](../../user/packages/generic_packages/index.md) | 13.5+ |
| [Helm Charts](../../user/packages/helm_repository/index.md) | 14.1+ |
2021-01-29 00:20:46 +05:30
## Accepting contributions
2022-07-23 23:45:48 +05:30
The below table lists formats that are not supported, but are accepting Community contributions for. Consider contributing to GitLab. This [development documentation](../../development/packages/index.md)
2021-02-22 17:27:13 +05:30
guides you through the process.
2021-01-29 00:20:46 +05:30
2021-03-11 19:13:27 +05:30
<!-- vale gitlab.Spelling = NO -->
2021-01-29 00:20:46 +05:30
| Format | Status |
| ------ | ------ |
| Chef | [#36889](https://gitlab.com/gitlab-org/gitlab/-/issues/36889) |
| CocoaPods | [#36890](https://gitlab.com/gitlab-org/gitlab/-/issues/36890) |
| Conda | [#36891](https://gitlab.com/gitlab-org/gitlab/-/issues/36891) |
| CRAN | [#36892](https://gitlab.com/gitlab-org/gitlab/-/issues/36892) |
2021-04-17 20:07:23 +05:30
| Debian | [Draft: Merge Request](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/50438) |
2021-01-29 00:20:46 +05:30
| Opkg | [#36894](https://gitlab.com/gitlab-org/gitlab/-/issues/36894) |
| P2 | [#36895](https://gitlab.com/gitlab-org/gitlab/-/issues/36895) |
| Puppet | [#36897](https://gitlab.com/gitlab-org/gitlab/-/issues/36897) |
| RPM | [#5932](https://gitlab.com/gitlab-org/gitlab/-/issues/5932) |
| RubyGems | [#803](https://gitlab.com/gitlab-org/gitlab/-/issues/803) |
| SBT | [#36898](https://gitlab.com/gitlab-org/gitlab/-/issues/36898) |
2021-04-17 20:07:23 +05:30
| Terraform | [Draft: Merge Request](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/18834) |
2021-01-29 00:20:46 +05:30
| Vagrant | [#36899](https://gitlab.com/gitlab-org/gitlab/-/issues/36899) |
2019-12-04 20:38:33 +05:30
2021-03-11 19:13:27 +05:30
<!-- vale gitlab.Spelling = YES -->
2023-03-04 22:38:38 +05:30
## Rate limits
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
When downloading packages as dependencies in downstream projects, many requests are made through the
Packages API. You may therefore reach enforced user and IP rate limits. To address this issue, you
can define specific rate limits for the Packages API. For more details, see [Package Registry Rate Limits](../../user/admin_area/settings/package_registry_rate_limits.md).
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
## Change the storage path
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
By default, the packages are stored locally, but you can change the default
local location or even use object storage.
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
### Change the local storage path
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
By default, the packages are stored in a local path, relative to the GitLab
installation:
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
- Linux package (Omnibus): `/var/opt/gitlab/gitlab-rails/shared/packages/`
- Self-compiled (source): `/home/git/gitlab/shared/packages/`
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
To change the local storage path:
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
::Tabs
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
:::TabTitle Linux package (Omnibus)
1. Edit `/etc/gitlab/gitlab.rb` and add the following line:
```ruby
gitlab_rails['packages_storage_path'] = "/mnt/packages"
2019-12-04 20:38:33 +05:30
```
2023-03-04 22:38:38 +05:30
1. Save the file and reconfigure GitLab:
```shell
sudo gitlab-ctl reconfigure
```
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
:::TabTitle Self-compiled (source)
2021-01-29 00:20:46 +05:30
2023-03-04 22:38:38 +05:30
1. Edit `/home/git/gitlab/config/gitlab.yml`:
2021-01-29 00:20:46 +05:30
```yaml
2023-03-04 22:38:38 +05:30
production: &base
packages:
enabled: true
storage_path: /mnt/packages
2021-01-29 00:20:46 +05:30
```
2023-03-04 22:38:38 +05:30
1. Save the file and restart GitLab:
2021-01-29 00:20:46 +05:30
2023-03-04 22:38:38 +05:30
```shell
# For systems running systemd
sudo systemctl restart gitlab.target
2021-06-08 01:23:25 +05:30
2023-03-04 22:38:38 +05:30
# For systems running SysV init
sudo service gitlab restart
```
2021-06-08 01:23:25 +05:30
2023-03-04 22:38:38 +05:30
::EndTabs
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
Docker and Kubernetes do not use local storage.
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
- For the Helm chart (Kubernetes): Use object storage instead.
- For Docker: The `/var/opt/gitlab/` directory is already
mounted in a directory on the host. There's no need to change the local
storage path inside the container.
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
### Use object storage
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
Instead of relying on the local storage, you can use an object storage to store
packages.
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
For more information, see how to use the
[consolidated object storage settings](../object_storage.md#consolidated-object-storage-configuration).
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
### Migrate local packages to object storage
After [configuring the object storage](#use-object-storage), use the following task to
migrate existing packages from the local storage to the remote storage.
The processing is done in a background worker and requires **no downtime**.
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
1. Migrate the packages.
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
::Tabs
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
:::TabTitle Linux package (Omnibus)
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
```shell
sudo gitlab-rake "gitlab:packages:migrate"
2019-12-04 20:38:33 +05:30
```
2023-03-04 22:38:38 +05:30
:::TabTitle Self-compiled (source)
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
```shell
RAILS_ENV=production sudo -u git -H bundle exec rake gitlab:packages:migrate
```
2020-04-22 19:07:51 +05:30
2023-03-04 22:38:38 +05:30
::EndTabs
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
1. Track the progress and verify that all packages migrated successfully using
the PostgreSQL console.
2020-07-28 23:09:34 +05:30
2023-03-04 22:38:38 +05:30
::Tabs
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
:::TabTitle Linux package (Omnibus) 14.1 and earlier
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
```shell
sudo gitlab-rails dbconsole
2019-12-04 20:38:33 +05:30
```
2023-03-04 22:38:38 +05:30
:::TabTitle Linux package (Omnibus) 14.2 and later
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
```shell
sudo gitlab-rails dbconsole --database main
2019-12-04 20:38:33 +05:30
```
2023-03-04 22:38:38 +05:30
:::TabTitle Self-compiled (source)
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
```shell
RAILS_ENV=production sudo -u git -H psql -d gitlabhq_production
```
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
::EndTabs
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
1. Verify that all packages migrated to object storage with the following SQL
query. The number of `objectstg` should be the same as `total`:
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
```shell
gitlabhq_production=# SELECT count(*) AS total, sum(case when file_store = '1' then 1 else 0 end) AS filesystem, sum(case when file_store = '2' then 1 else 0 end) AS objectstg FROM packages_package_files;
2019-12-04 20:38:33 +05:30
2023-03-04 22:38:38 +05:30
total | filesystem | objectstg
------+------------+-----------
34 | 0 | 34
```
2021-09-30 23:02:18 +05:30
2023-03-04 22:38:38 +05:30
1. Finally, verify that there are no files on disk in the `packages` directory:
2021-09-30 23:02:18 +05:30
2023-03-04 22:38:38 +05:30
::Tabs
2022-01-26 12:08:38 +05:30
2023-03-04 22:38:38 +05:30
:::TabTitle Linux package (Omnibus)
2021-09-30 23:02:18 +05:30
2023-03-04 22:38:38 +05:30
```shell
sudo find /var/opt/gitlab/gitlab-rails/shared/packages -type f | grep -v tmp | wc -l
```
2021-09-30 23:02:18 +05:30
2023-03-04 22:38:38 +05:30
:::TabTitle Self-compiled (source)
2022-01-26 12:08:38 +05:30
2023-03-04 22:38:38 +05:30
```shell
sudo -u git find /home/git/gitlab/shared/packages -type f | grep -v tmp | wc -l
```
2022-01-26 12:08:38 +05:30
2023-03-04 22:38:38 +05:30
::EndTabs