Creating a LiteFS Cloud cluster
If you want to back up your database using LiteFS Cloud, you’ll need to create a LiteFS Cloud cluster. You can do this in the Fly.io dashboard. First, sign up for an account if you haven’t already. After you’re signed in, navigate to the LiteFS Cloud section on the left navbar, and then use the Create button to create a new cluster. Here’s a handy link to the LiteFS Cloud dashboard if you prefer! When you create your LiteFS Cloud cluster, you’ll be asked to save an auth token. Keep this handy - you’ll use it below.Configuring LiteFS to use LiteFS Cloud
Update LiteFS
Before configuring LiteFS Cloud, you must update your LiteFS to a version that supports LiteFS Cloud. Update tov0.5.0 or greater. You can do this by
installing the latest version.
LiteFS Cloud Configuration
When you created your LiteFS Cloud cluster, you got a LiteFS Cloud API authentication token. (If you lost it, you can create a new one in the LiteFS Cloud dashboard.) This token should be made available to LiteFS via theLITEFS_CLOUD_TOKEN environment
variable. If you’re running on Fly.io, you can add a secret for it with:
LITEFS_CLOUD_TOKEN environment
variable, and then restart LiteFS on each node. How you do this depends on how you have configured
LiteFS. If you’re running LiteFS separately from your app, then for each node, you should:
- Update your configuration with the new environment variable
- Stop your app (so that it’s not reading/writing data anymore)
- Restart litefs
- Start your app again!
systemd, you can restart it with: