10

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"

zaini
  • 131
  • 1
  • 8
  • What about a VM, such as Virtual Box? – Pork Chop Oct 20 '17 at 12:36
  • Option 1 actually sounds good for internal use. If you want to harden it up, you can look into something like http://pm2.keymetrics.io/, a process manager typically used for Node.js in production. The plumber docs describe how you can use pm2 with R: https://www.rplumber.io/docs/hosting.html#pm2 – greg L Oct 21 '17 at 17:52
  • @PorkChop: yes, that would indeed be an option. Haven't thought about it. Thanks a lot! – zaini Oct 23 '17 at 15:11
  • @gregL: thank you indeed for this input. I am not yet familiar with the tools you are mentioning, but they definitely sound very interesting. I'll have a look into it! guess I should also edit my post above with your inputs.. – zaini Oct 23 '17 at 15:27
  • @zaini have a look here http://chrisbeeley.net/?p=624 – Pork Chop Oct 23 '17 at 15:33
  • @zaini I have been looking at multiple resources, but can't seem to find out how to run a ShinyApp on an IIS web server... I am allowed to run virtual machines it's just a matter of figuring things out, but I'm just not succeeding... I have created a Linux VM machine on which I can run Shiny server with a shiny app. I run a Microsoft Server 2016 VM to setup a test IIS web server. I have created a bridged network connection for both VM's so I can access the location of the shiny app on all my machines, but I don't know how to rout the shiny app to IIS. Any help appreciated! – smoens Feb 13 '18 at 22:30
  • @smoens: hhmm... not sure I understand your precise setup and problem. For the above I ended up using option i.) The shiny app is configured to listen on a specific IP address and port. I then run it as a batch job using the Rscript command. The batch job in turn is called from a Windows scheduled task. This setup allows several concurrent users. The downside is that I can thus host only one app at a time, unfortunately. – zaini Feb 15 '18 at 11:14
  • @zaini no problem! thank you for the reply, this indeed doesn't cover my situation I need to host multiple apps for multiple users and make these apps available on an IIS web server (Windows) – smoens Feb 15 '18 at 19:36

1 Answers1

7

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

clnreanu
  • 111
  • 1
  • 3
  • 1
    That works indeed! Several concurrent users are possible, too. But one user has to wait until the requests of other users are finished by the app. So if you want to provide a (long running) shiny app for many users at the same time, that is not a good option. – chgrl Mar 25 '20 at 08:47