Backup Guide

This section documents how to backup RStudio Workbench state. You may wish to perform backups of RStudio Workbench as part of your regular system backups or prior to upgrading your RStudio Workbench installation.

While RStudio Workbench is running, it may be writing state to the database, any of the server state folders, or the user state folders. It is recommended that you stop RStudio Workbench before taking a backup. If you have multiple RStudio Workbenches running in a load balanced cluster, each instance should be stopped prior to taking a backup.

Terminal

sudo rstudio-server suspend-all # Suspend all sessions if you are backing up user state
sudo rstudio-server stop
# Run appropriate backup steps here.
sudo rstudio-server start

Quick Start

The following is a list of the directories we recommend you include in your backup if you have the default configuration. For a more detailed explanation of each entry, and how to perform the backup if you have custom RStudio Workbench configuration, proceed to the Detailed Instructions section below.

  • /etc/rstudio/

  • /var/lib/rstudio-server/

  • /var/lib/rstudio-launcher/

  • /var/log/rstudio/rstudio-server/

  • /var/log/rstudio/launcher/

  • ~/.config/rstudio, for each user

  • ~/.local/share/rstudio, for each user

Detailed Instructions

Configuration

RStudio Workbench configuration is stored under /etc/rstudio/ by default. If you have configured a custom configuration location using XDG_CONFIG_DIRS or RSTUDIO_CONFIG_DIR, that location should be backed up instead. See the Alternative Configuration File Location and Customizing Sessions Settings sections for more information about custom configuration locations.

This directory includes your R version, session, server, and launcher configuration. It also includes global user preferences, custom themes, and custom fonts.

Server State

RStudio Workbench stores server-wide state on the file system and in a database. The file system locations are:

  • /var/lib/rstudio-server

  • If modified, the Server Shared Storage Path. This defaults to /var/lib/rstudio-server/shared-storage

  • The Launcher scratch path (default /var/lib/rstudio-launcher) and the scratch paths for each Launcher Plugin in use (default /var/lib/rstudio-launcher/<PluginName>)

  • The Server and Launcher logs are stored in /var/log/rstudio/rstudio-server and /var/log/rstudio/launcher by default. For more information about custom logging configuration see the Logging section.

Database

The database stores internal state for RStudio Workbench. By default RStudio Workbench uses a SQLite database, however it can be configured to use PostgreSQL. For more information about configuring a database for RStudio, see the Database chapter. For more information about what state is stored in the database, see the Data Dictionary.

SQLite

By default the SQLite database file is stored at /var/lib/rstudio-server/rstudio.sqlite. The name of the SQLite file may be different if you have configured the database setting in your /etc/rstudio/database.conf file.

PostgreSQL

If you have configured RStudio Workbench to use a PostgreSQL database, you can should follow the PostgreSQL instructions for backing up your database.

User State

RStudio Workbench stores per-user state by default in the .config/rstudio and .local/share/rstudio folders in each user’s home directory. If you have configured an alternate location using the XDG_DATA_HOME , XDG_CONFIG_HOME, RSTUDIO_DATA_HOME, or RSTUDIO_CONFIG_HOME environment variables user state will be stored in the configured location instead.

Restoring from a Backup

Similarly to when a backup is performed, RStudio Workbench should be stopped prior to beginning a restoration from a backup.

Terminal

sudo rstudio-server suspend-all # Suspend all sessions if you are restoring user state
sudo rstudio-server stop
# Run appropriate restoration steps here.
sudo rstudio-server start

After RStudio Workbench is stopped, replace all the files and directories listed above with the versions that you saved in your backup. If you are using a PostgreSQL database, follow the PostgreSQL instructions for restoring your database from backup.