Overwriting remote SQLite db with local dump

Hi guys, I am migrating my site from Vercel to Fly and I have created a local SQLite dump with all of my sites content. I have used fly launch to deploy the site which is working but now I need to overwrite the SQLite db file in the persistent volume with the one I have locally. Is this possible and how would I approach it?

I probably would do it this way (kinda hacky but might do the trick):

Put your local db file to be available on some url (e.g. dropbox).
If it is possible to overwrite it while your instance is running, then you could flyctl ssh console and just wget it there.

But if your instance is reserving that file somehow and it is impossible to overwrite it in-place, then you could run wget on your Dockerfile, before starting your app.

Then, when you have your file there running, you can remove that line from Dockerfile.

Do you know if its possible to FTP in and replace that way? To me that seems like the simplest solution. I asked on twitter also and fly proxy was mentioned but I have no clue how this would work with the sqlite3 CLI to replace/import the database

@savikko I tried what you suggested but wget doesn’t seem to be available? Do I need to do something so the command is available in the ssh console?

One potential idea is to ssh to the console and just manually install wget.

E.G: apt-get install wget

This would get removed on your next deploy, but that’s probably fine.

If your instance is indeed reserving that file and you can’t hot-swap you could just rename the new database file and change your app to point to it. There may be an sqlite specific approach that i’m missing, but this may be easy enough.

And well, of course you could first run there just some generic linux image (not tested this method but should work):

First remove any healthchecks from your fly.toml (so that image wont end up to restart loop).

Then:

flyctl deploy -i ubuntu

That will start basic ubuntu image there.

Then flyctl ssh console and have fun with wget and then when you have all the files there, do flyctl deploy

I had to do this recently, and found an easy way:

In one terminal: fly proxy 10022:22
In the second terminal: scp -P 10022 local/path/to/file.db root@localhost:/remote/path/to/file.db