Closed VioletBuse closed 1 year ago
@JulianBuse Good question. Currently, you'd need to run the migration out-of-band from the deployment to ensure it's on the primary. We do have write forwarding (https://github.com/superfly/litefs/issues/56) planned for v0.3.1 to make this easier so you can run a write transaction from any node—even if they're not the primary. You'll want to run most writes near the primary for performance reasons but it'd be fine to run infrequent migrations from any node.
Running
FROM flyio/litefs:0.2.0 AS litefs
Hi, so I'm trying to run automatic schema migrations with litefs in a fly.io project. The project has three regions/instances. I have a bash script that checks if the instance is the primary, and if it is, it runs the migration command:
The problem is that when I deploy an update, the first two instances to get the update all report that they are not the primary (since that last one is), but then when the last instance gets the update it is no longer the primary and thus the migration never gets executed. What can I do to ensure the migration is ran?