Skip to main content
A Blaxel sandbox is a microVM that drops to standby when it’s idle and resumes on the next request. Its files belong to that one sandbox and go away when you delete it. Mount an Archil disk in your sandboxes and they can all read and write the same files, which outlive any one sandbox and which your other machines and the Archil SDK can reach too. Blaxel sandboxes run as root and support FUSE, so the disk mounts as a regular directory.

Prerequisites

  • A Blaxel workspace and an API key. Export both so the Blaxel SDK can find them:
  • An Archil disk in the Archil region of your choice, and the Blaxel region nearest to it, such as us-pdx-1 for aws-us-west-2.
Set your Archil API key and both regions, and install the SDKs:
Create the disk with the disk CLI. The output includes the disk ID and a one-time mount token, which grants access to this disk only:
Export both for the steps below:

Mount the disk in a sandbox

This script creates a sandbox with the name you pass it, installs the archil client, mounts the disk at /mnt/archil, and writes a file to it. The token is passed only to the mount command:
mount.ts
Run it to create the first sandbox:

Share the disk between sandboxes

Run the script again with a new name:
Both sandboxes have the disk mounted at the same time, and the second one finds the line the first one wrote:

How the disk behaves in a sandbox

The mount uses conditional mode. With --conditional, every sandbox can read and write anywhere on the disk at the same time, and none of them holds a lock that another sandbox has to wait for. See Sharing disks. Standby needs no special handling. When a sandbox goes to standby, the mount is suspended with it, and the client reconnects when the sandbox resumes. Unmount before you delete a sandbox. The archil client buffers recent writes, and archil unmount returns once every one of them has reached the disk. Deleting a sandbox without unmounting can lose writes from its last few seconds.

Clean up

This script unmounts the disk in each sandbox you name, then deletes the sandbox:
cleanup.ts
Run it on both sandboxes, then delete the disk once you no longer need it:

Next steps