Uploading R Markdown with source code & DB connections / queries

rstudioconnect

#1

Is the recommended approach for keeping credentials safe similar to what is recommended here? I would appreciate a short list of things to keep in mind before making the deployment - thanks!


#2

I was actually about to send you exactly that link :slight_smile: The overview it provides is pretty thorough:

Integrated security with DSN

Integrated security without DSN

Encrypt credentials with the keyring package

Use a configuration file with the config package

Environment variables using the .Renviron file

Using the options base R command

Prompt for credentials using the RStudio IDE.

You have to think about where the credentials are stored:

  • plaintext as a "service account", accessible by many
  • managed / known by each developer
  • interactive prompt
  • database specific locations (i.e. Postgres has a .pgpass file per user, etc.)

Certain environments have other options (i.e. RStudio Connect can set encrypted environment variables... we could probably do with improving those docs, and the RStudio IDE can prompt, etc... I'm sure there are others).

The other option is to use integrated authentication (for certain databases) using Kerberos. This is more typical in some enterprise environments and presents its own problems for scheduled Rmarkdown execution.


#3

Thank you, wanted to make sure - appreciated! :slight_smile:


#4

Btw: when I would like to only upload the "html" to R Studio Connect it doesn't seem to be a possibility without also including the Rmd file. Is that correct?


#5

Sorry for the late reply - I'm not 100% sure I follow. Are you talking about deploying only the HTML? If so, you need to render the report to HTML locally, and then click the blue publish button on the rendered content.

This article might be a useful resource as well: