Deployment fails when SQLite migration is slow

I’m running into problems deploying an SQLite/Litestream-based app on Fly when a migration runs slowly. For example, a migration might create a new index for a large table. If the migration takes too long, Fly kills the process and restarts it. This keeps happening and the app never finishes deploying.

It’s not possible to use the release_command to run the migration because it needs to be run on the same volume. As far as I understand, the recommendation is to run the migrations when the app starts up.

Is the best approach to add an explicit check with a long grace_period to account for the long migration? Has anyone else found a better solution for this issue? Thanks!

Hi there,

Does migration happen at deploy time? Did you try tuning the --wait-timeout to allow the long-running table change to complete?

  • Daniel
1 Like

Thanks! That did prevent Fly from restarting the deploy while the migration was still in progress.

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