Whether you’re here
in your Shiny journey:
Photo by Andriyko Podilnyk on Unsplash
bslib
- add themes, components, and layouts with easethematic
- extends your Shiny theme to plotsshinyuieditor
- a visual tool to help create the UI portion of your Shiny app
“But my app runs great on my laptop…”
Two sides to this coin:
📣 Design principle: Make your app a lightweight presentation layer
Performance workflow:
message
statements or use log4r
packageshinyloadtest
to simulate app performance under loadprofvis
to profile your app to identify bottlenecks🧰 References:
Activity
👉 Activity objective: explore the simply shiny app.
materials/05-shiny-app/05-shiny-app.Rproj
simple_ferry_app/app.R
Run App
and explore the shiny app.Get a taste for how shiny can be used to create reactive API queries!
Our Shiny application does a bit more:
ferryfairy
package.Our Shiny application does a bit more:
ferryfairy
package.📣 This Shiny application does not train a model! Move the computationally heavy stuff outside of your applications!
Note
👉 Activity objective: explore the simply shiny app.
materials/05-shiny-app/05-shiny-app.Rproj
ferry_delay_app/app.R
🤔 What happens when you need to make a change to the Shiny Application?
What if we deployed directly from the GitHub Repo?
Advantages:
Show and Tell
Let’s show you how to deploy a Shiny App (our simple Ferry app) to Posit Connect using Git Backed Deployment.
Runtime settings
Min processes — Keep a process running on the server at all times?
Max processes — Put a bound on the number of processes spawned?
Connections per process — A connection = a browser tab. How many connections will share the same process? Call this n
Load factor — Much like min processes, how early do you want to start a new process for that n + 1 connection?
The Shiny Restaurant Analogy
Let’s say you are the manager of a restaurant, and you need to determine two things:
The Shiny Restaurant Analogy
What components of our workflow deployed to Posit Connect would benefit from setting Min Processes
to > 0?
Monitoring Content
🧰 Posit Connect Server API
Most endpoints require an API Key, and results will be scoped to the permissions of the key.
Helpful to publishers:
Helpful to admins:
Full documentation: https://docs.posit.co/connect/api/
curl
and HTTP requests for easier interaction:
{connectapi}
R package{posit-sdk}
python packageRemember
Content returned from the Connect Server API will be scoped to the API key provided.
Activity
👉 Activity objective: Explore the Posit SDK {connectapi}
via the Connect Cookbook
materials/06-usage-monitoring/06-usage-monitoring.Rproj
_simple-sdk-example.qmd
https://pub.ferryland.posit.team/r/usage_monitoring/
Activity
👉 Activity objective: Deploy a ready-made usage dashboard, provided from the Connect Cookbook
materials/06-usage-monitoring/06-usage-monitoring.Rproj
06-usage-monitoring.qmd
Ideas and resources:
{log4r}
and export to a log aggregatorClick to go back to Data Science Workflows with Posit Tools - R Focus website ↩︎