Skip to main content
A Sprite is a persistent Linux VM on Fly.io that pauses when it’s idle and wakes on the next request. A Sprite’s own disk persists, but it belongs to that one Sprite. Mount an Archil disk in your Sprites and they can all read and write the same files, which your other machines and the Archil SDK can reach too. Sprites support FUSE, so the disk mounts as a regular directory. Run the mount as a Sprite service, which the Sprite’s runtime starts again whenever the Sprite boots.

Prerequisites

Set your Archil API key and region:
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 Sprite

Create a Sprite and install the archil client in it:
Save this script on your machine as archil-mount.sh. It mounts the disk at /mnt/archil, gives the sprite user ownership of it, and unmounts when the service is stopped:
archil-mount.sh
Upload the script and create a service that runs it, passing the disk ID, region, and token in the service’s environment:
The command streams the service’s first few seconds of output, ending with Successfully mounted. Write a file to the disk:

Share the disk between Sprites

Create a second Sprite and repeat the same steps:
Both Sprites 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 Sprite

The mount uses conditional mode. With --conditional, every Sprite can read and write anywhere on the disk at the same time, and none of them holds a lock that another Sprite has to wait for. See Sharing disks. Pauses need no special handling. When a Sprite pauses warm, the mount is suspended with it and the client reconnects on wake. When a Sprite boots cold, its runtime starts the archil service again, which mounts the disk before you use it. Stop the service to unmount. sprite-env services stop archil unmounts the disk and keeps it unmounted until you run sprite-env services start archil.

Clean up

Destroy the Sprites and delete the disk once you no longer need them:

Next steps