2DegreesInvesting / tiltWebTool

APP: https://tiltwebtool-x6xfk2fceq-uc.a.run.app/
https://2degreesinvesting.github.io/tiltWebTool/
GNU General Public License v3.0
0 stars 0 forks source link

Study how to implement CI/CD with a staging area #32

Closed maurolepore closed 1 month ago

maurolepore commented 1 month ago

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:

image

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.

Created on 2024-05-30 with reprex v2.1.0