Managing Custom File Type Content

In orcharhino, you might require methods of managing and distributing SSH keys and source code files or larger files such as virtual machine images and ISO files. To achieve this, custom products in orcharhino include repositories for custom file types. This provides a generic method to incorporate arbitrary files in a product.

You can upload files to the repository and synchronize files from an upstream orcharhino Server. When you add files to a custom file type repository, you can use the normal orcharhino management functions such as adding a specific version to a Content View to provide version control and making the repository of files available on various orcharhino Proxies. Clients must download the files over HTTP or HTTPS using curl -O.

You can create a file type repository in orcharhino Server only in a custom product, but there is flexibility in how you create the repository source. You can create an independent repository source in a directory on orcharhino Server, or on a remote HTTP server, and then synchronize the contents of that directory into orcharhino. This method is useful when you have multiple files to add to a orcharhino repository.

Creating a Custom File Type Repository

The procedure for creating a custom file type repository is the same as the procedure for creating any custom content, except that when you create the repository, you select the file type. You must create a product and then add a custom repository.

To use the CLI instead of the orcharhino management UI, see the CLI procedure.

Procedure
  1. In the orcharhino management UI, navigate to Content > Products.

  2. Select a product that you want to create a repository for.

  3. On the Repositories tab, click New Repository.

  4. In the Name field, enter a name for the repository. orcharhino automatically completes the Label field based on the name.

  5. Optional: In the Description field, enter a description for the repository.

  6. From the Type list, select file as type of repository.

  7. Optional: In the Upstream URL field, enter the URL of the upstream repository to use as a source. If you do not enter an upstream URL, you can manually upload packages. For more information, see Uploading Files To a Custom File Type Repository.

  8. Select the Verify SSL checkbox if you want to verify that the upstream repository’s SSL certificates are signed by a trusted CA.

  9. Optional: In the Upstream Username field, enter the user name for the upstream repository if required for authentication. Clear this field if the repository does not require authentication.

  10. Optional: In the Upstream Password field, enter the corresponding password for the upstream repository. Clear this field if the repository does not require authentication.

  11. Optional: In the Upstream Authentication Token field, provide the token of the upstream repository user for authentication. Leave this field empty if the repository does not require authentication.

  12. From the Mirroring Policy list, select the type of content synchronization orcharhino Server performs. For more information, see Mirroring Policies Overview.

  13. Optional: In the HTTP Proxy Policy field, select or unselect using a HTTP proxy. By default, it uses the Global Default HTTP proxy.

  14. Optional: You can clear the Unprotected checkbox to require a subscription entitlement certificate for accessing this repository. By default, the repository is published through HTTP.

  15. Optional: In the SSL CA Cert field, select the SSL CA Certificate for the repository.

  16. Optional: In the SSL Client Cert field, select the SSL Client Certificate for the repository.

  17. Optional: In the SSL Client Key field, select the SSL Client Key for the repository.

  18. Click Save to create the repository.

CLI procedure
  1. Create a custom product:

    # hammer product create \
    --description "My_Files" \
    --name "My_File_Product" \
    --organization "My_Organization" \
    --sync-plan "My_Sync_Plan"
    Table 1. Optional Parameters for the hammer product create Command
    Option Description

    --gpg-key-id gpg_key_id

    GPG key numeric identifier

    --sync-plan-id sync_plan_id

    Sync plan numeric identifier

    --sync-plan sync_plan_name

    Sync plan name to search by

  2. Create a file type repository:

    # hammer repository create \
    --content-type "file" \
    --name "My_Files" \
    --organization "My_Organization" \
    --product "My_File_Product"
    Table 2. Optional Parameters for the hammer repository create Command
    Option Description

    --checksum-type sha_version

    Repository checksum, currently 'sha1' & 'sha256' are supported

    --download-policy policy_name

    Download policy for yum repos (either 'immediate' or 'on_demand').

    --gpg-key-id gpg_key_id

    GPG key numeric identifier

    --gpg-key gpg_key_name

    Key name to search by

    --mirror-on-sync boolean

    Must this repo be mirrored from the source, and stale RPMs removed, when synced? Set to true or false, yes or no, 1 or 0.

    --publish-via-http boolean

    Must this also be published using HTTP? Set to true or false, yes or no, 1 or 0.

    --upstream-password repository_password

    Password for the upstream repository user

    --upstream-username repository_username

    Upstream repository user, if required for authentication

    --url source_repo_url

    URL of the Source repository

    --verify-ssl-on-sync boolean

    Must Katello verify that the upstream URL’s SSL certificates are signed by a trusted CA? Set to true or false, yes or no, 1 or 0.

Creating a Local Source for a Custom File Type Repository

You can create a custom file type repository source, from a directory of files, on the base system where orcharhino is installed using Pulp Manifest. You can then synchronize the files into a repository and manage the custom file type content like any other content type.

Use this procedure to configure a repository in a directory on the base system where orcharhino is installed. To create a file type repository in a directory on a remote server, see Creating a Remote Source for a Custom File Type Repository.

Procedure
  1. Install the Pulp Manifest package:

    • On Enterprise Linux 8:

      # dnf install python39-pulp_manifest
    • On Enterprise Linux 7:

      # dnf install tfm-pulpcore-python3-pulp_manifest
  2. Create a directory that you want to use as the file type repository, such as:

    # mkdir -p /var/lib/pulp/local_repos/my_file_repo
  3. Add the parent folder into allowed import paths:

    # orcharhino-installer --foreman-proxy-content-pulpcore-additional-import-paths /var/lib/pulp/local_repos
  4. Add files to the directory or create a test file:

    # touch /var/lib/pulp/local_repos/my_file_repo/test.txt
  5. Run the Pulp Manifest command to create the manifest:

    # pulp-manifest /var/lib/pulp/local_repos/my_file_repo
  6. Verify the manifest was created:

    # ls /var/lib/pulp/local_repos/my_file_repo
    PULP_MANIFEST test.txt

Now, you can import your local source as a custom file type repository. Use the file:// URL scheme and the name of the directory to specify an Upstream URL, such as file:///my_file_repo. For more information, see Creating a Custom File Type Repository.

If you update the contents of your directory, re-run Pulp Manifest and sync the repository in orcharhino. For more information, see Synchronizing Repositories.

If you use local file repositories on your orcharhino Server, ensure to add the path to the allowed paths Pulp can import repositories from. Run orcharhino-installer --foreman-proxy-content-pulpcore-additional-import-paths /var/lib/pulp/My_Local_repo to add your local path.

Creating a Remote Source for a Custom File Type Repository

You can create a custom file type repository source from a directory of files that is external to orcharhino Server using Pulp Manifest. You can then synchronize the files into a repository on orcharhino Server over HTTP or HTTPS and manage the custom file type content like any other content type.

Use this procedure to configure a repository in a directory on a remote server. To create a file type repository in a directory on the base system where orcharhino Server is installed, see Creating a Local Source for a Custom File Type Repository.

Prerequisites
  • You have a server running Enterprise Linux registered to your orcharhino.

  • You have installed an HTTP server.

Procedure
  1. Install the Pulp Manifest package:

    • On Enterprise Linux 8:

      # dnf install python39-pulp_manifest
    • On Enterprise Linux 7:

      # dnf install tfm-pulpcore-python3-pulp_manifest
  2. Create a directory that you want to use as the file type repository in the HTTP server’s public folder:

    # mkdir /var/www/html/pub/my_file_repo
  3. Add files to the directory or create a test file:

    # touch /var/www/html/pub/my_file_repo/test.txt
  4. Run the Pulp Manifest command to create the manifest:

    # pulp-manifest /var/www/html/pub/my_file_repo
  5. Verify the manifest was created:

    # ls /var/www/html/pub/my_file_repo
    PULP_MANIFEST test.txt

Now, you can import your remote source as a custom file type repository. Use the path to the directory to specify an Upstream URL, such as http://orcharhino.example.com/my_file_repo. For more information, see Creating a Custom File Type Repository.

If you update the contents of your directory, re-run Pulp Manifest and sync the repository in orcharhino. For more information, see Synchronizing Repositories.

