---
# System prepended metadata

title: 'Satellite: sync repository from an alternate content source'

---

# Satellite: sync repository from an alternate content source

## Abstract 
As a user of Satellite, you'd like to speed the initial sync of repositories content provided via removable media or near provider.


# Alternate Content Sources

**This draft is focused on usage of pulp-cli.**

Alternate Content Sources can help speed up populating of new repositories. If you have content stored locally or geographically near you, it allows you its' faster transfer. Alternate Content Sources will allow you to use the content you have around if it matches the remote one.

## Requirements
* Satellite 7.0

## Instructions

In new version of Satellite/Pulp alternate content sources works as special remotes. 

## Use Case 1: RHUI as a Alternate Content Source

To use this option you (or your's RHUI administrator) will need to generate certificates needed to authenticate against RHUI.

### Get RHUI certificates

On RHUA instance run 

~~~
rhui-manager repo list
~~~

to view your repos and then

~~~
rhui-manager client cert --name rhuicertfiles --days 365 --dir /root --repo_label <repo_no_1_rhui>,<repo_no_2_rhui>
~~~

to get certificates needed.

### Use Pulp CLI to configure ACS

On the box with Pulp instance, assuming to have pulp-cli installed and configured. 

Create remote with certificates needed. Please note that pulp remote **must** use policy "on_demand".
~~~
pulp rpm remote create --name ACSRemote --policy on_demand --client-cert "$(cat rhui/content.crt)" --client-key "$(cat rhui/key.pem)" --tls-validation false --url https://ecinstance.eu-west-1.compute.amazonaws.com/pulp/content/content/dist/rhel8/rhui/8/x86_64/baseos/os/
~~~

With this remote create ACS and refresh it to update library of alternate content source.

~~~
pulp rpm acs create --name ACS --remote rpm:ACSRemote
pulp rpm acs refresh --name ACS
~~~

Next time you will sync a repo with any matching content that is in refreshed ACS, it will be used as source to download.

~~~
pulp rpm repository create --name RPMRepo
pulp rpm remote create --name RPMRemote --url http://repo.example.org/
pulp rpm repository sync --name RPMRepo --remote rpm:RPMRemote
~~~

## Use Case 2: Speeding up sync with local content

This use case shows how to use ACS when you have you data locally.
Lets say you got backup copy of two repositories (e.g. baseos and appstream) on mounted disk. 
Check your pulp settings if `ALLOWED_IMPORT_PATHS` contains (base) path to your local files.
In our case `["/mnt/backup"]` must be present.
Create a remote only with a base path to your repositories.

~~~
pulp rpm remote create --name ACSRemote --policy on_demand --url file:///mnt/backup/dist/rhel8/x86_64/
~~~

When creating ACS specify paths under your **base path** to your repositories

~~~
pulp rpm acs create --name ACS --remote rpm:ACSRemote --path "base/os/" --path "appstream/"
pulp rpm acs refresh --name ACS

~~~

As in example above, next time you'll sync both alternate repositories will be used as a source of content.