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.
Supported formatsThe package registry supports the following formats:
The package registry is also used to store model registry data.
Accepting contributionsThe following table lists package formats that are not supported. Consider contributing to GitLab to add support for these formats.
Rate limitsWhen 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.
Enable or disable the package registryThe package registry is enabled by default. To disable it:
Edit /etc/gitlab/gitlab.rb
:
# Change to true to enable packages - enabled by default if not defined
gitlab_rails['packages_enabled'] = false
Save the file and reconfigure GitLab:
sudo gitlab-ctl reconfigure
Export the Helm values:
helm get values gitlab > gitlab_values.yaml
Edit gitlab_values.yaml
:
global:
appConfig:
packages:
enabled: false
Save the file and apply the new values:
helm upgrade -f gitlab_values.yaml gitlab gitlab/gitlab
Edit docker-compose.yml
:
version: "3.6"
services:
gitlab:
environment:
GITLAB_OMNIBUS_CONFIG: |
gitlab_rails['packages_enabled'] = false
Save the file and restart GitLab:
Edit /home/git/gitlab/config/gitlab.yml
:
production: &base
packages:
enabled: false
Save the file and restart GitLab:
# For systems running systemd
sudo systemctl restart gitlab.target
# For systems running SysV init
sudo service gitlab restart
By default, the packages are stored locally, but you can change the default local location or even use object storage.
Change the local storage pathBy default, the packages are stored in a local path, relative to the GitLab installation:
/var/opt/gitlab/gitlab-rails/shared/packages/
/home/git/gitlab/shared/packages/
To change the local storage path:
Edit /etc/gitlab/gitlab.rb
and add the following line:
gitlab_rails['packages_storage_path'] = "/mnt/packages"
Save the file and reconfigure GitLab:
sudo gitlab-ctl reconfigure
Edit /home/git/gitlab/config/gitlab.yml
:
production: &base
packages:
enabled: true
storage_path: /mnt/packages
Save the file and restart GitLab:
# For systems running systemd
sudo systemctl restart gitlab.target
# For systems running SysV init
sudo service gitlab restart
If you already had packages stored in the old storage path, move everything from the old to the new location to ensure existing packages stay accessible:
mv /var/opt/gitlab/gitlab-rails/shared/packages/* /mnt/packages/
Docker and Kubernetes do not use local storage.
/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.Instead of relying on the local storage, you can use an object storage to store packages.
For more information, see how to use the consolidated object storage settings.
Migrate packages between object storage and local storageAfter configuring object storage, you can use the following tasks to migrate packages between local and remote storage. The processing is done in a background worker and requires no downtime.
Migrate to object storageMigrate the packages to object storage:
sudo gitlab-rake "gitlab:packages:migrate"
RAILS_ENV=production sudo -u git -H bundle exec rake gitlab:packages:migrate
Track the progress and verify that all packages migrated successfully using the PostgreSQL console:
sudo gitlab-rails dbconsole
sudo gitlab-rails dbconsole --database main
RAILS_ENV=production sudo -u git -H psql -d gitlabhq_production
Verify that all packages migrated to object storage with the following SQL query. The number of objectstg
should be the same as total
:
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;
Example output:
total | filesystem | objectstg
------+------------+-----------
34 | 0 | 34
Finally, verify that there are no files on disk in the packages
directory:
sudo find /var/opt/gitlab/gitlab-rails/shared/packages -type f | grep -v tmp | wc -l
sudo -u git find /home/git/gitlab/shared/packages -type f | grep -v tmp | wc -l
Migrate the packages from object storage to local storage:
sudo gitlab-rake "gitlab:packages:migrate[local]"
RAILS_ENV=production sudo -u git -H bundle exec rake "gitlab:packages:migrate[local]"
Track the progress and verify that all packages migrated successfully using the PostgreSQL console:
sudo gitlab-rails dbconsole
sudo gitlab-rails dbconsole --database main
RAILS_ENV=production sudo -u git -H psql -d gitlabhq_production
Verify that all packages migrated to local storage with the following SQL query. The number of filesystem
should be the same as total
:
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;
Example output:
total | filesystem | objectstg
------+------------+-----------
34 | 34 | 0
Finally, verify that the files exist in the packages
directory:
sudo find /var/opt/gitlab/gitlab-rails/shared/packages -type f | grep -v tmp | wc -l
sudo -u git find /home/git/gitlab/shared/packages -type f | grep -v tmp | wc -l
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4