Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to host Shiny apps on windows server?

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"

like image 939
zaini Avatar asked Oct 20 '17 12:10

zaini


People also ask

How do I host a Shiny app on my server?

Publish your Shiny App to RStudio ConnectAt the top of the editor, click Publish. In the Publish to Server window, confirm that your account is shown in the Publish To Account section and click Publish. You can monitor the status of the deployment in the RStudio IDE Deploy pane.

Can I host Shiny app on my website?

If you are familiar with web hosting or have access to an IT department, you can host your Shiny apps yourself. If you'd prefer an easier experience or need support, RStudio offers three ways to host your Shiny app as a web page: shinyapps.io.

Can you run Shiny app without R?

Shiny applications are built using the shiny package in R. So, if you want to build a shiny app then you must build it using R as you have to use R packages for building this app. Typically shiny along with some other R packages been used in building a single application. There is also Shiny for Python.


1 Answers

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

like image 110
clnreanu Avatar answered Oct 24 '22 10:10

clnreanu