Skip to content

Tychobra/polisheddeploy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

polisheddeploy

Create a Dockerfile to run, and then deploy, a shiny app

To create a Dockerfile for a shiny app, we need to know all the app's dependencies. All shiny apps are dependent on R (polisheddeploy use the r-ver Docker image as our starting image) and the shiny R package. Nearly all shiny apps have other R package dependencies as well, and most also have operating system dependencies in addition to those operating system dependencies that come packages with r-ver. polisheddeploy has functions to help detect your shiny app's dependencies, and then create a Dockerfile that includes those dependencies.

If your app has many dependencies, you may have to make manual edits to the Dockerfile. The goal polisheddeploy is to quickly create an easy to understand Dockerfile, but it will not always find all dependencies, and it will not be able to install many database drivers.

Example

Basic example for creating a Dockfile for a Shiny app

pkg_deps <- get_pkg_deps("<path to your shiny app>")
sys_deps <- get_sys_deps(names(pkg_deps))

create_dockerfile(pkg_deps, sys_deps)

Polished deploy also has a helper function to add polished-load-balancer to your shiny app deployment. polished-load-balancer automatically starts and stops instances of your shiny app on separate R processes so that you can scale to more users.

add_plb("<path to create polished-load-balancer>")

And then you can create a Dockerfile for a shiny app that uses polished-load-balancer.

pkg_deps <- get_pkg_deps("<path to your shiny app>")
sys_deps <- get_sys_deps(names(pkg_deps))

create_dockerfile(pkg_deps, sys_deps, plb_dir = "<path to plb>")

After creating your dockerfile you can build and run your shiny app locally

docker build my_shiny_app .
docker run -p 8080:8080 my_shiny_app

Now that you have a containerized shiny app you can deploy it to any server or cloud service that supports docker containers.

Releases

No releases published

Packages

No packages published