用开源工具 Pulp 管理你的软件仓库
仓库 Pulp

> 
> 这篇文章介绍 Pulp，一个开源仓库管理解决方案，它的使用范围和功能在不断增长。
> 
> 
> 


![](/data/attachment/album/202009/15/205353hlidoullmmj44vzq.jpg)


[Foreman](https://opensource.com/article/17/8/system-management-foreman) 是一个强大的管理和自动化产品，它为 Linux 环境的管理员提供了企业级的解决方案，它适用于四个关键场景：供应管理、配置管理、补丁管理和内容管理。Foreman 中内容管理功能的一个主要组成部分是由 Pulp 项目提供的。虽然 Pulp 是这个产品的一个组成部分，但它也是一个独立的、自由开源的项目，自身也在取得巨大的进步。


让我们来看看 Pulp 项目，特别是最新版本 Pulp 3 的功能。


### 什么是 Pulp？


Pulp 是一个管理软件包仓库，并将其提供给大量的消费者的平台。你可以使用 Pulp 在不同环境中镜像、同步、上传和推广各种内容，如 RPM、Python 包、Ansible 集合、容器镜像等。如果你有几十个、几百个甚至上千个软件包，并需要更好的方式来管理它们，Pulp 可以帮助你。


最新的主要版本是 [Pulp 3](https://pulpproject.org/about-pulp-3/)，它于 2019 年 12 月发布。Pulp 3 是多年来收集用户需求的结晶，并对现有的 Pulp 架构进行了全面的技术改造，以提高可靠性和灵活性。另外，它还包含了大量的新功能。


### 谁在使用 Pulp？


大多数情况下，在 Pulp 用户管理的企业软件环境中，内容的稳定性和可靠性是最重要的。Pulp 用户希望有一个平台来开发内容，而不用担心仓库可能会消失。他们希望以安全的方式在其生命周期环境的不同阶段推广内容，优化磁盘空间并扩展环境以满足新的需求。他们还需要灵活处理各种内容类型。Pulp 3 提供了这些以及更多功能。


### 在一处管理各类内容


安装 Pulp 后，你可以为你计划管理的内容类型添加[内容插件](https://pulpproject.org/content-plugins/)，将内容镜像到本地，添加私人托管的内容，并根据你的需求混合内容。例如，如果你是 Ansible 用户，而你又不想在 Ansible Galaxy 上托管你的私有内容，你可以添加 Pulp Ansible 插件，镜像你所需要的公共 Ansible 内容，并将 Pulp 作为一个内部平台，在你的组织中管理和分发可扩展的公共和私有 Ansible 角色和集合的混合。你可以用任何内容类型执行此操作。有各种各样的内容插件可供选择，包括 RPM、Debian、Python、容器和 Ansible 等等。还有一个文件插件，你可以用它来管理 ISO 镜像等文件。


如果你没有找到你所需的内容类型插件，Pulp 3 引入了新的插件 API 和插件模板，你可以轻松创建一个属于自己的 Pulp 插件。你可以根据[插件编写指南](https://docs.pulpproject.org/plugins/plugin-writer/index.html)自动生成一个最小可用的插件，然后从那里开始构建。


### 高可用性


在 Pulp 3 中，从 MongoDB 到 PostgreSQL 的转变促进了性能和数据完整性的重大改进。Pulp 用户现在有了一个完全开源的技术栈，它可以提供高可用性（HA）和更好的扩展性。


### 仓库版本管理


使用 Pulp 3，你可以毫无风险地进行试验。每次你添加或删除内容时，Pulp 都会创建一个不可变的仓库版本，这样你就可以回滚到早期的版本，从而保证操作的安全性和稳定性。通过使用发布和分发，你可以公开一个仓库的多个版本，你可以将其作为回滚到早期版本的另一种方法。如要回滚，你可以简单地将你的分发指向一个旧的发布。


### 磁盘优化


任何软件开发环境的主要挑战之一是磁盘优化。如果你不断地下载包，例如，你今天需要但明天不再需要的仓库每日构建，那么磁盘空间将很快成为一个问题。Pulp 3 的设计已经考虑到了磁盘优化。当默认下载并保存所有的软件包，你也可以启用“按需”或“流式”选项。“按需”选项只下载和保存客户要求的内容，从而节省了磁盘空间。使用“流式”选项，它也会根据客户的要求进行下载，但它不会将内容保存在 Pulp 中。这对于同步内容是非常理想的，例如，从一个每日仓库同步，并让你在后期免于执行磁盘清理。


### 多种存储选项


即使进行了最好的磁盘优化，随着项目的发展，你可能需要一种方法来扩展你的部署以满足需求。除了本地文件存储，Pulp 还支持一系列的云存储选项，如 Amazon S3 和 Azure，以确保你可以扩展满足你的部署需求。


### 保护你的内容


Pulp 3 可以选择添加 [Certguard](https://pulp-certguard.readthedocs.io/en/latest/) 插件，该插件提供了一个支持 X.509 的 ContentGuard，它要求客户在收到 Pulp 的内容之前提交证明其对内容的权利的证书。


只要客户端的证书没有过期，且由证书颁发机构签署，并在创建时存储在 Certguard 上，任何客户端在请求时提供基于 X.509 或基于 Red Hat 订阅管理证书都将获得授权。客户端使用安全传输层（TLS）提供证书，这证明客户端不仅有证书，还有它的密钥。你可以放心地开发，知道你的内容正在受到保护。


Pulp 团队也在积极为整个 Pulp 部署一个基于角色的访问控制系统，这样管理员就可以确保正确的用户可以访问正确的环境。


### 在容器中试用 Pulp


如果你有兴趣亲自评估 Pulp 3，你可以使用 Docker 或 Podman 轻松[在容器中安装 Pulp 3](https://pulpproject.org/pulp-in-one-container/)。Pulp 团队一直在努力简化安装过程。你也可以使用 [Ansible 剧本](https://pulp-installer.readthedocs.io/en/latest/) 来自动完成 Pulp 3 的全部安装和配置。




---


via: <https://opensource.com/article/20/8/manage-repositories-pulp>


作者：[Melanie Corr](https://opensource.com/users/melanie-corr) 选题：[lujun9972](https://github.com/lujun9972) 译者：[geekpi](https://github.com/geekpi) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
[Foreman](https://opensource.com/article/17/8/system-management-foreman) is a robust management and automation product that provides administrators of Linux environments with enterprise-level solutions for four key scenarios: provisioning management, configuration management, patch management, and content management. A major component of the content management functionality in Foreman is provided by the Pulp project. While Pulp is an integral part of this product, it is also a standalone, free, and open source project that is making huge progress on its own.

Let's take a look at the Pulp project, especially the features of the latest release, Pulp 3.

## What is Pulp?

Pulp is a platform for managing repositories of software packages and making them available to a large number of consumers. You can use Pulp to mirror, synchronize, upload, and promote content like RPMs, Python packages, Ansible collections, container images, and more across different environments. If you have dozens, hundreds, or even thousands of software packages and need a better way to manage them, Pulp can help.

The latest major version is [Pulp 3](https://pulpproject.org/about-pulp-3/), which was released in December 2019. Pulp 3 is the culmination of years of gathering user requirements and a complete technical overhaul of the existing Pulp architecture to increase reliability and flexibility. Plus, it includes a vast range of new features.

## Who uses Pulp?

For the most part, Pulp users administer enterprise software environments where the stability and reliability of content are paramount. Pulp users want a platform to develop content without worrying that repositories might disappear. They want to promote content across the different stages of their lifecycle environment in a secure manner that optimizes disk space and scales their environment to meet new demands. They also need the flexibility to work with a wide variety of content types. Pulp 3 provides that and more.

## Manage a wide variety of content in one place


After you install Pulp, you can add [content plugins](https://pulpproject.org/content-plugins/) for the content types that you plan to manage, mirror the content locally, add privately hosted content, and blend content to suit your requirements. If you’re an Ansible user, for example, and you don't want to host your private content on Ansible Galaxy, you can add the Pulp Ansible plugin, mirror the public Ansible content that you require, and use Pulp as an on-premise platform to manage and distribute a scalable blend of public and private Ansible roles and collections across your organization. You can do this with any content type. There is a wide variety of content plugins available, including RPM, Debian, Python, Container, and Ansible, to name but a few. There is also a File plugin, which you can use to manage files like ISO images.

If you don't find a plugin for the content type that you require, Pulp 3 has introduced a new plugin API and plugin template to make it easy to create a Pulp plugin of your own. You can use the [plugin writing guide](https://docs.pulpproject.org/plugins/plugin-writer/index.html) to autogenerate a minimal viable plugin, and then start building from there.

## High availability

With Pulp 3, the change from MongoDB to PostgreSQL facilitated major improvements around performance and data integrity. Pulp users now have a fully open source tech stack that provides high availability (HA) and better scalability.

## Repository versioning

Using Pulp 3, you can experiment without risk. Every time you add or remove content, Pulp creates an immutable repository version so that you can roll back to earlier versions and thereby guarantee the safety and stability of your operation. Using publications and distributions, you can expose multiple versions of a repository, which you can use as another method of rolling back to an earlier version. To roll back, you can simply point your distribution to an older publication.

## Disk optimization

One of the major challenges for any software development environment is disk optimization. If you're downloading a constant stream of packages—for example, nightly builds of repositories that you require today but will no longer require tomorrow—disk space will quickly become an issue. Pulp 3 has been designed with disk optimization in mind. While the default option downloads and saves all software packages, you can also enable either the "on demand" or "streamed" option. The "on demand" option saves disk space by downloading and saving only the content that clients request. With the "streamed" option, you also download upon client request, but you don't save the content in Pulp. This is ideal for synchronizing content, for example, from a nightly repository, and saves you from having to perform a disk cleanup at a later stage.

## Multiple storage options

Even with the best disk optimization, as your project grows, you might need a way to scale your deployment to match your requirements. As well as local file storage, Pulp supports a range of cloud storage options, such as Amazon S3 and Azure, to ensure that you can scale to meet the demands of your deployment.

## Protect your content

Pulp 3 has the option of adding the [Certguard](https://pulp-certguard.readthedocs.io/en/latest/) plugin, which provides an X.509 capable ContentGuard that requires clients to submit a certificate proving their entitlement to content before receiving content from Pulp.

Any client presenting an X.509 or Red Hat Subscription Management-based certificate at request time will be authorized, as long as the client certification is not expired, is signed by the Certificate Authority, and was stored on the Certguard when it was created. The client presents the certificate using transport layer security (TLS), which proves that the client has not only the certificate but also its key. You can develop, confident in the knowledge that your content is being protected.

The Pulp team is also actively working on a role-based access control system for the entire Pulp deployment so that administrators can ensure that the right users have access to the right environments.

## Try Pulp in a container

If you're interested in evaluating Pulp 3 for yourself, you can easily install [Pulp 3 in a Container](https://pulpproject.org/pulp-in-one-container/) using Docker or Podman. The Pulp team is constantly working on simplifying the installation process. You can also use an [Ansible playbook](https://pulp-installer.readthedocs.io/en/latest/) to automate the full installation and configuration of Pulp 3.

## Comments are closed.