Skip to content

Artifactory#

Advanced

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

Why use 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 Package Manager.

Do I need Artifactory if I only have Package Manager?

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

Why should I consider 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. Package Manager makes this process easier by versioning the CRAN repository and 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. 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. 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.

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

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

Note

In the Package Manager and Artifactory integration, Package Manager still configures CRAN, Bioconductor, and PyPI repositories, not Artifactory. Package Manager downloads packages through the Artifactory proxy, rather than the Posit Package Service directly.

How to use Package Manager with Artifactory#

Artifactory and Posit Flowchart

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

Important

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

Integrating Artifactory and Package Manager#

  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 the following patterns:

    **/checkpoints/*.json
    **/bin/**
    **/packages/**
    **/rsf/**
    

    Screenshot in Artifactory showing the settings for the Remote Repository - Generic Type

    Screenshot in Artifactory showing the Patterns settings

  2. Navigate to the Advanced tab of the New Remote Repository and clear the Store Artifacts Locally checkbox. The remaining default settings are appropriate.

    Advanced Tab Screenshot

  3. Create another Remote Repository with the Generic type. For the Repository Key, enter:

    package-manager-sync-cached
    

    For the Repository URL, enter:

    https://rspm-sync.rstudio.com
    

    Set Include Patterns to the following patterns:

    **/checkpoints/*.json
    **/bin/**
    **/packages/**
    **/rsf/**
    

    Screenshot in Artifactory showing the settings for the second Remote Repository

    Screenshot in Artifactory showing the Patterns settings for the second Remote Repository

  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.

    Screenshot showing how to add the repositories to the generic virtual repository

  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.

    Screenshot showing authentication steps for Artifactory repository

  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 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"
    

    Tip

    As of Posit Package Manager 2022.11.0, you can alternatively use the Manifest.User and Manifest.Password settings to provide a more secure, encrypted password. See the Configuration Encryption section of this admin guide for more details.

    /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. Edit the configuration file to skip duplicating packages served from Artifactory:

    [Server]
    RetainFetchedPackages = no
    
  9. Restart Package Manager:

    Terminal
    $ sudo systemctl restart rstudio-pm
    
  10. Follow the Quick Start section of this admin guide to create and sync a CRAN, Bioconductor, or PyPI repository.

    To verify the integration is complete, navigate to the Activity page in your instance of Package Manager. A repository with an Activity Log showing the addition of CRAN, Bioconductor, or PyPI packages displays.

    Success

    Screenshot showing successful Activity Log in Posit Package Manager

    Note

    R and Python users will install packages from Package Manager instead of installing them directly from Artifactory.