简体   繁体   English

将 shiny 应用程序的库部署到 shiny 服务器的最佳(标准)方法?

[英]Best (standard) way to deploy the libraries for a shiny app to the shiny server?

I'm trying to get a shiny app deployed on Shiny Server.我正在尝试在 Shiny 服务器上部署一个 shiny 应用程序。 I can do that without any issues, but when trying to deploy an app that has a number of dependencies (remote and local) we keep running into issues.我可以毫无问题地做到这一点,但是当尝试部署具有许多依赖项(远程和本地)的应用程序时,我们不断遇到问题。

We used renv to track the dependencies (on the Windows dev box) and rebuild it from scratch on the Linux prod box, but even though the dependencies are rebuilt and some get loaded, others do not.我们使用 renv 来跟踪依赖关系(在 Windows 开发箱上)并在 Linux 生产箱上从头开始重建它,但即使重建了依赖关系并且加载了一些,但其他人没有。 The.Rprofile of the user running the app is pointing to the renv activation script.运行应用程序的用户的.Rprofile 指向 renv 激活脚本。

For the sake of clarity, we need and want all the R code to be built from the source code on the Linux box.为了清楚起见,我们需要并希望所有 R 代码都从 Linux 盒子上的源代码构建。

What is the best or standard way (or even a poor way that works) to deploy the libraries for a shiny app to the shiny server?将 shiny 应用程序的库部署到 shiny 服务器的最佳或标准方式(甚至是一种糟糕的方式)是什么? Is renv even the right tool for this scenario or is there a better tool? renv 是适合这种情况的工具还是有更好的工具?

I've tried reading the shiny server documentation and the closes it only mentions that it uses the.Rprofile of the user running the app, but there doesn't seem to be any sort of guide on the best way to deploy dependent libraries.我试过阅读 shiny 服务器文档,它只提到它使用运行应用程序的用户的.Rprofile,但似乎没有任何关于部署依赖库的最佳方式的指南。

This renv documentation discusses some reproducibility caveats:renv文档讨论了一些重现性警告:

  1. system dependencies, and系统依赖,和
  2. changes in CRAN (eg a binary no longer being available). CRAN 的变化(例如二进制文件不再可用)。

Since you are moving from a Windows to a Linux system your packages may have unmet system dependencies (things that need to be installed outside of R) that you didn't encounter in Windows. For example, rJava is required for some of the Excel-related R packages, and getting its related system dependencies installed and working on Linux can sometime be a challenge.由于您要从 Windows 系统迁移到 Linux 系统,因此您的软件包可能具有未满足的系统依赖项(需要在 R 之外安装的东西),而您在 Windows 中没有遇到这些依赖项。例如,某些 Excel 需要rJava相关的 R 软件包,安装其相关的系统依赖项并在 Linux 上工作有时可能是一个挑战。 You can use the RStudio Package Manager Website to figure out what system dependencies are required for different R packages for your particular Linux OS.您可以使用RStudio Package 管理器网站来确定您的特定 Linux 操作系统的不同 R 包需要哪些系统依赖项。 Also, the error messages you get when running these apps on Linux should point you in the right direction.此外,在 Linux 上运行这些应用程序时收到的错误消息应该会为您指明正确的方向。 These system dependencies are what you'll have to manage yourself since renv doesn't.这些系统依赖项是您必须自己管理的,因为renv不需要。

But for a more production-level solution you can try Docker and ShinyProxy.但对于更多生产级别的解决方案,您可以尝试 Docker 和 ShinyProxy。 For apps with many dependencies or especially external dependencies (eg Python, SQL, etc.) you can guarantee more reproducibility using Docker. ShinyProxy can be used to host apps built into docker images.对于具有许多依赖项或特别是外部依赖项(例如 Python、SQL 等)的应用程序,您可以使用 Docker 保证更高的重现性。ShinyProxy 可用于托管内置于 docker 图像中的应用程序。 This is more work, but you ensure the entire system is reproducible, not just the R version and R packages.这是更多的工作,但您要确保整个系统是可重现的,而不仅仅是 R 版本和 R 包。 ShinyProxy also adds additional hosting capabilities like user authentication. ShinyProxy 还添加了额外的托管功能,如用户身份验证。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM