Skip to content

Latest commit

 

History

History
60 lines (45 loc) · 3.45 KB

shinyapps_deploy.md

File metadata and controls

60 lines (45 loc) · 3.45 KB

Deploying Data Curator to shinyapps.io

Anthony Williams

02-23-2022

Deploying an app to shinyapps.io is done with the rsconnect package. This can be done manually or automated in a GitHub action.

The GitHub action installs data curator's system and python dependencies on an Ubuntu Rstudio server image, and then pushes the entire directory to shinyapps.io using rsconnect.

Setup Configuration of OAuth and Schematic

Access shinyapps.io

Ask IT for access to the shinyapps.io account info in the Shared-Sage LastPass folder. Make sure you can view the site password. To login, enter credentials on shinyapps.io.

Add GitHub Secrets

Add shinyapps.io and synapse OAuth and schematic info to GitHub secrets for the repo.

*OAUTH_CLIENT_ID # your OAuth client ID
*OAUTH_CLIENT_SECRET # your OAuth client secret
*SCHEMATIC_SYNAPSE_CONFIG # content of .synapseConfig
*SCHEMATIC_SERVICE_ACCT_CREDS # content of schematic_service_account_creds.json
*SCHEMATIC_CREDS_PATH # content of credentials.json
*SCHEMATIC_TOKEN_PICKLE # content of token.pickle
RSCONNECT_USER # see the shinyapps.io record in LastPass
RSCONNECT_TOKEN # see the shinyapps.io record in LastPass
RSCONNECT_SECRET # see the shinyapps.io record in LastPass
REPO_PAT # GitHub personal access token

To automatically add credentials with * to GH secrets via GitHub CLI (Note: you still need to manually add shinyapps.io's credentials and GH PAT):

# follow instructions to configure GH CLI
gh auth login
# add secrets for OAuth and schematic  
Rscript set_gh_secrets.R oauth_config.yml schematic_config.yml

Configure the GitHub workflow file

Specify branches to push to which instances

There are two instances of data curator on shinyapps.io, "production" and "staging". By default, the action is configured to deploy the app to the "production" instance if there are pushes on tags named as semantic versions (e.g. v1.0.0). While pushing changes to branches named "main" or "develop" will auto-deploy app to the staging instance.

Install data curator dependencies

Currently, data curator requires several system dependencies to run on shinyapps.io in addition to schematic's python dependencies. libcurl4-openssl-dev

Set up a python virtual environment, install the develop version of schematic with poetry, and install necessary R packages as instructed in the README.

Update schematic configurations

Use GitHub secrets to write out the credentials files for OAuth and schematic, which are required for the configuration of data curator.

Deploy the app with rsconnect

To configure rsconnect, use rsconnect::setAccountInfo(user, token, secret) with the GH secretes started with "RSCONNECT". To deploy the app to "production" or "staging" instances based on what is setup in the workflow using rsconnect::deployApp().