Skip to main content

Move your persistent storage to Nife

If your app writes files it needs to keep, such as uploads or a local database file, it needs a persistent volume on Nife. This guide shows how to set one up and what to check before you move.

Before you start​

  • A list of the folders your app writes to and must keep.
  • The size of that data.

What a volume is on Nife​

A persistent volume is mounted at a folder inside your app's container. Data written to that folder stays after restarts, redeploys and scaling. Each volume has a name, a size and a mount path.

Step 1: List what you store today​

  1. On your current platform, find each disk or volume your app uses.
  2. Write down the mount path, such as /data or /mnt/data, and the size.
  3. Note which files your app needs to keep and which are only cache.

Step 2: Add a volume to your app on Nife​

With nifectl, set the volume when you create the app. Nife's database guides use these flags:

nifectl init --name your-app-name --org your-organization-name --volume-size 1 --volume-path /data

Use --volume-size for the size in GB and --volume-path for the mount path your app expects. You can see the volumes attached to a deployed app in the Volumes tab of the app, and across all your apps under Volumes in the dashboard.

Step 3: Make your app use the mount path​

Set your app to write to the mount path. For example, if the volume is at /data, set your upload folder to /data/uploads.

Step 4: Copy your existing files​

Copy your files into the volume's mount path before you switch your users over. Ask support@nife.io for the method that fits the size of your data.

Step 5: Test​

  1. Deploy and write a test file.
  2. Redeploy, then check that the file is still there.

What this guide does not cover​

Shared volumes between apps, volume snapshots and resizing an existing volume. Contact support@nife.io if you rely on these.

Need help? Email support@nife.io.