How to host Shiny apps on windows server?

2019-03-30 02:31发布

I have developed some shiny apps which I want to make available to a few selected internal users for testing purposes and continued development.

Deploying the apps on the cloud or on shinyapps.io is not an option, as the apps are handling sensitive internal data.

Using ShinyServer is unfortunately also not an option, as we have a strict Microsoft only IT architecture and I thus have available only a virtual machine with Windows Server 2012 R2 on it.

I have been doing some web search and have found out the following:

i.) I could host my apps on the Windows machine as explained here: https://stackoverflow.com/a/44584982/7306540 . This seems rather hackish and not elegant at all. It would only allow hosting of one app at a time and I am not sure if it would allow several concurrent users at all.

ii.) I could use shinyproxy.io which would possibly work on the Windows machine but involves a fair amount of quite complex installation and configuration work that I am not particularly keen on doing.

iii.) SQLServer 2016 seems to feature some sort of R integration. We are currently using SQLServer2014 and it would be possible to upgrade to 2016 in principle. However, I don't know if the "R features" of SQLServer2016 would allow hosting of Shiny Apps. I found this blog post, https://social.technet.microsoft.com/Forums/windowsserver/en-US/1cf94cbb-c45d-4f8d-8b5e-9d208bfe369a/microsoft-r-server-can-i-host-shiny-apps-yet?forum=MicrosoftR , but without an answer:

Q: Does anyone know more about the capabilities of SQLServer2016 in this regard? What about other options? Is there any other way to host my apps on the Windows Server? Do the makers of RStudio plan to add a Windows version of ShinyServer? Is anyone else working on this? I would appreciate any insights into this topic!

EDIT:

Additional hosting options:

iv.) We can install a VM on the Windows Server, e.g. Virtual Box, or VM Player, install Linux and Shiny Server and host from there. We might run into problems in this variant if the Shiny Apps need to access SQL Server DB's on the Windows machine.

i.) This variant could possibly be improved by using (quote @gregL): "pm2.keymetrics.io, a process manager typically used for Node.js in production. The plumber docs describe how you can use pm2 with R: rplumber.io/docs/hosting.html#pm2"

1条回答
不美不萌又怎样
2楼-- · 2019-03-30 03:07

Hosting of Shiny Apps is possible on Windows!

At work, we host several production shiny dashboards, so it is definitely possible. You can host more Shiny apps by extending the i.) solution you mentioned, and using different ports for the Apps. The steps that you need to take are listed here:

  • make sure that the port is open in the local (evtl. also remote) firewall for TCP/IP connections
  • run a "scheduled task" on the local machine that starts a local R session as described in i.), make sure that the task does time-out and restarts if needed

Once these settings are in place, you can already test the Shiny App, first locally, and also from the remote station. Editing the shiny app can be done also live, in what the GUI is concerned, but if you want to refresh the data, you will have to restart the R command process. Tip: You should also have an index webpage where you list all running apps with their ports

查看更多
登录 后发表回答