RStudio Package Manager supports multiple database options. Currently, the supported databases are SQLite and PostgreSQL.
Database.Provider property with a database scheme appropriate
for your organization. See the Database section in the appendix for
SQLite is the default database provider.
RStudio Package Manager will use SQLite database if the
setting has a value of
sqlite or if
Provider is not present in the
Here is a partial configuration which chooses to use SQLite.
; /etc/rstudio-pm/rstudio-pm.gcfg [Database] Provider = sqlite
You can also specify the directory to store the SQLite file on your file system.
This can be done by specifying
SQLite.Dir in the configuration file.
; /etc/rstudio-pm/rstudio-pm.gcfg [SQLite] Dir = /mnt/rstudio-pm/sqlite
If this field is not specified, it will default to
location must exist on local storage.
If the location for
Server.DataDir is not local storage but a networked
location over NFS, configure the
SQLite.Dir setting so it still resides on
some local volume.
PostgreSQL is an available database provider which is more powerful and performant than SQLite.
You must provide your own PostgreSQL server which will likely be a separate server from your RStudio Package Manager server (but not required). We currently support any 9.x, 10.x, or 11.x version greater than or equal to 9.5. Your PostgreSQL server does not have to be dedicated to RStudio Package Manager, but it must have its own dedicated database.
; /etc/rstudio-connect/rstudio-connect.gcfg [Database] Provider = postgres [Postgres] URL = "postgres://username:email@example.com/rstudio_pm" UsageDataURL = "postgres://username:firstname.lastname@example.org/rstudio_pm_usage"
The user credentials can be included in the
Postgres.URL URL - remember to
URL-encode any special
characters in the username or password. We recommend using
Postgres.Password to avoid using a bare password in your
configuration file. Examples using
Postgres.Password are found in PostgreSQL Passwords
The user credentials supplied in the
Postgres.URL URL must be able to create and alter database tables, and have
read/write permissions to the database referenced in the URL. A blank database with the given name MUST already
Using a separate PostgreSQL database for usage data¶
; /etc/rstudio-pm/rstudio.gcfg [Database] Provider = postgres [Postgres] URL = "postgres://username:email@example.com/rstudio_pm" UsageDataURL = "postgres://username:firstname.lastname@example.org/rstudio_pm_usage"
Using a single database with a separate schema for usage data¶
; /etc/rstudio-pm/rstudio-pm.gcfg [Database] Provider = postgres [Postgres] URL = "postgres://username:email@example.com/rstudio_pm" UsageDataURL = "postgres://username:firstname.lastname@example.org/rstudio_pm?options=-csearch_path=metrics"
RStudio Package Manager assumes by default that SSL is enabled on the PostgreSQL server.
If SSL is not enabled on your PostgreSQL database, add
?sslmode=disable to the
Using PostgreSQL with SSL disabled¶
; /etc/rstudio-pm/rstudio-pm.gcfg [Database] Provider = postgres [Postgres] URL = "postgres://username:email@example.com/rstudio_pm?sslmode=disable"
You can configure Package Manager to use a specific PostgreSQL schema by providing a search path in the URL. You control
this by giving PostgreSQL a search path as part of the URL by adding
options=-csearch_path=<schema-name> to the URL.
If it's the only item you're adding, separate it from the rest of the URL with
? (just like the
sslmode item above).
Otherwise, separate it from other items with '&'.
RStudio Package Manager will refuse to start when given a schema that does not already exist. The schema must be owned by the connecting user or by a group that contains the connecting user.
Using PostgreSQL with a search path¶
; /etc/rstudio-pm/rstudio-pm.gcfg [Database] Provider = postgres [Postgres] URL = "postgres://username:firstname.lastname@example.org/rstudio_pm?options=-csearch_path=rspm_schema"
When your PostgreSQL connection URL requires a password, use
Postgres.Password with an encrypted value to avoid
credential leakage. The configuration appendix section
explains encrypted settings, how to encrypt secrets like passwords, and using
them in your configuration file.
We do not recommend embedding passwords directly in the
Postgres.URL connection URL setting.
RStudio Package Manager uses
Postgres.Password when connecting to your PostgreSQL
database. Do not
Postgres.Password value. If necessary, RSPM will encode your password
when it is combined with the
Passwords included directly in
Postgres.URL need to have special character
percent-encoded. The set
of characters that must be encoded within the user information component of
a URL can be found in Section 3.2.1 of RFC 3986.
Here is a sample configuration using a PostgreSQL connection URL with a username and a separate, encrypted password.
; /etc/rstudio-pm/rstudio-pm.gcfg [Postgres] URL = "postgres://email@example.com/rspm" Password = <base64 encrypted password value>
The historical database connection URL can also be used with an encrypted
Postgres.UsageDataPassword to provide
the password associated with the connection URL
Here is a sample configuration that has two separate PostgreSQL URLs; one for the primary database and one for the usage database. Both connection URLs have separate, encrypted passwords.
; /etc/rstudio-pm/rstudio-pm.gcfg [Postgres] URL = "postgres://firstname.lastname@example.org/rspm" Password = <base64 encrypted password value> UsageDataURL = "postgres://email@example.com/rspm_metrics" UsageDataPassword = <base64 encrypted password value>
RStudio Package Manager relies on two databases by default. The primary database stores information needed to run the service including the arrangement of repositories, sources, and packages. Another database is used to record usage data like the number of times a package was downloaded.
If using SQLite, these two databases will be created automatically in the configured directory. If using PostgreSQL, you will need to define two different databases or schemas:
If you do not wish to track usage data, you can disable this feature by setting
Server.UsageDataEnabled = false. If disabled, usage data will not be tracked or displayed. You can use the
Server.UsageDataRetention setting to alter the amount of usage data you wish to retain (the default is 365 days). Increasing this value will consume more disk space for the usage data database and may negatively impact performance slightly over time for busy servers.