Define Primary Region for LiteFS

I’d like to specify which region is my primary region. From what I can tell from the tutorial, LiteFS adds a .primary file so my app can tell whether it’s in the primary region, but is there a way to control which region is primary?

Haven’t done this myself, but I can think of two ways:

  1. Set candidate: false on all but the VMs in the desired primary region (ref).
  2. Setup a static lease against a single VM (ref).
1 Like

Thanks! From that static lease docs, it appears that explicitly defining the primary is actually discouraged. Is that the case?

EDIT: After reading How LiteFS Works · Fly Docs I’ve determined it’s important that the primary be dynamic. This is fine. Thanks for the references!

The biggest downside to static leases is that you will have downtime when you deploy since you’ll have to restart the leader and there’s no other node to hand off to. However, sometimes that not a big deal to lose write availability during deploys—especially if the deploys are fast. Other than that, there’s not much of a downside to static leases.


In Fly’s context, the deploys may be fast, but the state-of-the-world propagation (1, 2) to the Fly Edge isn’t quite…