Migration into a Container
These instructions explain how to migrate your Posit Connect installation from a provisioned server or virtual machine (VM) into a container.
Prerequisites
Either
root
orsudo
access on the current Connect server.Managing the Connect service requires elevated privileges.
Use PostgreSQL.
Confirm that your Connect installation uses PostgreSQL before attempting to migrate into a container. If your installation still uses SQLite, migrate from SQLite to PostgreSQL.
Connect variable data uses a networked file system.
Confirm that your Connect installation uses a networked file system for its variable data before attempting to migrate into a container. If your installation still uses the local file system, migrate from local storage to NFS.
Upgrade Connect, if necessary.
Confirm that the version of Connect on your current server matches the product version you intend to use in the container. Separate product upgrades from changes to your infrastructure.
Obtain an image.
You need to create or obtain an image to run Posit Connect. Posit provides a number of product images on Docker Hub. The source for those images is available on GitHub.
If you are building your own image, the basic
Dockerfile
in the Docker section may help you get started.Privileged container access.
NotePrivileged containers are not necessary when using off-host Kubernetes execution.
In order to support process sandboxes, Posit Connect must be started with the
CAP_SYS_ADMIN
capability. The Docker and Sandboxing sections contain additional details.A Connect API key for an administrator account.
You will use this API key to clear the runtime caches and optionally rebuild content after starting Connect in the new environment.
Workflow
Step 1: Stop Connect (server/VM)
Stop the Connect server.
sudo systemctl stop rstudio-connect
Step 2: Start Connect (container)
This command-line assumes that you are using one of the Connect images hosted on docker hub. The directory /mnt/connect
is mounted into the container at the default /var/lib/rstudio-connect
location and used for the Connect variable data.
docker run -d --privileged=true --rm \
-p :3939:3939 \
-v /mnt/connect:/var/lib/rstudio-connect \
rstudio/rstudio-connect:jammy-2023.03.0
You may need to adjust this command for your environment and infrastructure.
Step 3: Route traffic
Adjust your infrastructure so your Connect requests are routed to and serviced by the container running Connect.
Step 4: Clear runtime caches & rebuild content
The content runtime caches containing the R and Python package dependencies for your content are incompatible with the Linux distribution and system libraries available within the target container.
You MUST clear these runtime caches and rebuild your deployed content.