Connect Operations¶
Connect hosts what data scientists build: Shiny and Streamlit apps, Quarto and R Markdown documents, Jupyter notebooks, FastAPI and Plumber APIs, pins, and scheduled reports.
Publishing model¶
graph LR
subgraph Authors
WB("Workbench / desktop IDE")
Git("Git repositories")
CI("CI pipelines<br/>(rsconnect, Connect API)")
end
subgraph Internal["Internal Connect"]
IntAPI("Connect API")
IntRT("Content runtime")
end
subgraph DMZ["External Connect"]
DmzAPI("Connect API")
DmzRT("Content runtime")
end
WB -->|"push button publish"| IntAPI
Git -->|"git backed deploy"| IntAPI
Git -->|"git backed deploy"| DmzAPI
CI -->|"API deploy"| DmzAPI
IntRT --> IntUsers(["Internal users"])
DmzRT --> PubUsers(["Public / partners"])
style WB fill:#e8f1f8,stroke:#447099,stroke-width:2px,color:#1a1a1a
style IntAPI fill:#fdf1e3,stroke:#c9822b,stroke-width:2px,color:#1a1a1a
style IntRT fill:#fdf1e3,stroke:#c9822b,stroke-width:2px,color:#1a1a1a
style DmzAPI fill:#fdf1e3,stroke:#c9822b,stroke-width:2px,color:#1a1a1a
style DmzRT fill:#fdf1e3,stroke:#c9822b,stroke-width:2px,color:#1a1a1a
Authors usually publish to internal Connect from the IDE. Public content usually reaches an external Connect through Git backed deployment or a CI pipeline, since there is no Workbench in the DMZ.
What happens at deploy time¶
graph TD
Publish(["Author publishes bundle"]) --> Manifest("Connect reads manifest.json<br/>(renv.lock / requirements.txt)")
Manifest --> Version("Pick R / Python / Quarto version")
Version --> Resolve("Resolve packages from<br/>configured repositories")
Resolve --> Binary{"Binary available?"}
Binary -->|yes| Install("Install binary (seconds)")
Binary -->|no| Compile("Compile from source (minutes)")
Install --> Cache("Store in runtime cache")
Compile --> Cache
Cache --> Run("Start content")
Connect caches installed packages by version, so the second deployment using the same package versions is fast. Package resolution behavior is controlled by R.PackageRepositoryResolution (default lax: configured repositories plus those recorded in the content) and R.PositPackageManagerURLRewriting (default auto).1 See Package Manager binaries.
Runtime versions¶
Connect scans /opt/R/<version> and /opt/local/R/<version> for R installations by default (R.ExecutableScanning and R.ExecutableVersionScanning, both default true).1 Python has no compiled-in scan path: Python.ExecutableVersionScanning must list a directory, and Connect's package-installed starter config sets it to /opt/python.21 Listing executables explicitly gives you control and documents what is installed:
[R]
ExecutableScanning = false
Executable = /opt/R/4.6.0/bin/R
Executable = /opt/R/4.5.2/bin/R
Executable = /opt/R/4.4.3/bin/R
[Python]
Enabled = true
Executable = /opt/python/3.13.7/bin/python3
Executable = /opt/python/3.12.11/bin/python3
[Quarto]
Enabled = true
Executable = /opt/quarto/1.8.25/bin/quarto
R.VersionMatching decides what happens when content asks for a version that is not installed: nearest (default), major-minor, or exact.1 Regulated environments often prefer exact so that content fails loudly rather than silently running on a different R. See Change Control.
Install R, Python, and Quarto from Posit's prebuilt binaries (https://docs.posit.co/resources/install-r.html). Package Manager's Linux binaries are built against them.
External packages (last resort)¶
R.External tells Connect not to install a package and to use the copy in each R installation's system library instead:
Posit's guidance is that external packages reduce reproducibility and isolation and should be a last resort.3 Every external package must be installed into the library of every configured R version; if it is missing from any, Connect refuses to start unless ExternalsCheckIsFatal = false.1
Geospatial packages (sf, terra) are a common reason admins reach for External. Install the runtime system libraries (GDAL, PROJ, GEOS) on the Connect host and serve Package Manager binaries for your distribution. The packages then install as binaries in seconds and do not need to be external. Prefer that.
Git backed content¶
Connect can poll a Git repository and redeploy when the branch changes.4 Credentials for private repositories:
[GitCredential "github"]
Host = github.com
Username = <service-account>
Password = <ENCRYPTED_PAT>
Protocol = https
[GitCredential "gitlab"]
Host = gitlab.example.com
Username = <service-account>
Password = <ENCRYPTED_PAT>
Protocol = https
Use a dedicated service account with read only access, not a person's account. Encrypt the token with rscadmin encrypt-config-value.5 Set a calendar reminder for the token's expiry; an expired PAT silently stops Git backed updates.
Email¶
[Server]
SenderEmail = posit-connect@example.com
EmailProvider = "SMTP"
[SMTP]
Host = smtp.example.com
Port = 587
StartTLS = "detect"
User = <smtp-user>
Password = <ENCRYPTED_PASSWORD>
Without email, scheduled report delivery and failure notifications do not work.1 Use TLS if your relay supports it.
Data directory and storage¶
Connect keeps content, bundles, and runtime environments under Server.DataDir. Connect assigns ownership and permissions to files as it creates them. Modes below assume Connect runs as root:6
/var/lib/rstudio-connect/ # root 0701
├── apps/<app id>/<bundle id>/ # deployed bundles and source
├── bookmarks/<app id>/ # server stored Shiny bookmarks
├── reports/v2/<app id>/... # rendered output for reports
├── packrat/<version>/ # R packages installed for content
├── python-environments/ # Python packages and virtual environments
├── R/<version>/ # Connect's own R library for deployment (not visible to content)
├── metrics/ # metrics system data
└── trash/ # items being deleted
Server.LocalDataDir (default /var/lib/rstudio-connect-local) holds node local data. Keep it on local disk, even when Server.DataDir is on NFS.6
The data directory on NFS is normal, and required for high availability: every node's Server.DataDir must point to the same shared location.7 Storage rules:
| Requirement | Why |
|---|---|
| NFS version 3 or 4, or Amazon EFS7 | The supported shared filesystems |
Mount with lookupcache=pos7 |
Stops a node caching "not found", so a file created on one node is visible on the others |
Same UID and GID for rstudio-connect and every RunAs account on every node7 |
NFS enforces permissions by number, not by name |
SQLite on local disk; set SQLite.Dir if Server.DataDir is on NFS6 |
SQLite cannot live on a networked filesystem, and HA requires PostgreSQL anyway7 |
Keep trash and artifact locations on the same mount as the data directory6 |
Deletion relies on an atomic rename; across mounts it falls back to slow synchronous removal |
Connect sets HOME, USER, and TMPDIR for every content process, and each process gets its own temporary directory. By default /home is visible to content as it is; Applications.HomeMounting = true masks it with the RunAs user's home directory, or an empty directory if that user has none.
Interactive apps can write to their bundle directory (their working directory), but that data disappears at the next deployment. Posit recommends against using the filesystem for persistence. Code should read HOME rather than hard code /home/<username>.8
Current user execution¶
Applications.RunAsCurrentUser = true lets interactive content (Shiny, Streamlit, Plumber, Flask, FastAPI, Node.js) run under the Unix account of the person viewing it, instead of the shared Applications.RunAs account. Static content is not covered. The setting only permits the feature. Each content item must still be switched to "The Unix account of the current user" in its Runtime settings. An administrator or a user with the content:update-runas permission makes that change.9
| Item | Behavior |
|---|---|
| Requirements | An Enhanced or Advanced license, and OAuth 2.0, SAML, or LDAP authentication, or PAM for local execution only. Proxied and Password authentication are not supported.9 |
| Group membership | Every account that runs content, including the default RunAs account, must be in Applications.SharedRunAsUnixGroup, or the content fails to launch.9 |
| Where the bundle goes | Connect's documentation describes one location for deployed bundles, apps/<app id>/<bundle id>/ under the data directory, and no separate location for current user content.6 |
| Package installation | Always runs as the Applications.RunAs account, whatever the content's process owner, so the R library under packrat/ and the Python environments under python-environments/ are built by that account.8 |
| Anonymous viewers | Run as the fallback RunAs account.9 |
| Processes | Not shared between viewers. Max processes applies per viewer, so plan capacity by concurrent viewers.9 |
| Files the app writes | One viewer's files may be unreadable to the next, which can break the app. Give shared files group read permission explicitly; every viewer shares the SharedRunAsUnixGroup group.9 |
| Environment variables | A viewer's own ~/.Renviron can override values set in the Vars pane. Set R_ENVIRON_USER to an empty string to prevent this.8 |
Some content only needs each viewer's identity to reach an external system. For that, Posit says an OAuth integration is usually the better choice, because processes stay shared.9
Deploying an app-package¶
An app-package is a Shiny app built as an R package (DESCRIPTION, NAMESPACE, R/, inst/). Connect deploys it like any Shiny app: the bundle needs an app.R (or ui.R and server.R) at its root. There are two ways to provide one.
Deploy the package source. For example, golem::add_positconnect_file() writes an app.R that loads the bundled source and starts the app, and the golem deploy script bundles R/, inst/, data/, NAMESPACE, DESCRIPTION, and app.R:10
# app.R
pkgload::load_all(export_all = FALSE, helpers = FALSE, attach_testthat = FALSE)
options("golem.app.prod" = TRUE)
mypkg::run_app()
pkgload::load_all() runs every time a process starts, and compiles any C, C++, or Fortran code in src/.11 With current user execution, that happens once per viewer, under each viewer's account. A package with compiled code is a poor fit for this approach.
Install the package instead. Build it, publish it to an internal Package Manager repository (see Internal packages), and deploy a small app.R that only calls the installed package:
Connect installs mypkg and its dependencies into the content's library at deploy time, as the Applications.RunAs account.8 Every viewer starts the same installed code, and nothing is built while the app runs. This is also easier to defend in validated work. The version that runs is the version in the repository, not whatever source was in the bundle.
Tracing content to a user¶
Nothing on disk names a person. The directories under apps/ and the archives under bundles/ are numbered, and a process list shows only a Unix account and a PID. The numbers are Connect's internal IDs, and the Connect Server API maps them back to content items and the people behind them.12
flowchart LR
Disk[("apps/14/108/<br/>bundles/app-14-108.tar.gz")]
Proc("Linux process<br/>PID and Unix user")
Bundle("Bundle<br/>id, created_time, active")
Job("Job<br/>pid, run_as, hostname")
Content("Content<br/>id, guid, owner_guid")
Audit("Audit log<br/>user_guid, action")
Owner(["Owner<br/>(creator)"])
Deployer(["Deployer"])
Disk -->|"bundle id"| Bundle
Disk -->|"content id"| Content
Proc -->|"pid"| Job
Bundle --> Content
Job -->|"content_id"| Content
Content -->|"owner_guid"| Owner
Content -.->|"deploy events"| Audit
Audit -->|"user_guid"| Deployer
style Disk fill:#f1eaf6,stroke:#7a4f9a,stroke-width:2px,color:#1a1a1a
style Bundle fill:#fdf1e3,stroke:#c9822b,stroke-width:2px,color:#1a1a1a
style Job fill:#fdf1e3,stroke:#c9822b,stroke-width:2px,color:#1a1a1a
style Content fill:#fdf1e3,stroke:#c9822b,stroke-width:2px,color:#1a1a1a
style Audit fill:#fdf1e3,stroke:#c9822b,stroke-width:2px,color:#1a1a1a
For content item 14, deployed six times, the two directories look like this:
/var/lib/rstudio-connect/
├── apps/
│ └── 14/ # content id (mode 0700)
│ └── 108/ # bundle id: the deployed source (owned by rstudio-connect, 0750)
└── bundles/
├── app-14-20.tar.gz # app-<content id>-<bundle id>
├── app-14-57.tar.gz
├── app-14-68.tar.gz
├── app-14-77.tar.gz
├── app-14-84.tar.gz
└── app-14-108.tar.gz # the active bundle (the content's bundle_id)
Connect's documentation places deployed bundles and source in apps/<app id>/<bundle id>/. It also names a bundles/ directory under the data directory but does not describe it.6 On a server I inspected, bundles/ held archives named app-<content id>-<bundle id>.tar.gz: app-14-20.tar.gz, app-14-57.tar.gz, and so on up to app-14-108.tar.gz were six deployments of content item 14. Each deployment adds an archive, and with Applications.BundleRetentionLimit at its default of 0, none are removed.1 The content item's bundle_id field identifies the active one.12
From content ID to owner and deployer¶
A content item's id is its internal numeric identifier, the number in those paths; its guid is the identifier the rest of the API uses. owner_guid is the user who created the item. run_as is the Unix account the content runs as (null means the default Applications.RunAs), and run_as_current_user shows whether current user execution is on. With an administrator's API key, GET /v1/content returns every content item; it filters by name or owner_guid, and include=owner adds the owner's basic details.12
The commands below start from content ID 14 and walk to its bundles, its jobs, and the audit log. The API types id as a string, so the select() compares against "14", not 14:
H="Authorization: Key $CONNECT_API_KEY"
# content ID 14 to GUID, name, owner, and runtime account
curl -s -H "$H" "$CONNECT_SERVER/__api__/v1/content?include=owner" |
jq '.[] | select(.id == "14") | {guid, name, owner_guid, owner, run_as, run_as_current_user, bundle_id, dashboard_url}'
GUID="<content guid>"
# every bundle for the item; the deployed one has active = true
curl -s -H "$H" "$CONNECT_SERVER/__api__/v1/content/$GUID/bundles" |
jq '.[] | {id, created_time, active, size}'
# jobs (processes) for the item
curl -s -H "$H" "$CONNECT_SERVER/__api__/v1/content/$GUID/jobs" |
jq '.[] | {key, pid, hostname, run_as, content_id, bundle_id, start_time, tag}'
# who did what
curl -s -H "$H" "$CONNECT_SERVER/__api__/v1/audit_logs" |
jq '.results[] | {user_guid, action, event_description}'
The owner is not necessarily the person who deployed a bundle. owner_guid records who created the item, and collaborators can publish to it too.13 The audit log is the record of who deployed: each entry's user_guid is the actor who performed the action.12
From a process to its content¶
The reverse trip starts at the process. ps -o user,pid,lstart,args -u <account> lists an account's processes with their start times. Connect sets CONNECT_CONTENT_GUID (the content GUID) and CONNECT_CONTENT_JOB_KEY (a unique identifier for that execution) in every content process's environment, so /proc/<pid>/environ points at a content item. Reading another user's /proc/<pid>/environ requires root. Content owners can also overwrite both variables in the Runtime tab or through the API, so treat them as hints, not evidence.13
The evidence is a match between the PID and the pid field in that content's jobs list. Each job also records hostname, the node that processed it, and run_as, the Unix user that executed it.12 With current user execution, that Unix user is the viewer, not the owner (see Current user execution). On 2026.11.0 and later, an administrator can also call GET /v1/system/processes to list running processes, with their content GUID, across all nodes.12
In validated work, auditors ask for this chain as the attributable record. It links the bundle archive, its content item, the deployer in the audit log, and the account the process ran as. See Audit Trail.
Content and disk management¶
| Setting | Default | Notes |
|---|---|---|
Applications.BundleRetentionLimit |
0 (keep all) |
Bundles kept per content item. Lower values save disk; in regulated work, keep enough to reproduce what was released1 |
Server.CompilationConcurrency |
1 |
Passed to make -j for source package builds; raise carefully on small hosts1 |
Server.DataDir |
/var/lib/rstudio-connect |
Content, bundles, runtime caches; must be shared storage for HA16 |
Server.TempDir |
$TMPDIR |
Must allow execution; noexec mounts break installs1 |
Check disk use under the data directory regularly. The posit-connect script reports the free space and prints the command that measures the directory's size. Runtime caches can be cleared and rebuilt; see Runtime caches.
Branding and landing page¶
[Branding]
Enabled = true
DisplayName = "Example Analytics"
[Server]
LandingDir = /usr/local/share/connect-landing/
A custom landing page replaces the default for anonymous visitors, useful for a public facing tier.1 In HA, LandingDir must be identical on every node.7
Maintenance messages¶
Set maintenance banners on System > Custom Messaging. Server.PublicWarning and Server.LoggedInWarning are deprecated; Connect imports their values once and then ignores them.1
Remove the message when maintenance is done.