Uploading Files To a Custom File Type Repository

Use this procedure to upload files to a custom file type repository.

Procedure
  1. In the orcharhino management UI, navigate to Content > Products.

  2. Select a custom product by name.

  3. Select a file type repository by name.

  4. Click Browse to search and select the file you want to upload.

  5. Click Upload to upload the selected file to orcharhino Server.

  6. Visit the URL where the repository is published to see the file.

CLI procedure
# hammer repository upload-content \
--id repo_ID \
--organization "My_Organization" \
--path example_file

The --path option can indicate a file, a directory of files, or a glob expression of files. Globs must be escaped by single or double quotes.

Downloading Files to a Host From a Custom File Type Repository

You can download files to a client over HTTPS using curl -O, and optionally over HTTP if the Unprotected option for repositories is selected.

Prerequisites
Procedure
  1. In the orcharhino management UI, navigate to Content > Products.

  2. Select a custom product by name.

  3. Select a file type repository by name.

  4. Ensure to select the Unprotected checkbox to access the repository published through HTTP.

  5. Copy the URL where the repository is published.

CLI procedure
  1. List the file type repositories.

    # hammer repository list --content-type file
    ---|------------|-------------------|--------------|----
    ID | NAME       | PRODUCT           | CONTENT TYPE | URL
    ---|------------|-------------------|--------------|----
    7  | My_Files   | My_File_Product   | file         |
    ---|------------|-------------------|--------------|----
  2. Display the repository information.

    # hammer repository info \
    --name "My_Files" \
    --organization-id My_Organization_ID \
    --product "My_File_Product"

    If Unprotected is enabled, the output is similar to this:

    Publish Via HTTP:   yes
    Published At:       https://orcharhino.example.com/pulp/content/My_Organization_Label/Library/custom/My_File_Product_Label/My_Files_Label/

    If Unprotected is not enabled, the output is similar to this:

    Publish Via HTTP:   no
    Published At:       https://orcharhino.example.com/pulp/content/My_Organization_Label/Library/custom/My_File_Product_Label/My_Files_Label/
  3. On the client, enter a command in the appropriate format for HTTP or HTTPS:

    For HTTP:

    # curl -O http://orcharhino.example.com/pulp/content/My_Organization_Label/Library/custom/My_File_Product_Label/My_Files_Label/my_file

    For HTTPS:

    # curl -O --cert ./_My-Organization-key-cert.pem_ --cacert katello-server-ca.crt https://orcharhino.example.com/pulp/content/My_Organization_Label/Library/custom/My_File_Product_Label/My_Files_Label/my_file

Creating Type file Repositories for Installation Media

You can use file repositories to provide local installation media for Debian and Ubuntu.

Procedure
  1. Navigate to Content > Products and click Create Product.

  2. Enter a Name for your product.

  3. Optional: Select a sync plan from the Sync Plan drop down menu.

  4. Click Save to create the product.

  5. On the Repositories tab of the previously created product, click New Repository.

  6. Enter a Name for the repository. If you use the file repository as installation media for offline installations, we recommend adding offline installation media to indicate the offline installation capability, for example Ubuntu 20.04 offline installation media.

  7. Select file as Type.

  8. Enter the Upstream URL from ATIX Service Portal.

  9. Click Save to create the repository.

  10. On the Repositories tab, select your previously created repository and click Sync Now.

  11. Once synchronized, navigate to Content > Products and select the previously created product.

  12. On the Repositories tab, select the previously created repository.

  13. Copy the Published At URL.

  14. Navigate to Hosts > Installation Media and click Create Medium.

  15. Enter a Name for the installation media. We recommend adding local to indicate that the installation media is stored on your orcharhino locally. You can use this installation media to perform offline installations.

  16. Enter the copied URL as Path.

  17. Select the Operating System Family.

  18. Click Submit to create the installation media.

The text and illustrations on this page are licensed by ATIX AG under a Creative Commons Attribution–Share Alike 3.0 Unported ("CC-BY-SA") license. This page also contains text from the official Foreman documentation which uses the same license ("CC-BY-SA").