Using Fly for file storage

I know S3 is the typically obvious choice for file storage, but I’d love to avoid using AWS for what I’m building. I’d like to go all-in on Fly.io.

Is there an established way to use Fly for image hosting?

Same question, but for SQLite/Litestream/LiteFS data backups?

1 Like

Easiest would be to run an S3-compatible object storage app such as minio.

It’s an old tutorial, but it should still work.

Depending on your needs, you might want to add more than 1 instance, in different, close-by, regions, to replicate your storage.

I don’t have a turnkey solution unfortunately. We are planning on eventually providing a S3-like object store, but not for a little while!

3 Likes

For LiteFS, we have plans to make a real-time backup service available in the near future. The current focus is on stability and usability of LiteFS but after that we’ll be working on the backup service.

2 Likes

Sounds good. Thanks all!

Any tips on how to do that?

Did you end up with minio?

You can use Cloudflare R2 as well.

I’ve not tried it yet. I want to make sure I know how to make this work multi-region first.

I’d really prefer to keep the number of providers I’m using to a minimum, so I want to just use Fly if I can. Thanks for the suggestion though!

I understand. In my case I have Cloudflare as DNS provider and it didn’t mean to have accounts in more services, that’s why I was suggesting it.

I’ve been meaning to come up with a small demo. Or at least throw some notes together to point you in the right direction. If I don’t get back to you by Wednesday with at least some notes bug me again. Or bug Ben out of band and he can bug me :wink:

edit: sorry @benbjohnson :slight_smile:

1 Like

Consider yourselves bugged @DAlperin and @benbjohnson :sweat_smile:

1 Like

If you’re not doing anything too serious, consider using SQLite (LiteFS?) for blob storage as well. Dr. Hipp once revealed that Adobe found opening PDFs from SQLite was faster than accessing them via the filesystem. So, perhaps, it is okay to use for it serious storage workloads, too?

nb: Object stores are very different to typical file-based storage systems or even block-based drives: https://archive.is/AQ9EG (source).

I’d actually considered doing that. I’ll look into it! Thanks!

1 Like

@kentcdodds I am going to dump some of my notes here for you.

  1. Deploy MinIO Object Storage to Fly.io · Fly Docs establishes a procedure for building a single node minio deployment on fly
  2. Deploy MinIO: Multi-Node Multi-Drive — MinIO Object Storage for Linux describes an abstract procedure for deploying minio across multiple nodes. This documentation is not fly specifc and it leans heavily on systemd which is not relevant in fly-land. It does however outline some important concepts. This is a modified version of that document that is not as in depth but covers containers specifically: Deploy MinIO: Single-Node Multi-Drive — MinIO Object Storage for Container
  3. One key piece of information is that MinIO therefore requires using sequentially-numbered hostnames to represent each minio server process in the deployment.
    • for example, in a three node deployment the nodes would have to have the following hostname structure minio1.example.com, minio2.example.com, minio3.example.com. This can be accomplished in the usual ways but let me know if you have any questions about the dns setup.
  4. An example cluster topology as expressed in a docker-compose file can be found here: minio/docker-compose.yaml at master · minio/minio · GitHub

I haven’t had any time to test this out but I hope this is helpful in pointing you in the right directions. Feel free to ping me with any more questions, I’m personally very interested in seeing what kind of setup you end up with. I just pinged you on discord if you want to chat there as well :slight_smile:

3 Likes