Run and manage Shiny applications as background processes.
With shinybg you can:
- launch a Shiny application without locking your current R session
- run multiple applications at once
- embed application in Jupyter notebooks
shinybg is currently under active development and is not yet available on CRAN. You can install the development version from GitHub:
remotes::install_github("tiledb-inc/shinybg", remotes::github_release())
Create two instances of the same app on ports 3001 and 3002.
app <- system.file("apps/sever-info-app.R", package = "shinybg")
app1 <- runBackgroundApp(appFile = app, port = 3001)
app2 <- runBackgroundApp(appFile = app, port = 3002)
You can test out embedding Shiny applications in a Jupter notebook using the provided [Dockerfile][]. Pre-built images are available on Docker Hub or you can build it yourself by running:
docker build -t tiledb/shinybg:latest .
Next, run the container, forwarding ports 8888 for the Jupyter server and 3000 for the embedded Shiny app.
docker run --rm \
-p 8888:8888 \
-p 3000:3000 \
-e JUPYTER_ENABLE_LAB=yes \
-v $PWD/dev:/home/jovyan/work \
tiledb/shinybg:latest
Within the Jupyter environment, launch an R-kernel Jupyter notebook and paste the following chunk into the first cell:
library(shiny)
library(shinybg)
renderShinyApp(
appFile = system.file("apps/sever-info-app.R", package = "shinybg")
)