Package Manager & Connect: how to make sure published apps fetch packages from private repo?

How can we configure RStudio Connect with Package Manager?

For example I have a package manager which have repositories like 'A' for cran and 'B' for internal packages. How to configure connect so that whenever user deploy or publish application on connect, it fetches packages from the repositories A and B; instead of searching cran by itself.

RStudio Connect does not need to be configured for that. This is explained in the part about private repositories
https://docs.rstudio.com/connect/admin/package-management.html#private-repositories

RStudio Connect supports private repositories in these situations given that the deploying instance of R is correctly configured. No adjustment to the RStudio Connect server is needed.

Repository information is configured using the repos R option. Your users will need to make sure their desktop R is configured to use your corporate repository.

What happens is:

  • Your deployment is prepared through rsconnect :package: that will look for dependencies collecting there version and also the repo they were install from
  • This happens by looking at the current repositories configured on the system from where the deployment happens.
  • All those information are then sent to Connect that will try to recreate the environment by fetching missing packages and version from the repo that the deployments tells to look into. This is all due to packrat mechanism internally.

As explained in the doc linked above you can configure you repos in an option to put in .Rprofile. With you scenario, this would be something like

local({
  r <- getOption("repos")
  r["A"] <- "https://cran.mycompany.com/"
  r["B"] <- "http://rpackages.mycompany.com/"
  options(repos = r)
})

You would then need to make sure the package you have installed locally are installed from thoses repositories. I don't know if it is a prerequisite but it is surely better.

Also, You RStudio connect serveur MUST have acces to your Package Manager on the network.

4 Likes

To summarize @cderv 's excellent response, all the configuration is done on the client not on Connect.

2 Likes