简体   繁体   English

在闪亮的服务器上部署打包的闪亮app

[英]Deploy packaged shiny app on shiny server

When having a shiny app set up like this for the shiny server 为闪亮的服务器设置这样一个闪亮的应用程序

+---/srv/shiny-server
|   +---shinyApp1
|       +---server.R
|       +---ui.R

all works fine. 一切正常。 However, how can I do the same, when the above files ( ui.R , server.R ) are included in a packages inst/shiny folder? 但是,当上述文件( ui.Rserver.R )包含在软件包inst/shiny文件夹中时,我该怎么做呢? (see, for example, my gridsampler repo). (例如,参见我的gridsampler repo)。

How can I deploy a packaged shiny app on shiny server? 如何在闪亮的服务器上部署打包的闪亮应用程序?

You can do what I do. 你可以做我做的事。

I host a lot of shiny apps from packages on my shiny server and what I do is just setwd() to the directory of the shiny app and then call shinyAppDir(".") . 我在闪亮的服务器上托管了许多闪亮的应用程序, 所做的只是setwd()到闪亮应用程序的目录,然后调用shinyAppDir(".")

As an example: this code is responsible for this app 作为示例: 此代码负责此应用程序


Edit 2.5 years later: note that this will not work if you have a global.R file - see this issue on github https://github.com/rstudio/shiny/issues/1063 编辑2。5年后:请注意,如果您有global.R文件,这将无效 - 请参阅github上的此问题https://github.com/rstudio/shiny/issues/1063

My workaround for that is to explicitly source global.R 我的解决方法是明确地发布global.R

I went for the easy way and just cloned the package from GitHub into the shiny-server directory and have to manually link to the inst/shiny subdirectory, see my hosted version of gridsampler as an example (notice the non-pretty URL). 我去了简单的方法,只是将包从GitHub克隆到闪亮的服务器目录,并且必须手动链接到inst/shiny子目录,请参阅我的托管版本的gridsampler作为示例(请注意非漂亮的URL)。 The shiny-server is set up to host a directory of apps, hence the overview when visiting the root URL where you need to click through to the app. 闪亮服务器设置为托管应用程序目录,因此在访问您需要单击应用程序的根URL时的概述。

Other possibilities might include cloning the repository somewhere outside the shiny-server folder and symlinking the inst/shiny folder into the shiny-server folder as gridsampler , which afaik should work if appropriate permissions are set. 其他可能性可能包括将存储gridsampler到shiny-server文件夹之外的某个位置,并将inst/shiny文件夹作为gridsampler符号链接到shiny-server文件夹中,如果设置了适当的权限,afaik应该可以工作。

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

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