Search code examples
rshinyshiny-servershinyproxy

Host shiny app on Windows


First of all my question is very related to

How to host Shiny apps on windows server?

But, it seems that i need some more reputation to comment in other posts....

My problem/question: I have a shiny app that i want to deploy and make available for people in my department. The paid version of shinyapps.io is not an option for now at least, so i am looking for alternatives. I am working on Windows and this is a problem from what i understand in order to host my own server. I tried the solution provided here, but i get the following error:

"Error in makeTcpServer(host, port, appwrapper$onHeaders, appwrapper$onBodyData,  : Expecting a single value: [type=character; extent=5]. 

Also, another solution is shinyproxy. But it is rather complicated to set it up and i didn't find anywhere how to do that on Windows 10 Home edition ( so no Hyper-V availability...). If you are aware of this, please let me know!

I would appreciate any help to figure it out!

Thanks, Giannis


Solution

  • 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