|
1 | 1 | # Pulp Server |
2 | 2 |
|
3 | | -In order to ensure reproducible builds, the appliance can build images using repository mirrors from StackHPC's "Ark" Pulp server. The appliance can sync relevant repositories to a local Pulp server which will then be used instead of Ark. |
| 3 | +In order to ensure reproducibility, by default image builds use mirrors of DNF |
| 4 | +repositories hosted on StackHPC's "Ark" Pulp server. This page describes how to |
| 5 | +use a local Pulp server instead of Ark, which reduces network traffic and speeds |
| 6 | +up builds. The repositories on this local Pulp server are synchronised to Ark so |
| 7 | +that builds still use the same package snapshots. |
4 | 8 |
|
5 | | -## Deploying/configuring Pulp Server |
| 9 | +It is also possible to use a local Pulp server to install packages during the |
| 10 | +`site.yml` playbook rather than during image builds, as described in [docs/operations.md](../operations.md#adding-additional-packages). |
6 | 11 |
|
7 | | -### Deploying a Pulp server |
| 12 | +## Deploying and Configuring a Local Pulp Server |
8 | 13 |
|
9 | | -A playbook is provided to install and configure a Pulp server on a given host. Admin credentials for this server are automatically generated through the `ansible/adhoc/generate-passwords.yml` playbook. To use this, create an inventory file |
10 | | -defining a group `pulp_server` containing a single host, which requires at least 2 vCPUs and 4GB RAM. The group should be defined in your `site` environment's inventory so that a single Pulp server is shared between all environments and |
11 | | -the same snapshots are tested in staging and production. |
12 | | -Deploying and syncing Pulp has been tested on an RL9 host. The hostvar `ansible_host` should be defined, giving the IP address Ansible should use for SSH. For example, you can create an ini file at `environments/site/inventory/pulp` with the contents: |
| 14 | +The appliance can install and configure a local Pulp server on a specified host. |
| 15 | +This host should run RockyLinux 8 or 9 and have at least 2 vCPUs and 8GB RAM. |
| 16 | +Note upgrades etc. of this host will not be managed by the appliance. Access to |
| 17 | +Pulp content is not authenticated so this server should not be externally |
| 18 | +reachable. |
13 | 19 |
|
14 | | -```ini |
15 | | -[pulp_server] |
16 | | -pulp_host ansible_host=<VM-ip-address> |
17 | | -``` |
| 20 | +> [!IMPORTANT] |
| 21 | +> Commands below should be run with the `staging` environment active, as all |
| 22 | +> Pulp syncs will be done from there. |
18 | 23 |
|
19 | | -> [!WARNING] |
20 | | -> The inventory hostname cannot conflict with group names i.e can't be called `pulp_site` or `pulp_server`. |
| 24 | +1. Define the host in a group `pulp_server` within the `site` inventory. This |
| 25 | + means clusters in all environments use the same Pulp server, and the synced |
| 26 | + DNF repository snapshots are tested in staging before use in production. E.g.: |
21 | 27 |
|
22 | | -Once complete, it will print a message giving a value to set for `appliances_pulp_url` (see example config below), assuming the `ansible_host` address is also the address the cluster |
23 | | -should use to reach the Pulp server. |
| 28 | + ```ini |
| 29 | + # environments/site/inventory/pulp: |
| 30 | + [pulp_server] |
| 31 | + pulp_host ansible_host=<VM-ip-address> |
| 32 | + ``` |
24 | 33 |
|
25 | | -Note access to this server's content isn't authenticated so this assumes the `pulp_server` host is not externally reachable. |
| 34 | + **NB:** The inventory hostname must not conflict with group names, i.e. it |
| 35 | + cannot be `pulp_site` or `pulp_server`. |
26 | 36 |
|
27 | | -### Using an existing Pulp server |
| 37 | +2. If adding Pulp to an existing deployment, ensure Pulp admin credentials |
| 38 | + exist: |
28 | 39 |
|
29 | | -An existing Pulp server can be used to host Ark repos by overriding `pulp_site_password` and `appliances_pulp_url` in the target environment. Note that this assumes the same configuration as the appliance deployed Pulp i.e no content authentication. |
| 40 | + ```shell |
| 41 | + ansible-vault decrypt environments/staging/inventory/group_vars/all/secrets.yml |
| 42 | + ansible-playbook ansible/adhoc/generate-passwords.yml |
| 43 | + ansible-vault encrypt environments/staging/inventory/group_vars/all/secrets.yml |
| 44 | + ``` |
30 | 45 |
|
31 | | -## Syncing Pulp content with Ark |
| 46 | +3. Run the adhoc playbook to install and configure Pulp: |
| 47 | + |
| 48 | + ```shell |
| 49 | + ansible-playbook ansible/adhoc/deploy-pulp.yml |
| 50 | + ``` |
| 51 | + |
| 52 | + Once complete, it will print a message giving a value to set for |
| 53 | + `appliances_pulp_url`, assuming the inventory `ansible_host` address is |
| 54 | + also the address the cluster should use to reach the Pulp server. |
| 55 | + |
| 56 | +4. Create group vars files defining `appliances_pulp_url` and dev credentials |
| 57 | + for StackHPC's "Ark" Pulp server: |
| 58 | + |
| 59 | + ```yaml |
| 60 | + # environments/site/inventory/group_vars/all/pulp.yml: |
| 61 | + appliances_pulp_url: "http://<pulp-host-ip>:8080" |
| 62 | + pulp_site_upstream_username: your-ark-username |
| 63 | + pulp_site_upstream_password: "{{ vault_pulp_site_upstream_password }}" |
| 64 | + ``` |
| 65 | +
|
| 66 | + ```yaml |
| 67 | + # environments/site/inventory/group_vars/all/vault_pulp.yml: |
| 68 | + vault_pulp_site_upstream_password: your-ark-password |
| 69 | + ``` |
32 | 70 |
|
33 | | -If the `pulp_site` group is added to the Packer build groups, the local Pulp server will be synced with Ark on build. You must authenticate with Ark by overriding `pulp_site_upstream_username` and `pulp_site_upstream_password` with your vault encrypted Ark dev credentials. `dnf_repos_username` and `dnf_repos_password` must remain unset to access content from the local Pulp. |
| 71 | + and vault-encrypt the latter: |
34 | 72 |
|
35 | | -Content can also be synced by running `ansible/adhoc/sync-pulp.yml`. By default this syncs repositories for the latest version of Rocky supported by the appliance but this can be overridden by setting extra variables for `pulp_site_target_arch`, `pulp_site_target_distribution` and `pulp_site_target_distribution_version`. |
| 73 | + ```shell |
| 74 | + ansible-vault encrypt environments/site/inventory/group_vars/all/vault_pulp.yml |
| 75 | + ``` |
| 76 | + |
| 77 | + If previously using Ark credentials directly e.g. for image builds, ensure |
| 78 | + the variables `dnf_repos_username` and `dnf_repos_password` are no longer |
| 79 | + set in any environment. |
| 80 | + |
| 81 | +5. Commit changes. |
| 82 | + |
| 83 | +## Using an existing Pulp server |
| 84 | + |
| 85 | +Alternatively, an existing Pulp server can be used to host Ark repos by |
| 86 | +setting `appliances_pulp_url` directly. Note that this assumes the same |
| 87 | +configuration as the appliance deployed Pulp i.e no content authentication. |
| 88 | +As above, the `dnf_repos_` variables must not be set in this configuration. |
| 89 | + |
| 90 | +## Syncing Pulp content with Ark |
36 | 91 |
|
37 | | -## Example config in site variables |
| 92 | +The appliance can synchronise repositories on local Pulp server from Ark in |
| 93 | +two ways: |
38 | 94 |
|
39 | | -```yaml |
40 | | -# environments/site/inventory/group_vars/all/pulp_site.yml: |
41 | | -appliances_pulp_url: "http://<pulp-host-ip>:8080" |
42 | | -pulp_site_upstream_username: <Ark-username> |
43 | | -pulp_site_upstream_password: <Ark-password> |
44 | | -``` |
| 95 | +1. If the `pulp_site` group is added to the Packer build groups, the local Pulp |
| 96 | + server will be synced with Ark during image builds. |
45 | 97 |
|
46 | | -## Installing packages from Pulp at runtime |
| 98 | +2. The sync can be manually be triggered by running: |
47 | 99 |
|
48 | | -By default, system repos are overwritten to point at Pulp repos during [image builds,](../image-build.md) so using a site Pulp server will require a new fatimage. If you instead wish to install packages at runtime, |
49 | | -you will need to add all host groups on which you will be installing packages to the `dnf_repos` group in `environments/site/inventory/groups` e.g: |
| 100 | + ```shell |
| 101 | + ansible-playbook ansible/adhoc/sync-pulp.yml |
| 102 | + ``` |
50 | 103 |
|
51 | | -```yaml |
52 | | -[dnf_repos:children] |
53 | | -cluster |
54 | | -``` |
| 104 | + By default this method syncs repositories for the latest version of RockyLinux |
| 105 | + supported by the appliance. This can be overridden by setting |
| 106 | + `pulp_site_target_distribution_version` to e.g. `'8.10'`, i.e the `Major.minor` |
| 107 | + version of RockyLinux the site clusters are using. **NB:** This value |
| 108 | + must be quoted to avoid an incorrect conversion to float. |
0 commit comments