/shinyproxy-deployment

Example how to deploy a Shiny app through shinyproxy

Primary LanguageR

shinyproxy-deployment

Example how to deploy a Shiny app through shinyproxy

Setup

Install docker for your OS by following the instructions here.

If you are running OSX, you will also need to install socat as described in the issue here. You will need to have brew installed on your machine, go to https://brew.sh/ to download.

brew install socat

ShinyProxy requires the Java 8 (or higher) runtime environment which you can download from the Oracle website. You can check your Java version by running java -version in the terminal.

Finally, you will also need to download ShinyProxy which is essentially just a single jar file. Copy this jar file (e.g. shinyproxy-1.0.2.jar) into the project's root directory.

Setup project

Clone the repository:

git clone https://github.com/nz-stefan/shinyproxy-deployment.git

Open an R session (e.g. using RStudio) in the project's root directory to download all package dependencies. You should be able to run the Shiny app from within the R session:

shiny::runApp("app")

Containerize Shiny app

ShinyProxy requires your Shiny app to be encapsulated in a Docker container. The container is defined by the Dockerfile in the root directory of this project.

Build the container by running:

bin/build-docker.sh

This creates a container named shinyproxy/helloworld. You can list all available Docker containers using docker images.

Once the container is successfully built, it can be spun up using:

bin/run-local-docker.sh

Then point your browser to http://0.0.0.0:3838 to see your application in action.

Run ShinyProxy

ShinyProxy is responsible to spin up Shiny containers. The Docker image to spin up for a particular Shiny app is specified in the apps section of the configuration file application.yml.

Start ShinyProxy by running:

bin/start-shinyproxy.sh

A few seconds later, you can visit http://localhost:8080 in your browser. Use the credentials jack/password to log in.