Add a local shiny app to a running Shiny VM installed via gce_vm_template via docker_build and gce_push_registry / gce_pull_registry.

gce_shiny_addapp(instance, app_image, dockerfolder = NULL)

Arguments

instance

The instance running Shiny

app_image

The name of the Docker image to create or use existing from Google Container Registry. Must be numbers, dashes or lowercase letters only.

dockerfolder

The folder location containing the Dockerfile and app dependencies

Value

The instance

Details

To deploy a Shiny app, you first need to construct a Dockerfile which load the R packages and dependencies, as well as copying over the Shiny app in the same folder.

This function will take the Dockerfile, build it into a Docker image and upload it to Google Container Registry for use later.

If already created, then the function will download the app_image from Google Container Registry and start it on the instance provided.

Any existing Shiny Docker containers are stopped and removed, so if you want multiple apps put them in the same Dockerfile.

Dockerfile

Example Dockerfile's are found in system.file("dockerfiles",package = "googleComputeEngineR")

The Dockerfile is in the same folder as your shiny app, which consists of a ui.R and server.R in a shiny subfolder. This is copied into the Dockerfile in the last line. Change the name of the subfolder to have that name appear in the final URL of the Shinyapp.

This is then run using the R commands below:

See also

The vignette entry called Shiny App has examples and a walk through.

Examples

if (FALSE) { vm <- gce_vm("shiny-test", template = "shiny", predefined_type = "n1-standard-1") vm <- vm_ssh_setup(vm) app_dir <- system.file("dockerfiles","shiny-googleAuthRdemo", package = "googleComputeEngineR") gce_shiny_addapp(vm, app_image = "gceshinydemo", dockerfolder = app_dir) # a new VM, it loads the Shiny docker image from before gce_shiny_addapp(vm2, app_image = "gceshinydemo") }