Backup Guide

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

While Posit Workbench is running, it may be writing state to the database, any of the Workbench server state folders, or the user state folders. It is recommended that you stop Workbench before taking a backup. If you have multiple Workbench instances 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 Posit 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

  • ~/, for each user (If performing a backup for server migration)

Detailed instructions

Configuration

Posit 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 Alternate configuration file location and Customizing Sessions Settings sections for more information about custom configuration locations.

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

Workbench server state

Posit Workbench stores its state on the file system and in a database. The file system locations are:

  • /var/lib/rstudio-server

  • If modified, the Workbench 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 Workbench server and Launcher logs are stored in /var/log/rstudio/rstudio-server and /var/log/rstudio/launcher, respectively, by default. For more information about custom logging configuration see the Logging section.

Database

The database stores internal state for Posit Workbench. By default Posit Workbench uses a SQLite database, however it can be configured to use PostgreSQL. For more information about configuring a database for Workbench, 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 Posit Workbench to use a PostgreSQL database, you can should follow the PostgreSQL instructions for backing up your database.

User state

Posit 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, Posit 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 Posit 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.

Back to top