I was updating my flyctl version ( flyctl version upgrade) and it appears that the sqlite database file on server was replaced with my local copy (which was an older version). I didn’t expect it to happen.
Unfortunately, I don’t have a snapshot/backup of the file. Is it still possible to restore my latest database file.
Thank you
p.s. I am not a software developer and still learning how to use these tools. .
I’m not sure this was related to upgrading our CLI. Did you do a deploy recently? Do you store your data in volumes?
My current guess is that your Dockerfile could be adding your database and each deploy or restart would make your database be as your local copy from the last time it was deployed.
No, I last deployed 4 months back and it was in passive mode for sometime now. From the dashboard, it looks like a new version was released by Fly admin bot 3 days back.
As I was experimenting with it, I didn’t save the data over volume (the sqlite file was in the same folder along with the scripts). I would occasionally ssh into the console to see if there was activity - the webapp I deployed does not have active users. I am not sure if version upgrade of flyctl would automatically restart/redeploy the files.
Although it is not crucial but I am curious to know if there is any chance to retrieve the database in such a situation.
The version upgrade does create a new VM using the built image. My guess is that this happened, feel free to correct me:
4 months ago you deployed a Nomad app (we call that apps v1) and your SQLite database was added on your image with something like COPY on your Dockerfile/Buildpack
Your app did not use a volume, volumes are persisted between deploys but rootfs is ephemeral meaning any deploy/restart would reset your app code which in this case also had your database.
When your app got migrated to Machines (we call that apps v2) we used the image built 4 months ago with the same starting point of your DB as 4 months ago.
The migration itself is not the issue, any restart/deploy of your app would have done something similar.
My recommendation: use volumes to store SQLite databases.
Thank you for the suggestion. I should start following the ideal practises in deploying such apps.
Please let me know in case there is still any way to retrieve the database before migration.