19  shinyapps.io

Published

2024-09-12

19.1 Deploying the app

Below we’ll cover deploying your Shiny app-package in RStudio and Positron . The Positron IDE was still in the early stages of development when this section was written, so some of these steps may change in future versions.

19.1.1 In RStudio

To deploy the app, I can click on the Publish icon:

Send app.R to Console and click Publish

Send app.R to Console and click Publish

Make sure all the files in the package are selected, then click Publish

Publishing apps to shinyapps.io

Publishing apps to shinyapps.io

The Deploy pane will open and you’ll see a deployment log as your application is sent to the server:

show/hide deployment log
── Preparing for deployment ────────────────────────────────────────────────────
 Deploying "movie-reviews" using "server: shinyapps.io / username: yourusername"
 Creating application on server...
 Created application with id 12692760
 Bundling 27 files: .Rbuildignore, app.R, data/movies.rda, data/movies.RData, 
DESCRIPTION, inst/extdata/movies.fst, NAMESPACE, README.md, www/shiny.png,
man/display_type.Rd, man/launch_app.Rd, man/mod_scatter_display_server.Rd,
man/mod_scatter_display_ui.Rd, man/mod_var_input_server.Rd, 
man/mod_var_input_ui.Rd, man/movies_server.Rd, man/movies_ui.Rd, man/movies.Rd,
…, R/movies_ui.R, and R/scatter_plot.R
 Capturing R dependencies with renv
 Found 61 dependencies
 Created 389,882b bundle
 Uploading bundle...
 Uploaded bundle with id 9093617
── Deploying to server ─────────────────────────────────────────────────────────
Waiting for task: 1456625417
  building: Building image: 11062313
  building: Fetching packages
  building: Installing packages
  building: Installing files
  building: Pushing image: 11062313
  deploying: Starting instances
  rollforward: Activating new instances
  success: Stopping old instances
── Deployment complete ─────────────────────────────────────────────────────────
 Successfully deployed to <https://yourusername.shinyapps.io/app-name/>
Deployment completed: https://yourusername.shinyapps.io/app-name//

19.1.1.1 Deploy logs

On shinyapps.io, the deployment log shows the loadSupport() warning persists (but the application still deploys. The server-side warning is a known issue.1

shinyapps[12692760]: Running as user: uid=10001(shiny) gid=10001(shiny) groups=10001(shiny)
shinyapps[12692760]: Connect version: 2024.05.0
shinyapps[12692760]: LANG: C.UTF-8
shinyapps[12692760]: Working directory: /srv/connect/apps/movie-reviews
shinyapps[12692760]: Using R 4.4.0
shinyapps[12692760]: R.home(): /opt/R/4.4.0/lib/R
shinyapps[12692760]: Content will use current R environment
shinyapps[12692760]: R_LIBS: (unset)
shinyapps[12692760]: .libPaths(): /usr/lib/R, /opt/R/4.4.0/lib/R/library
shinyapps[12692760]: shiny version: 1.9.1
shinyapps[12692760]: httpuv version: 1.6.15
shinyapps[12692760]: rmarkdown version: (none)
shinyapps[12692760]: knitr version: (none)
shinyapps[12692760]: jsonlite version: 1.8.8
shinyapps[12692760]: RJSONIO version: (none)
shinyapps[12692760]: htmltools version: 0.5.8.1
shinyapps[12692760]: reticulate version: (none)
shinyapps[12692760]: Using pandoc: /opt/connect/ext/pandoc/2.16
shinyapps[12692760]: 
shinyapps[12692760]: Starting R with process ID: '31'
shinyapps[12692760]: Shiny application starting ...
shinyapps[12692760]: Warning in warn_if_app_dir_is_package(appDir) :
shinyapps[12692760]:   Loading R/ subdirectory for Shiny application, 
  but this directory appears to contain an R package. Sourcing files 
  in R/ may cause unexpected behavior. See `?loadSupport` for more details.
shinyapps[12692760]: ℹ Loading sap
shinyapps[12692760]: 
shinyapps[12692760]: Listening on http://127.0.0.1:123456

19.1.2 In Positron

After loading, documenting, and installing our app-package, we can deploy it in Positron using the rsconnect::deployApp() function.

Deploying Shiny app from Positron’s Console

Deploying Shiny app from Positron’s Console

As we can see, Positron doesn’t open a Deploy window or separate Terminal task for launching the application (it’s printed directly to the Console).

19.2 The rsconnect folder

When deploying a Shiny app, the rsconnect/ folder is automatically created to store configuration settings and deployment metadata for the app. Below are a few points to consider with regard to this folder:


  1. You can learn more about this warning by reading these posts on StackOverflow: How can I deploy my shiny app as a package?; Problem with directory when deploying app on shinyapps, and this post on Posit Community: Errors when deploying app on shinyapps.io.↩︎