Shiny webserver deployment in windows operating system

Hi,

Is it possible to deploy shiny webserver in windows server? If yes kindly provide the url details....

Sincerely,
P.Srinivas Kumar

1 Like

Hi @psrinivaskumar, you could use something like Virtual Box to create a virtual Linux environment inside your Windows machine, and install Shiny Server there. You'll need to make sure to open the port 3838 so it can be accesses outside the virtual environment.

If you don't want a full VM, try docker. See https://hub.docker.com/r/rocker/shiny/

1 Like

Thanks for the help.....infact we could deploy the shiny webserver using the docker file in ubuntu virtual box in windows 10....however our goal is to connect the application directory which is residing in the windows server to the shiny web server which is residing in the ubuntu virtual box....can you please help us in making this happen?
Sincerely,
P.Srinivas Kumar

Hello @psrinivaskumar,

I would consider using the Docker route to run Shiny Server on Windows 10, then use a volume to inject the application code into your Docker container at runtime. Your run command might look something like this:

docker run \
    -v "$(pwd)"/<PATH/TO/APPLICATION/>/:/srv/shiny-server/ \
    -p 3838:3838 rocker/shiny

Your Dockerfile would also need instructions for installing any additional R packages required by your application. Our organization routinely deploys Shiny applications on Windows 10 via Docker. Feeling free to reach out if you need any help setting this up.

Bethany Yollin

1 Like

@byollin Thanks for the reply.....to clarify here is the problem statement that we are working on. We have package called rOntorion which works on windows environment. However as you shiny web server needs linux environment for deployment.What we are trying to do is that some how if we can access the functionality of rontorion to be used in the shiny webserver which is installed in the linux. For that we are trying to use virtual box and installed the shiny webserver using the docker file.
In the linux virtual machine we have used the command docker run
-v </media/WINDOWSSHAREDFOLDER/(Comprising of application files)>/:/srv/shiny-server/
-p 3838:3838 rocker/shiny
The above command opens the application with an error "The application failed to start.The application exited during initialization". We are using packages may be the reason for the error.
Are we missing on some thing in achieving the goal? Kindly help...

Sincerely,
P.Srinivas Kumar

Have you checked the log files located in /var/log/shiny-server/?

If the log file is not preserved add the following line to the top of you shiny-server.conf file in /etc/shiny-server/: preserve_logs true;. Once the log files are preserved, you should be able to identify the error causing the application to exit.

Bethany Yollin

@byollin
We have identified the error. It states the package rOntorion is not installed. We tried to install rOntorion package using terminal in the virtual linux box. The Ontorion got installed but when we run a sample code ....it gives an error..../tmp/RtmpdtFZdD/R.INSTALL82a1b17d9a6/rOntiorion/man/ontorion.load.cnl.file.RD:20 unkown macro :'\item....and we have informed the people the company which is delivering rOntorioni.
My question is there a way to install the packages from the docker file? We are new to this technology and any url which gives the information would be helpful....
Thanks and regards
Srinivas

You can tell docker to install R packages in your Dockerfile like so:

RUN Rscript -e "install.packages(c('rOntorion'), repos='https://cran.rstudio.com/')" \
    && rm -rf /tmp/downloaded_packages/ /tmp/*.rds

Hi all,

it is possible to host Shiny apps on Windows via a background process. This is however unsupported / unofficial. with this in mind:

create a Scheduled Task in Windows, schedule it to run every hour and link to this R Script:

require(shiny)
folder_address = 'H:/path to app'

x <- system("ipconfig", intern=TRUE)
z <- x[grep("IPv4", x)]
ip <- gsub(".*? ([[:digit:]])", "\\1", z)
print(paste0("the Shiny Web application runs on: http://", ip, ":1234/"))

runApp(folder_address, launch.browser=FALSE, port = 1234, host = ip)

you also need to open the port (in the example below 1234) in the local firewall for TCP/IP in and out.

Best
Calin

2 Likes