Migration to NFS

This section explains how to migrate Posit Connect to use networked storage for its variable data.

Prerequisites

  1. Use PostgreSQL.

    It is recommended that you complete a migration from SQLite to PostgreSQL before attempting to store the Connect variable data in a networked file system.

    Important

    SQLite can be used together with a networked file system for Connect variable data, but the SQLite database MUST remain on local storage.

  2. Either root or sudo access on the Connect server.

    Transferring the Connect variable data, updating the Connect configuration, and managing the Connect service requires elevated privileges.

  3. A networked file system, mounted to some location on your Connect server.

    The networked file system must permit file ownership by root and by the Unix users that execute your content.

    Some content operations always use the Applications.RunAs user and the Applications.SharedRunAsUnixGroup group. Some content may declare that it should be run by a different Unix user. When Connect is configured to use PAM or Kerberos, the Unix user associated with the visiting, logged-in user can be used.

    All of these users must be allowed to access or own files hosted by the networked file system.

Workflow

Step 1: Stop Connect

sudo systemctl stop rstudio-connect

Step 2: Transfer files

Copy files from the old location to the new. By default, Connect data lives beneath /var/lib/rstudio-connect, though your configuration may use an alternate Server.DataDir location.

The copy MUST preserve file ownership, permissions, and special files like symbolic links. Not all file transfer clients are able to preserve these attributes.

Consider using rsync with the --archive / -a option to perform the transfer, such as in the following example.

rsync -a /var/lib/rstudio-connect/ /mnt/nfs/posit-connect

Step 3: Adjust configuration

Adjust your Posit Connect configuration to use the networked location as the Server.DataDir.

; /etc/rstudio-connect/rstudio-connect.gcfg
[Server]
DataDir = /mnt/nfs/posit-connect
Note

If your server needs to use SQLite, its data files MUST exist on local storage, not in the networked file system. Adjust your configuration so SQLite continues to reference the old, local location.

; /etc/rstudio-connect/rstudio-connect.gcfg
[Server]
DataDir = /mnt/nfs/posit-connect

[SQLite]
Dir = /mnt/local/posit-connect/sqlite

Step 4: Start Connect

Start the Connect service, using the new variable data location.

sudo systemctl start rstudio-connect