LiteFS Configuration

First time trying fly and am out of my depth a bit as I usually only do front end dev. I am working on a discord bot in .net that uses SQLite. I got it to deploy and run but every time I deploy it, it wipes the db. So now I’m looking at using LiteFS and I’m finding the tutorial pretty confusing: Getting Started with LiteFS on Fly.io · Fly Docs

and this thread didn’t clear it up for me either: How do you properly configure a LiteFS deployment?

Currently I’m getting “litefs: not found” when I deploy.

I have the COPY --from… line in my dockerfile. The tutorial mentions you have to run LiteFS as root in docker instead of user. I have no idea what that means or how to do it. The link to the example dockerfile is broken though I did fine the repo and example and it does not have this COPY line in it which is confusing. Do I match the tutorial or the example docker file?

In the configuring the proxy I have no clue what port/address my app is listening to. I did update the db name. It says you can find more details by going to the proxy configuration guide but that link doesn’t work. There are a lot of broken links in this guide btw.

Importing your database. Not sure where I am supposed to use this ltx command. And when I click on the ltx import link for more details it shows different commands. It shows litefs import instead of ltx. I tried this line in powershell and it just says litefs or ltx is not recognized.

When you deploy, the VMs are ephemeral so they are reset on restart so that’s probably why you’re seeing the database wiped. If you have data you want to persist, you should add a volume to your app. You can find some more details on that here:

This is probably overkill for what you need if you’re new to backend/ops. Adding a volume and using vanilla SQLite is probably a better first step.

Thanks for the heads up! We recently did some revamping of the underlying docs software and I think some links got messed up. I’ll get those fixed up right now.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.