Mastering shiny doesn't show example deployment files. It does recommend renv though.
https://engineering-shiny.org/ mentions a deployment file for shinyapps.io but it doesn't show the file. Rather you can get it with golem. It also seems to nudge towards renv.
It's easy enough to setup two deplyment workflows for staging and production apps, where commits to any branch other than main deploys to staging, and main deploys to production. But to avoid deployments while drafting a PR is probably best to push the pr to a dedicated staging branch first and if all goes well then move the commit to main. This workflow is immediatley available.
What would be nice is to automate it, for example, by scraping the app in staging and if it shows no error, then proceed to main. What it's important to explore is the case when the workflow succeeds but the app looks like this - which seems to happen often when renv.lock is outdated:
It seems easy enough to detetct this from the response:
library(httr2)
request("https://mauro-2dii.shinyapps.io/tiltwebtool/") |>
req_perform()
#> <httr2_response>
#> GET https://mauro-2dii.shinyapps.io/tiltwebtool/
#> Status: 200 OK
#> Content-Type: text/html
#> Body: In memory (5297 bytes)
request("https://mauro-2dii.shinyapps.io/tiltwebtool-staging/") |>
req_perform()
#> Error in `req_perform()`:
#> ! HTTP 500 Internal Server Error.
It's easy enough to setup two deplyment workflows for staging and production apps, where commits to any branch other than
main
deploys to staging, and main deploys to production. But to avoid deployments while drafting a PR is probably best to push the pr to a dedicatedstaging
branch first and if all goes well then move the commit tomain
. This workflow is immediatley available.What would be nice is to automate it, for example, by scraping the app in
staging
and if it shows no error, then proceed tomain
. What it's important to explore is the case when the workflow succeeds but the app looks like this - which seems to happen often when renv.lock is outdated:It seems easy enough to detetct this from the response:
Created on 2024-05-30 with reprex v2.1.0