Multiple apps using the same SQLite databases

What is the best approach to work with multiple apps that share the same databases?

1 Like

Hmm, SQLite is typically on-disk so SQLite by itself probably wouldn’t work for multiple apps. You could try LiteFS which is a distributed SQLite offering.

I’m a user of LiteFS.

Probably, the question was too broad. Let me rephrase it:

Keep in mind that the databases are SQLite.

What is the best option to share the same data between multiple applications?

Is it possible to share the same LiteFS cluster? What are the potential issues?

Is it better to use one of the apps as a server and the others as a client connection to the server using private networking? Does it make sense to have a mix of server for writes and disk for reads?

Hopefully, it is more clear now.

Yes, it’s possible to share a LiteFS cluster across apps as long as they’re in the same organization. You’ll just need to have the same FLY_CONSUL_URL set if you’re using Consul-based leasing and you’ll need to use the same lease key:

lease:
  type: "consul"
  consul:
    key: "mykey"

It’s probably easiest to have your candidate nodes in the same app & region but LiteFS will work across any group of machines.

@benbjohnson Thanks for your reply!

1 Like

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