Skip to content

Commit 7553d19

Browse files
authored
Editing pulp_fetch_upload.md (#2669)
* Auto formatting by editor, add appropriate spacing between code blocks * fenced code blocks need context (i.e. ```bash, ```text) * replace conjunctions with words * replace I/we/our with you/your * some other minor sentence rewording * replace passive voice phrasing with active voice * rename category to "repositories"
1 parent ff3af6d commit 7553d19

File tree

2 files changed

+99
-90
lines changed

2 files changed

+99
-90
lines changed

docs/guides/pulp/pulp_fetch_upload.md

Lines changed: 0 additions & 90 deletions
This file was deleted.
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
---
2+
title: Fetch and Distribute RPM Repository with Pulp
3+
author: David Gomez
4+
contributors: Steven Spencer
5+
tested with: 9.2
6+
tags:
7+
- Fetch
8+
- Distribute
9+
- RPM
10+
- Repository
11+
- Pulp
12+
---
13+
14+
## Introduction
15+
16+
Developers who use Rocky Linux will often run into situations where they will require different remote rpm repositories to support their operations. Pulp is an open source project that can help developers meet this need by helping to facilitate fetching and distributing different RPM repositories. This guide shows a simple example of using Pulp to fetch BaseOS and AppStream from Rocky Linux vault.
17+
18+
## Requirements
19+
20+
* A Rocky Linux system
21+
* Able to run containers
22+
23+
## Setup - Single Container
24+
25+
There are many setups possible for Pulp but for ease of illustration this guide will use the single container deployment scenario. Pick a directory for Pulp and create the following directories and files.
26+
27+
```bash
28+
mkdir -p settings/certs pulp_storage pgsql containers
29+
echo "CONTENT_ORIGIN='http://$(hostname):8080'" >> settings/settings.py
30+
```
31+
32+
If you have SELinux enabled, run the following to deploy Pulp. If SELinux is not enabled, then you can remove the `:Z` suffix from the `--volume` lines:
33+
34+
```bash
35+
$ podman run --detach \
36+
--publish 8080:80 \
37+
--name pulp \
38+
--volume "$(pwd)/settings":/etc/pulp:Z \
39+
--volume "$(pwd)/pulp_storage":/var/lib/pulp:Z \
40+
--volume "$(pwd)/pgsql":/var/lib/pgsql:Z \
41+
--volume "$(pwd)/containers":/var/lib/containers:Z \
42+
--device /dev/fuse \
43+
pulp/pulp
44+
```
45+
46+
If you browse to `http://localhost:8080/pulp/content/` you should now see "Index of /pulp/content/" that for now is empty, but that you will populate with your repositories by the end of this guide.
47+
48+
## Create Pulp Remotes
49+
50+
Think of Pulp remotes as remote source repositories. In this case, the remote source repositories are BaseOS and AppStream from Rocky Linux 9.2 vault. You will use these remotes to sync to your repositories that you will create with Pulp. Please check the [Pulp official documentation](https://pulpproject.org/) for more on remote policies.
51+
52+
```bash
53+
pulp rpm remote create --name "rocky_92_appstream_vault" --url "https://dl.rockylinux.org/vault/rocky/9.2/AppStream/x86_64/os/" --policy on_demand
54+
pulp rpm remote create --name "rocky_92_baseos_vault" --url "https://dl.rockylinux.org/vault/rocky/9.2/BaseOS/x86_64/os/" --policy on_demand
55+
```
56+
57+
## Pulp Repository Copies
58+
59+
These will be one-to-one repository copies of BaseOS and AppStream from Rocky Linux 9.2 vault. If you know the remote that you want to use to sync from for your repositories, then you can add those remotes at the time of repository creation. Otherwise, if you do not know what remotes to use, or if those remotes can change, then you can leave the remotes out. For this guide, the declaration of the remotes occurs at the time of repository creation.
60+
61+
```bash
62+
pulp rpm repository create --name "R92_AppStream_Vault" --remote "rocky_92_appstream_vault"
63+
pulp rpm repository create --name "R92_BaseOS_Vault" --remote "rocky_92_baseos_vault"
64+
```
65+
66+
## Pulp Sync Copies
67+
68+
!!! note
69+
70+
It is important to add "--skip-type treeinfo", otherwise instead of just BaseOS or AppStream, you end up with a weird mix of both. This probably due to an issue with repositories that are not dependency closed. If the remote was not specified before, you can add it, otherwise, if you added it at time of creation, it is not necessary to mention the remote in the sync as it is implied.
71+
72+
```bash
73+
pulp rpm repository sync --name "R92_AppStream_Vault" --skip-type treeinfo
74+
pulp rpm repository sync --name "R92_BaseOS_Vault" --skip-type treeinfo
75+
```
76+
77+
## Pulp Publish Publications
78+
79+
Once the syncing of your repositories from the remotes is complete, you will want to create the publications from those repositories to serve up to the distributions. So far you have been able to get by just using names of remotes and repositories, however, Pulp relies on `hrefs` as well, and you can use them interchangeably. After creating the publication, make sure to take note of the `pulp_href` value of each as they will be necessary for the next step.
80+
81+
```bash
82+
pulp rpm publication create --repository "R92_AppStream_Vault"
83+
pulp rpm publication create --repository "R92_BaseOS_Vault"
84+
```
85+
86+
## Pulp Create Distributions
87+
88+
With the `pulp_href` from the previous publication step, you can now serve up that content to a distribution. This content will then show under `http://localhost:8080/pulp/content/` and no longer be empty. You can double-check the `pulp_href` of the publications by using `pulp rpm publication list` and look for `pulp_href`. As an example, a `pulp_href` for BaseOS is below, but your `pulp_href` could be different so swap accordingly.
89+
90+
```bash
91+
pulp rpm distribution create --name "Copy of BaseOS 92 RL Vault" --base-path "R92_BaseOS_Vault" --publication "/pulp/api/v3/publications/rpm/rpm/0195fdaa-a194-7e9d-a6a9-e6fd4eaa7a20/"
92+
pulp rpm distribution create --name "Copy of AppStream 92 RL Vault" --base-path "R92_AppStream_Vault" --publication "<pulp_href>"
93+
```
94+
95+
If you check `http://localhost:8080/pulp/content/` you should see your two repositories that are copies of the Rocky Linux 9.2 AppStream and BaseOS vault repositories.
96+
97+
## Conclusion
98+
99+
Pulp can be a very versatile tool used to fetch multiple repositories and distribute them as needed. This is a basic example, however, you can use Pulp in a variety of deployment scenarios and do more complex and advanced repository organization. Please check the [official documentation](https://pulpproject.org/) for more information.

0 commit comments

Comments
 (0)