Skip to content

An open-source, faster Devin alternative

TypeScript

adjust docs

Brian Reardon64e6243bf49b
diff --git a/docs/sandboxes/mounts.mdx b/docs/sandboxes/mounts.mdx
index 0c2b62b6..a3927476 100644
--- a/docs/sandboxes/mounts.mdx
+++ b/docs/sandboxes/mounts.mdx
@@ -1,6 +1,6 @@
---
title: "Mounts"
-description: "Mount remote filesystems into a sandbox via FUSE — rclone's ~40 backends, or your own FUSE daemon"
+description: "Mount S3, GCS, Azure Blob, SFTP, WebDAV, and Dropbox into a sandbox via FUSE"
tag: "Preview"
---
@@ -9,28 +9,10 @@ tag: "Preview"
method names may change before GA.
</Note>
-Mount filesystems directly into your sandbox so your code reads and writes them
-like local files — no SDK calls, no chunked downloads, no boilerplate. Perfect
-for pulling in datasets, model weights, or a customer's bucket without staging
-anything to disk first.
-
-## Two drivers
-
-A FUSE mount is a userspace daemon that serves a filesystem under a mountpoint.
-The platform manages the mountpoint, secret injection, and teardown — the
-*driver* decides which daemon establishes the mount:
-
-| Driver | When to use | What you pass |
-| --- | --- | --- |
-| **`rclone`** (default) | You want S3 / GCS / Azure Blob / SFTP / WebDAV / Dropbox and ~35 more, behind a simple creds shape. | `remote` + `backend` + `creds` |
-| **`command`** | You already have a FUSE-ready filesystem (your own VFS, gcsfuse, s3fs, …) and don't want rclone as a middle layer. | a `command` (the daemon's argv) + `env`/`secrets` |
-
-Both share the same lifecycle (`list`, `remove`, hibernate survival) and the
-same secret guarantee — credentials never persist on the worker.
-
-## rclone driver
-
-Wrap any of rclone's backends behind `remote` + `backend` + `creds`:
+Mount remote filesystems directly into your sandbox so your code reads and
+writes them like local files — no SDK calls, no chunked downloads, no
+boilerplate. Perfect for pulling in datasets, model weights, or a customer's
+bucket without staging anything to disk first.
```typescript
import { Sandbox } from "@opencomputer/sdk";
@@ -53,12 +35,11 @@ await sandbox.exec.run("ls /mnt/data");
await sandbox.exec.run("head /mnt/data/train.csv");
```
-## How the rclone driver works
+## How it works
-The rclone driver uses [`rclone mount`](https://rclone.org/commands/rclone_mount/)
-under the hood — a single binary that speaks ~40 backends (S3, GCS, Azure Blob,
-SFTP, WebDAV, Dropbox, and more). When you call `mounts.add()` without a
-`driver` (or `driver: "rclone"`):
+Mounts use [`rclone mount`](https://rclone.org/commands/rclone_mount/) under the
+hood — a single binary that speaks ~40 backends (S3, GCS, Azure Blob, SFTP,
+WebDAV, Dropbox, and more). When you call `mounts.add()`:
1. The control plane templates an rclone config from your `backend` + `creds`.
2. The config is written to a tmpfs file inside the VM (mode `0600` — the
@@ -228,16 +209,106 @@ await sandbox.mounts.add({
artifacts.
</Warning>
-## command driver — bring your own FUSE
+## Listing and removing
-If you already have a FUSE-ready filesystem, skip rclone entirely. Pass
-`driver: "command"` with the daemon's argv; the platform runs it as the sandbox
-user, injects your env/secrets, waits for the mount to come live, and tears it
-down on `remove` — the same lifecycle as an rclone mount.
+```typescript
+const mounts = await sandbox.mounts.list();
+// [{ path: "/mnt/data", remote: "s3:my-bucket", backend: "s3", readOnly: true }]
-<CodeGroup>
+await sandbox.mounts.remove("/mnt/data");
+```
-```typescript TypeScript
+## Hibernate behavior
+
+Mounts survive hibernate/wake transparently. The VM snapshot captures the live
+FUSE mount and the rclone daemon process; when the sandbox wakes, both are
+restored as-is. No re-mount call needed — the mount is exactly where you left
+it, with the same credentials, serving the same path.
+
+```typescript
+await sandbox.mounts.add({ path: "/mnt/data", remote: "s3:my-bucket", backend: "s3", creds });
+
+await sandbox.hibernate();
+await sandbox.wake();
+
+await sandbox.exec.run("ls /mnt/data"); // still works, no re-mount needed
+```
+
+When you want a mount gone, call `remove()` explicitly:
+
+```typescript
+await sandbox.mounts.remove("/mnt/data");
+```
+
+That triggers an actual `fusermount3 -u` in the VM and drops the registry
+entry. No magic teardown on hibernate.
+
+### Stale credentials
+
+If the credentials behind a mount get rotated or revoked while the sandbox is
+hibernated, the in-VM rclone daemon — restored intact from the snapshot — is
+still holding the *old* keys and will start hitting auth errors on the next
+request. Fix: `mounts.remove(path)` then `mounts.add(...)` again with fresh
+credentials.
+
+## CLI
+
+```bash
+oc mounts add sb-abc123 \
+ --path /mnt/data \
+ --remote s3:my-bucket \
+ --backend s3 \
+ --cred access_key_id=AKIA... \
+ --cred secret_access_key=... \
+ --cred region=us-east-1
+
+oc mounts list sb-abc123
+oc mounts rm sb-abc123 /mnt/data
+```
+
+For raw rclone configs, point `--config-file` at a local file:
+
+```bash
+oc mounts add sb-abc123 --path /mnt/box --remote box:Reports --config-file ./rclone.conf
+```
+
+## Troubleshooting
+
+**`sandbox image is missing rclone and/or fusermount3`** — the sandbox is
+running on an older base image. Recreate the sandbox from the latest default
+template, or build an image off the current `Dockerfile.default`.
+
+**Mount succeeds but `ls` returns empty** — usually a creds /
+permission issue on the remote side. SSH in (`oc shell`) and run
+`rclone ls <remote>: --config /run/oc-agent/mounts/<id>.conf` to see the real
+error. Or `ls -la` the mount point — FUSE errors surface as filesystem errors.
+
+**`fuse: bad mount point ... permission denied`** — make sure the target path
+isn't already a non-empty directory you don't own. The mount call creates the
+path with `sandbox:sandbox` ownership; pre-existing roots can conflict.
+
+<Tip>
+ CLI equivalent: [`oc mounts`](/cli/mounts). Full reference:
+ [TypeScript SDK](/reference/typescript-sdk#mounts) ·
+ [Python SDK](/reference/python-sdk#mounts).
+</Tip>
+
+## Bring your own FUSE
+
+<Note>
+ Advanced — most users want the rclone path above. Reach for this only if you
+ already have a FUSE-ready filesystem.
+</Note>
+
+Under the hood, `mounts.add()` picks a **driver** — the daemon that actually
+establishes the FUSE mount. Everything above uses the default `rclone` driver.
+If you already have a FUSE-ready filesystem (your own VFS, gcsfuse, s3fs, …) and
+don't want rclone as a middle layer, use the **`command` driver**: you hand us
+the daemon's argv and we run it as the sandbox user, inject your env/secrets,
+wait for the mount to come live, and tear it down on `remove` — the same
+lifecycle as an rclone mount.
+
+```typescript
await sandbox.mounts.add({
path: "/mnt/data",
driver: "command",
@@ -246,15 +317,7 @@ await sandbox.mounts.add({
});
```
-```python Python
-await sandbox.mounts.add_command(
- path="/mnt/data",
- command=["my-vfs-fuse", "--bucket", "gs://my-bucket", "{mountpoint}"],
- secrets={"MY_VFS_TOKEN": os.environ["MY_VFS_TOKEN"]},
-)
-```
-
-</CodeGroup>
+In Python this is a separate method, `mounts.add_command(...)`.
### The `{mountpoint}` token
@@ -275,16 +338,13 @@ You can also hardcode the path — the token is just a convenience.
environment** (never the command line, so they don't leak via `ps`), never
written to disk on the worker, and never returned by `list()`.
-Both end up in the daemon's environment; the only difference is that `secrets`
-are kept out of every record and response. For daemons that need a credentials
-*file* (e.g. a service-account JSON), write it first with the
-[filesystem API](/sandboxes/filesystem) and point the command at it.
-
-### Read-only
+For daemons that need a credentials *file* (e.g. a service-account JSON), write
+it first with the [filesystem API](/sandboxes/filesystem) and point the command
+at it.
-`readOnly` is **advisory** for this driver — your command must honor it (we
-also export `OC_MOUNT_READONLY=1` so the daemon can read the intent). Unlike
-rclone, the platform can't enforce read-only on an arbitrary daemon.
+`readOnly` is **advisory** for this driver — your command must honor it (we also
+export `OC_MOUNT_READONLY=1`). Unlike rclone, the platform can't enforce
+read-only on an arbitrary daemon.
### Requirements
@@ -298,24 +358,19 @@ Your daemon must:
cleans up.
The platform handles the rest: `/dev/fuse` access, creating the mountpoint, and
-`-o allow_other` support (`user_allow_other` is set in `/etc/fuse.conf`).
-
-If the mount doesn't come up within the timeout, the call fails with the
-**daemon's own log tail** so you can see why (a bad flag, missing binary, auth
-error, etc.).
+`-o allow_other` support (`user_allow_other` is set in `/etc/fuse.conf`). If the
+mount doesn't come up within the timeout, the call fails with the **daemon's own
+log tail** so you can see why (a bad flag, missing binary, auth error, etc.).
-### Example: gcsfuse (GCS, no rclone)
+### Example: gcsfuse
[gcsfuse](https://cloud.google.com/storage/docs/gcsfuse-install) is Google's own
-GCS-to-FUSE adapter. Run it directly via the command driver — no rclone in the
-middle. Install it in your image (or at runtime), write your service-account key
-with the [filesystem API](/sandboxes/filesystem), and mount:
+GCS-to-FUSE adapter. Install it in your image (or at runtime), write your
+service-account key with the [filesystem API](/sandboxes/filesystem), and mount:
```typescript
-// 1. write the service-account JSON into the sandbox (tmpfs)
await sandbox.files.write("/run/gcp-sa.json", process.env.GCP_SA_JSON!);
-// 2. run gcsfuse via the command driver
await sandbox.mounts.add({
path: "/mnt/bucket",
driver: "command",
@@ -352,76 +407,9 @@ await sandbox.mounts.add({
// reads/writes under /mnt/mirror now pass through to /home/sandbox/data
```
-## Listing and removing
-
-`list()` returns both driver shapes:
-
-```typescript
-const mounts = await sandbox.mounts.list();
-// rclone: { path: "/mnt/data", driver: "rclone", remote: "s3:my-bucket", backend: "s3", readOnly: true }
-// command: { path: "/mnt/mirror", driver: "command", command: ["bindfs", "-f", ...], readOnly: false }
-
-await sandbox.mounts.remove("/mnt/data"); // fusermount3 -u, same for both drivers
-```
-
-## Hibernate behavior
+### CLI
-Mounts survive hibernate/wake transparently, **for both drivers**. The VM
-snapshot captures the live FUSE mount and the daemon process — rclone or your
-own — and `wake` restores both as-is. No re-mount call needed; the mount is
-exactly where you left it, serving the same path.
-
-```typescript
-await sandbox.mounts.add({ path: "/mnt/data", remote: "s3:my-bucket", backend: "s3", creds });
-
-await sandbox.hibernate();
-await sandbox.wake();
-
-await sandbox.exec.run("ls /mnt/data"); // still works, no re-mount needed
-```
-
-When you want a mount gone, call `remove()` explicitly:
-
-```typescript
-await sandbox.mounts.remove("/mnt/data");
-```
-
-That triggers an actual `fusermount3 -u` in the VM and drops the registry
-entry. No magic teardown on hibernate.
-
-### Stale credentials
-
-If the credentials behind a mount get rotated or revoked while the sandbox is
-hibernated, the in-VM rclone daemon — restored intact from the snapshot — is
-still holding the *old* keys and will start hitting auth errors on the next
-request. Fix: `mounts.remove(path)` then `mounts.add(...)` again with fresh
-credentials.
-
-## CLI
-
-rclone driver:
-
-```bash
-oc mounts add sb-abc123 \
- --path /mnt/data \
- --remote s3:my-bucket \
- --backend s3 \
- --cred access_key_id=AKIA... \
- --cred secret_access_key=... \
- --cred region=us-east-1
-
-oc mounts list sb-abc123
-oc mounts rm sb-abc123 /mnt/data
-```
-
-For raw rclone configs, point `--config-file` at a local file:
-
-```bash
-oc mounts add sb-abc123 --path /mnt/box --remote box:Reports --config-file ./rclone.conf
-```
-
-Command driver — pass `--command` (repeat per argv element) to run your own
-FUSE daemon; `--env`/`--secret` take `key=value`:
+Pass `--command` once per argv element; `--env`/`--secret` take `key=value`:
```bash
oc mounts add sb-abc123 \
@@ -431,30 +419,6 @@ oc mounts add sb-abc123 \
--secret MY_VFS_TOKEN=...
```
-## Troubleshooting
-
-**`sandbox image is missing rclone and/or fusermount3`** — the sandbox is
-running on an older base image. The rclone driver needs both `rclone` and
-`fusermount3`; the command driver needs only `fusermount3`. Recreate the sandbox
-from the latest default template, or build an image off the current
-`Dockerfile.default`.
-
-**`mount command did not produce a live mount … within timeout`** (command
-driver) — the error includes your daemon's **log tail**. Common causes: the
-binary isn't installed in the sandbox, a bad flag, or an auth failure. Reproduce
-by hand with `oc shell` and run the same command.
-
-**Mount succeeds but `ls` returns empty** (rclone driver) — usually a creds /
-permission issue on the remote side. SSH in (`oc shell`) and run
-`rclone ls <remote>: --config /run/oc-agent/mounts/<id>.conf` to see the real
-error. Or `ls -la` the mount point — FUSE errors surface as filesystem errors.
-
-**`fuse: bad mount point ... permission denied`** — make sure the target path
-isn't already a non-empty directory you don't own. The mount call creates the
-path with `sandbox:sandbox` ownership; pre-existing roots can conflict.
-
-<Tip>
- CLI equivalent: [`oc mounts`](/cli/mounts). Full reference:
- [TypeScript SDK](/reference/typescript-sdk#mounts) ·
- [Python SDK](/reference/python-sdk#mounts).
-</Tip>
+If the mount doesn't come up, the error includes the **daemon's log tail** —
+usually a missing binary, a bad flag, or an auth failure. Reproduce by hand with
+`oc shell` and run the same command.