Persistent storage

Keep data between OnePloy deployments with volume, file and directory mounts, and schedule storage backups to S3-compatible storage.

Containers are replaced on every deployment, so anything written inside them is lost unless it lives in persistent storage. Add a volume mount, directory mount or file mount on the application’s Persistent storage page to keep uploads, SQLite files, caches or configuration between deployments.

Which mount type should I use?

TypeWhat it doesTypical use
Volume mountA Docker volume managed by the server, mounted at a path in the container.Uploads, application data, SQLite databases.
Directory mountA directory on the server’s filesystem mounted into the container.Data you also want to reach from the host.
File mountA single file whose content you edit in OnePloy, written to the server and mounted into the container.Configuration files such as nginx.conf or php.ini.

How do I add persistent storage?

  1. Open the application and go to Persistent storage.
  2. Add a volume, directory or file mount.
  3. Enter the destination path inside the container, for example /app/storage. For a directory mount also enter the source path on the server. For a file mount enter the file content.
  4. Redeploy the application so the new container is created with the mount.

What happens to storage in preview deployments?

Volumes can receive an isolated -pr-N suffix for each preview deployment, so pull request builds never write into production data.

How do I back up persistent storage?

Volume and directory mounts can be backed up on a schedule.

  1. Open the application’s Backups page (for services, Storage backups).
  2. Create a scheduled backup and choose the volume or directory as the backup target.
  3. Set a frequency, for example daily.
  4. Optionally enable saving to an S3 storage so copies leave the server. Add the bucket first under S3 Storage.

Each run is listed under the backup’s executions. Backups saved only locally stay on the same server as the data, so use S3 for anything you cannot afford to lose.

Can I manage storage through the API?

Yes. Applications, services and databases each expose storages endpoints to list, create, update and delete mounts, plus endpoints to configure and run storage backups, for example POST /api/v1/applications/{uuid}/storages/{storage_uuid}/backups/run. See the API overview.

Warning: Deleting a volume mount from an application can delete the data in it. Take a backup first.

Last updated