Volumes
Volumes provide persistent disk storage for applications.
They also support remote access with any S3 compatible client, once S3 access is enabled for a volume.
In the current initial implementation, volumes are restricted to a single Edge region.
Volumes also at the moment only provide read-write-many semantics. Due to the automatic auto-scaling for apps, this means that volumes are not currently well-suited for databases or other more complex use cases that require a single writer.
Keep in mind that volumes can be accessed concurrently, and even from different nodes.
These restrictions (including the single-region restriction) will be lifted in the future.
Create and Use Volumes
- Every app may have multiple volumes.
- Each volume has a name, which must be unique for the application.
- Volumes can be mounted at a chosen path.
- Each volume can be mounted multiple times.
Simply extend your app configuration with a volumes
section:
# ...
volumes:
# A name for your volume.
# Must be unique for the given app.
- name: data
# Create a persistent volume named "data" in `/data`.
mount: /data
- name: more_data
# Create a persistent volume named "more_data" in `/other_mntpoint`.
mount: /other_mntpointThis will create two new volumes: “data”, which will be mounted at /data and “more_data” which will be mounted at /other_mntpoint.
Now just re-deploy your app with wasmer deploy, and the volume will be automatically created.
Your application can now use the mount path and treat it as persistent storage.
The name of a volume acts as a unique identifier. If you change the name the old volume - including its data - will be deleted!
Deleting Volumes
To delete a volume, simply remove it from your app configuration and re-deploy. The data will be purged, and your app will not have access to the volume anymore.
If you rename or remove a volume from the app.yaml configuration,
all data will be deleted when you deploy, and cannot be recovered.
Make sure this is what you want before deploying!
Inspecting Volumes
You can inspect volumes in two ways:
- in the web frontend on your app dashboard: Go to the “Storage” tab - you will see a list of volumes with their size.
- using the CLI:
wasmer app volume list [app]Remotely Accessing Volumes
Volumes are not only available to your apps, but can also be remotely accessed through the standard S3 API. S3 access is opt-in per volume.
First, enable S3 access for a volume:
wasmer app volume enable-s3Then use the CLI to retrieve the credentials:
wasmer app volume credentials --format=jsonThis will print a record for each S3-enabled volume with its S3 endpoint,
access key and secret key in the JSON format. The available formats are
rclone (the default), json, yaml and table.
To browse a volume’s files in the browser, open the “Storage” tab on your app dashboard and click “Go to File Explorer”. You can also manage files remotely over SFTP.
Configuring rclone
rclone is a popular CLI client that allows full access to your volumes. It even allows mounting a volume to your local machine!
You can get an rclone configuration snippet through the CLI:
wasmer app volume credentials --format=rcloneThis will print out a configuration snippet that can be added to the rclone configuration file.
The config file is usually located at ~/.config/rclone/rclone.conf, but you
can retrieve the active path with rclone config file.
Some examples of using rclone:
(Note: replace <target> with the name of the rclone target)
# List all volumes in this app:
rclone lsd <target>:
# List files in a given volume:
rclone lsd <target>:<volume-name>
# Copy a file to a volume:
rclone copy ./local-filename <target>:<volume-name>/remote-filename
# Mount a volume to a local directory
mkdir my-volume
rclone mount <target>:<volume-name> ./my-volumeRotating credentials
In order to rotate (i.e. automatically assign a different value) the credentials tied to your volumes, you can simply run this command with the CLI:
wasmer app volume rotate-secrets Rotation applies to the S3-enabled volumes of the app. To rotate a single
volume, pass --volume <name|mount|id>.
This command will rotate their values and show the new ones directly in the CLI.
Data Restoration Policy
We backup volume data every 24 hours. In the unlikely event of data loss (or if you want to restore older data), you can restore your data with a maximum recovery point objective (RPO) of 24 hours, meaning the most you would lose is one day’s worth of data. If you need data restoration, you can contact us from here: https://docs.wasmer.io/edge/support