Troubleshooting publishing an app, w/ private package, to Connect

May 28, 2019 @colino Colin Odden

@colino wrote:

I'm publishing a Shiny app to Connect. It requires inclusion of a private package, because (a) the package is served by a private repository yet (b) Connect can't access that private repository.

The process for specifying a private package seems quite straightforward. I followed what I think are all of those straightforward steps. Still, I failed. Thanks in advance for any suggestions.

  1. Some facts
    a. The private package does not need to be compiled.
    b. It imports htmlwidgets, but I've tested deployment with a separate explicit library(htmlwidgets) to no avail.
    c. We've had no other problems deploying to Connect.
    d. I've confirmed that other config changes actually yield changes in Connect (that is, Connect is reading the correct config file).

Here's what I did, and ended up with:

  1. RStudio IDE 1.2 on Win10:
    a. Installed all required packages including the private package (it's called RiskGauge). I installed the private package using devtools as follows:
> library(devtools)
>devtools::install_gitlab("xxxx/RiskGauge", auth_token = "xxxxxx", host="xxxxxxx")

b. tarred, then gzipped, the RiskGuage package and named it after the commit hash (Remote SHA in the DESCRIPTION file), in this case, dafc7d31fede0fd8f61b5469221f6effae23abbb.tar.gz

  1. RStudio Connect on RHEL 7:
    a. Added a setting to /etc/rstudio-connect.gcfg:
SourcePackageDir = /opt/R-packages

b. Created directory /opt/R-packages/, w/ a subdirectory /RiskGauge/ .
c. Saved my private package's .tar.gz file in /opt/R-packages/RiskGauge/
c. Set liberal permissions on /opt/R-packages/ (and subdirectories and files therein)
d. systemctl restart rstudio-connect

  1. Back to RStudio IDE on Win10:
    a. Attempted to publish the Shiny app to Connect.

Here's my log extract:

2019/05/28 22:05:37.819114530 Installing RiskGauge (1.0.0) ... 
2019/05/28 22:05:39.527271486 curl: (22) The requested URL returned error: 404 Not Found
2019/05/28 22:05:40.772211537 curl: (22) The requested URL returned error: 404 Not Found
2019/05/28 22:05:42.017255823 curl: (22) The requested URL returned error: 404 Not Found
2019/05/28 22:05:43.266277682 curl: (22) The requested URL returned error: 404 Not Found
2019/05/28 22:05:44.520517787 curl: (22) The requested URL returned error: 404 Not Found
2019/05/28 22:05:45.523664215 FAILED
**2019/05/28 22:05:45.524508485 Error in getSourceForPkgRecord(pkgRecord, srcDir(project), availablePackagesSource(repos = repos), : Failed to retrieve package sources for RiskGauge 1.0.0 from CRAN (internet connectivity issue?)**
2019/05/28 22:05:45.524551121 
2019/05/28 22:05:45.524604473 Unable to fully restore the R packages associated with this deployment.
2019/05/28 22:05:45.524609179 Please review the preceding messages to determine which package
2019/05/28 22:05:45.524638056 encountered installation difficulty and the cause of the failure.
2019/05/28 22:05:45.524641421 
2019/05/28 22:05:45.524669308 Some typical reasons for package installation failures:
2019/05/28 22:05:45.524671911   * A system library needed by the R package is not installed.
2019/05/28 22:05:45.524689386     Some of the most common package dependencies are cataloged at:
2019/05/28 22:05:45.524691039
2019/05/28 22:05:45.524707109 
2019/05/28 22:05:45.524708778   * The R package requires a newer version of R.
2019/05/28 22:05:45.524724995 
2019/05/28 22:05:45.524726563   * The C/C++ compiler is outdated. This is often true for packages
2019/05/28 22:05:45.524742661     needing C++11 features.
2019/05/28 22:05:45.524744373 
2019/05/28 22:05:45.524760346   * The R package is Windows-only or otherwise unavailable for this
2019/05/28 22:05:45.524761959     operating system.
2019/05/28 22:05:45.524777878 
2019/05/28 22:05:45.524779393   * The package is housed in a private repository that requires
2019/05/28 22:05:45.524795131     authentication to access. For more details on this, see:
2019/05/28 22:05:45.524796771
2019/05/28 22:05:45.524813008 
2019/05/28 22:05:45.524814668 The package description and documentation will list system requirements
2019/05/28 22:05:45.524830716 and restrictions.
2019/05/28 22:05:45.524832408 
2019/05/28 22:05:45.524848113 Please contact your RStudio Connect administrator for further help
2019/05/28 22:05:45.524849709 resolving this issue.
Build error: exit status 1
Application deployment failed with error: exit status 1
Deployment completed: https://server:443/connect/#/apps/34/logs
Warning message:
In FUN(X[[i]], ...) :
  Package 'RiskGauge 1.0.0' was installed from sources; Packrat will assume this package is available from a CRAN-like repository during future restores

Posts: 10

Participants: 4

Read full topic

Previous Video
Collaboration with RStudio Connect - Push Button Publishing + Github
Collaboration with RStudio Connect - Push Button Publishing + Github

<p>This tutorial shows you best practices for collaborating with colleague data scientists with RStudio Con...

Next Article
RStudio Connect vs. Shiny Server Pro User Limits
RStudio Connect vs. Shiny Server Pro User Limits

@paul wrote: My organisation is currently deciding on whether to go for a Connec...