https://github.com/Tychobra/polisheddeploy
Dockerize Shiny Apps
https://github.com/Tychobra/polisheddeploy
Last synced: 4 months ago
JSON representation
Dockerize Shiny Apps
- Host: GitHub
- URL: https://github.com/Tychobra/polisheddeploy
- Owner: Tychobra
- Created: 2022-10-23T14:50:30.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-04-09T16:22:13.000Z (about 1 year ago)
- Last Synced: 2024-08-13T07:11:22.436Z (8 months ago)
- Language: R
- Size: 45.9 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- jimsghstars - Tychobra/polisheddeploy - Dockerize Shiny Apps (R)
README
# 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
```R
pkg_deps <- get_pkg_deps("")
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.```R
add_plb("")
```And then you can create a Dockerfile for a shiny app that uses polished-load-balancer.
```R
pkg_deps <- get_pkg_deps("")
sys_deps <- get_sys_deps(names(pkg_deps))create_dockerfile(pkg_deps, sys_deps, plb_dir = "")
```After creating your dockerfile you can build and run your shiny app locally
```terminal
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.