How to Host a Shiny App on a Windows MAChine

Can i host a shiny app on a windows machine?

Using

https://github.com/leondutoit/shiny-server-on-ubuntu

deployment is fairly easy. Too bad, the author is not very responsive.

Host shiny app on Windows

I guess the regular expression finds 2 values for IPv4 and is storing them in the z value.

Run this and check how many Ip-adresses it returns:

x <- system("ipconfig", intern=TRUE)
z <- x[grep("IPv4", x)]
z

If the print statement looks like this, it wont work:

print(z)

1 " IPv4-Adresse . . . . . . . . . . : xxx.xxx.x.xxx" IPv4-Adresse . . . . . . . . . . : x.x.x.x"

You will have to decide on one of them. In this example i am taking the second Ip-Adress ( z[2] ): I also changed "launch.browser = FALSE" to TRUE, so that the shiny-App opens in the browser.

ip <- gsub(".*? ([[:digit:]])", "\\1", z[2])
print(paste0("the Shiny Web application runs on: http://", ip, ":1234/"))
runApp(folder_address, launch.browser=TRUE, port = 1234, host = ip)

Do you have a local Linux Server in your department? You could easily upload it there, using the Open Source Version of Shiny Server

Is there a way to deploy R shiny apps as web page using windows server?

If you put below code as last lines:

app <- shinyApp(ui,server)
runApp(app,host="0.0.0.0",port=5050)

Then to run you Shiny App in any other machine just give the IP of the machine where the code is deployed and the port number which is 5050 in this case.
So, for example if you code is deployed on a machine with IP: 123.12.123.12 then for any other machine just write 123.12.123.12:5050 on any web browser.

The only caveat is the machine where the code is deployed and the machine where you need to use these codes should be in same domain.



Related Topics



Leave a reply



Submit