4 Files & Directories

4.1 Program Files

The RStudio Connect installers place all program files into the /opt/rstudio-connect directory.

You should not need to change any files in the /opt/rstudio-connect hierarchy. Any alterations will be overwritten by subsequent re-installs or upgrades of RStudio Connect.

4.2 Configuration

The RStudio Connect configuration file is /etc/rstudio-connect/rstudio-connect.gcfg. You will edit this file to properly configure RStudio Connect for your organization.

A configuration management tool like Puppet or Chef can be used to maintain the rstudio-connect.gcfg file. We recommend that it be owned by root and have permissions 0600, as your configuration may need to contain passwords and other sensitive information.

RStudio Connect upgrades will not overwrite customizations to the rstudio-connect.gcfg file.

4.3 Server Log

The RStudio Connect server log is located at /var/log/rstudio-connect.log. This file is owned by root with permissions 0600.

If logrotate is available when RStudio Connect is installed, a logrotate configuration will be installed. The default configuration is to rotate the logfile when it exceeds 10MB. The old log file will be compressed and stored alongside the original log file with a .1.gz extension (then .2.gz, etc.). Up to twelve archived log files will be maintained; upon the 13th log rotation the oldest log file will be deleted.

4.4 Application Logs

Each R process launched by RStudio Connect produces output that is retained within the jobs subdirectory of the RStudio Connect data directory (see Section 4.5 for details). These directories and files are managed by the server. They are retained for 30 days and subsequently removed from the system.

Application logs are available in the RStudio Connect dashboard. The dashboard settings page for deployed content contains a Logs section containing execution details for each launched R process. Standard output and standard error are captured and available.

4.5 Variable Data

RStudio Connect manages uploaded Shiny applications, R Markdown documents, and plots. All of the variable data associated with this content is stored within the server’s data directory. This includes:

  • Deployment bundles as uploaded by the user.
  • Directories containing unpacked bundles, including R source code.
  • R packages, as demanded by the deployed code.
  • Rendered R Markdown documents.

The RStudio Connect data directory also contains information used by the server in managing your deployed content. This includes:

  • The RStudio Connect sqlite database and encryption key.
  • R process execution information including logged output.
  • Parameter overrides for R Markdown documents.

The default location for the RStudio Connect data directory is /var/lib/rstudio-connect. This can be customized by specifying an alternate DataDir in the Server section of your configuration file.

[Server]
DataDir = /mnt/rstudio-connect

The RStudio Connect database must exist on local storage. If the location for DataDir is not local storage but a networked location over NFS, configure the Dir setting in the Database section of your server configuration file.

[Server]
DataDir = /mnt/rstudio-connect

[Database]
Dir = /var/lib/rstudio-connect/db

4.5.1 Permissions

Data directory permissions are established by RStudio Connect as files are created. This section documents the general ownership patterns you will find under the RStudio Connect data directory. In general, directories which need to be directly accessed from R will be owned by the rstudio-connect user. Directories which need to to be accessed by rserver-monitor for metrics collection will be owned by the rstudio-connect user (or the user configured to run rserver-monitor). Other directories will be owned by root.

/var/lib/rstudio-connect is owned by root with permissions 0701.

For details on the ownership and permissions for the metrics data directories, please see Section 13. For details on configuring the user that runs rserver-monitor, please see Section 14.15.

The reports and apps subdirectories are owned by root with permissions 0711 and contain directories for each deployment. These nested directories are writable to R processes and therefore owned by rstudio-connect with 0700 permissions.

The R and packrat subdirectories will contain installed R packages. R will write into these directories as packages are installed. They need to be owned by rstudio-connect with 0700 permissions.

All other data subdirectories are owned by root with 0700 permissions.

4.6 Backups

We recommend including the RStudio Connect configuration file in /etc/rstudio-connect as well as the variable data directory which defaults to /var/lib/rstudio-connect in your system backups. If you have configured the database to be stored outside the data directory, ensure that it is also included in the backup.

A running RStudio Connect server may be writing into the data directory if there are any active deployments, applications or documents. You should stop the RStudio Connect server before taking a backup.

$ sudo stop rstudio-connect
# Run appropriate backup steps here.
$ sudo start rstudio-connect

Your platform may need alternate commands to restart RStudio Connect. Please see Section 2.2 for instructions specific to your operating system version.