Litefs database migrations with multiple machines in primary - how to determine writeable primary machine?

If you run LiteFS as the supervisor for your Rails app (e.g. litefs mount starts and it calls rails server) then you can set it up in the litefs.yml to only run certain commands on the candidate nodes. You can set lease.promote to true to automatically promote nodes as they start up which will ensure that the command is run by the primary.