Phoenix with SQLite on Fly.io and two volumes

Hello there,

I am a bit confused about how to deploy a Phoenix Application with SQLite. On the Volumes documentation, it says:

The first rule of Fly Volumes is: Always run at least two of them per application. If you don’t, at some point you’ll have downtime.

Further down, it is listed that volumes are independent (there is no replication). I followed the SQLite documentation and am a bit confused how to deal with two volumes?

Do I have to create two volumes and let the SQLite files replicate somehow (maybe LiteFS ?). I am still not certain what happens if I have only a single volume.

Thank you for answering,
Kiru

Yes, you’d need to use something like LiteFS for best availability.

You can run with one volume just fine, we just want you to know that apps with one volume are more likely to fail than you might be used to. I run apps with a single volume pretty frequently, but only apps that won’t hurt too much if they go down for 15 minutes or so a couple of times per year.

There’s also a data durability issue. Our volumes are on individual physical disks. If the disk fails, you will lose data. You can restore from the previous day’s snapshot, but that’s still hours of data that may go missing. If you’re ok with that, it’s no big deal!

1 Like

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