How to publish a Shiny app to Posit Connect with a dependency on a local tar.gz package

Hello,

I am trying to publish a Shiny app to Posit Connect which depends on a local R package (internal_package) not available on CRAN. It is included in the project bundle.

I am following this route because I do not have the access to create the connection between Posit Connect and GitHub. I also have limited visibility of the back end where administrative settings are configured.

This prevents me from
a) hosting my package on a CRAN-like GitHub repo and adding this to repos in .Rprofile.
b) installing via remotes::install_github("mycompany/internal_package")

The core issue with a local package installation is that Posit Connect looks for the package on CRAN, where it does not exist.

I have tried several approaches including

  1. an installation script that is sourced in app.R
  2. adjusting the renv.lock file to point to a local repo packages/

What is the recommended approach to ensure that Posit Connect can use a local package included in the project bundle given my constraints?

App structure:

my_app/  
├── app.R  
├── renv.lock  
├── .Rprofile  
├── renv/  
└── packages/  
    └── src/  
        └── contrib/  
            ├── PACKAGES  
            ├── PACKAGES.gz  
            └── internal_package_0.1.0.tar.gz

Thanks

Our recommended approach would be to use Posit Package Manager to make the internal package available for installation from a CRAN like repository you control. However, you can also use the functions provided with R itself to build a CRAN like repository for your package and make that available via a web server. The drat package makes this very convenient, just ignore the GitHub specific stuff.

Alternatively, you could install the package on the server itself as an external package. Note that this forces all apps to use the same version of this package.