Posit Package Manager and Artifactory

Follow
Control, organize, and govern your use of R and Python packages to increase reproducibility and decrease the time you spend installing and troubleshooting. For more information, visit https://posit.co/products/enterprise/package-manager/.

This article explains why you would use Posit Package Manager in addition to Artifactory, and provides the necessary integration steps.

Why use Posit Package Manager and Artifactory?

Artifactory is a general purpose manager that supports multiple languages. If you already have Artifactory, or your IT organization has standardized on Artifactory, there are benefits to combining it with Posit Package Manager.

Do I need Artifactory if I only have Posit Package Manager?

No, Posit Package Manager is a complete solution for data science teams using R.

Why should I consider Posit Package Manager if I already have Artifactory?

Artifactory provides basic support for R packages, but unfortunately most data science teams face additional challenges:

  • Version Management - While Artifactory provides access to CRAN packages, most data scientists are familiar with the challenges that come with managing package versions over time. Posit Package Manager makes this process easier by versioning the CRAN repository in addition to versioning individual packages, making it possible for old code to "just work".
  • Approved Subsets of CRAN - Artifactory proxies all of CRAN, but often organizations require restricted access to approved subsets of CRAN. Posit Package Manager uses knowledge of package dependencies to help organizations maintain these validated subsets.
  • Linux Binary Packages - Artifactory proxies directly from CRAN, which means its support on Linux systems is limited to source packages that can take a long time to compile. Posit Package Manager provides access to pre-compiled binary packages that make package installation fast enough to prevent disruptions and make it drastically easier to implement automation.

Luckily, teams do not have to pick between IT supported Artifactory and the benefits of Posit Package Manager - the two tools can be combined.

This integration is especially helpful for organizations that wish to have Posit Package Manager offline and are able to use Artifactory as a proxy to online package sources.

How to use Posit Package Manager with Artifactory

 click to expand

The goal of these steps is to enable Posit Package Manager to sync CRAN, Bioconductor, and PyPI packages from Artifactory.

Note: Artifactory integration requires Artifactory version 6.13 or above. Artifactory version 7.x or above is highly recommended.

  1. In Artifactory, create a Remote Repository with the Generic type. For the Repository Key, enter "package-manager-sync-remote". For the repository URL, enter:
    https://rspm-sync.rstudio.com
    Set the Exclude Patterns to "**/checkpoints/*.json".remote repository setup for package-manager-sync-remote

  2. Navigate to the Advanced tab of the New Remote Repository and uncheck the Store Artifacts Locally checkbox:

    remote repository setup for package-manager-sync-remote, advanced tab

    The remainder of the default settings are appropriate.

  3. Create another Remote Repository with the Generic typeFor the Repository Key, enter "package-manager-sync-cached". For the repository URL, enter:
    https://rspm-sync.rstudio.com
    Set the Include Patterns to "**/checkpoints/*.json".remote repository setup for package-manager-sync-cached

  4. Create a Virtual Repository with the Generic type. For the Repository Key, enter "package-manager-sync". Add the "package-manager-sync-remote" and "package-manager-sync-cached" repositories to the list of selected repositories.
    virtual repository setup for package-manager-sync
  5. If your Artifactory repository requires authentication, ensure that the user account to be used has both Read and Deploy/Cache permissions for both the "package-manager-sync-remote" and "package-manager-sync-cached" remote repositories.
    permissions for package-manager-sync
  6. Find the Artifactory repository URL for the "package-manager-sync" repository. For Artifactory Self-Hosted instances, the default URL is typically http://localhost:8081/artifactory/package-manager-sync. For Artifactory Cloud instances, the the default URL is typically https://<server-address>/artifactory/package-manager-sync.
  7. Edit the Posit Package Manager configuration file to configure Package Manager to sync packages from Artifactory. Add a "Manifest.URL" setting with the Artifactory repository URL as the value.
    # /etc/rstudio-pm/rstudio-pm.gcfg
    [Manifest]
    URL = "http://<server-address>:<port>/artifactory/package-manager-sync"
    If your Artifactory repository requires authentication, include the username and password in the URL:
    # /etc/rstudio-pm/rstudio-pm.gcfg
    [Manifest]
    URL = "http://<username>:<password>@<server-address>:<port>/artifactory/package-manager-sync"
    If your Artifactory repository requires authentication, include the username and password in the URL.

    # /etc/rstudio-pm/rstudio-pm.gcfg
    [Manifest]
    URL = "http://<server-address>:<port>/artifactory/package-manager-sync"
    User = "<username>"
    Password = "<encrypted or plain text password>"
  8. Restart Posit Package Manager:
    $ sudo systemctl restart rstudio-pm
  9. Follow the Getting Started guide in Posit Package Manager to create and sync a CRAN, Bioconductor, or PyPI repository.

    To verify the integration is complete, you should see the following signs of success.

    In Posit Package Manager, you should see a repository with an Activity Log showing the addition of CRAN, Bioconductor, or PyPI packages.

     click to expand 
  10. The integration is complete! Follow the instructions in Posit Package Manager for configuring access to R or Python packages. R and Python users will install packages from Posit Package Manager instead of installing them directly from Artifactory.

 

Comments