Hi,
I would really like to know how I could backup / restore and migrate my instance of grocy (alongwith data) to a new webhost? I noticed that the "DATA" folder has a grocy.db file, so if i back this up, i can use it in the new location?
Yes, everything is in the /data directory, so just backup/restore that entire folder.
Thank you, much appreciated! Keep up the great work.
Because I searched for a backup script and found this on 2nd position in the search results:
DO NOT JUST COPY A SQLITE DB FOR A BACKUP!
If there is a write operation in this moment you will get a corrupt database in your backup.
See 1.2 here: https://www.sqlite.org/howtocorrupt.html
(A sample backup on command line would be: sqlite3 grocy.db ".backup 'grocy.db_backup.sq3'"
The .backup command locks the database to prevent writes during the backup.)
Super stuff @duracell , however dont you feel using @berrnd option is easier (and much safer!) rather than taking a command line backup / dump?
Hey @dilshandiss, I don't really understand how this "feels safer", can you explain this?
Because that's the point, copying the sqlite file itself is not safe if the service is running. So if you make a backup while there is a write operation you backup is corrupt and useless.
So, there are 2 backup options to prevent a database corruption:
(And in theory, if you're 100% sure the application is not writing, then it's also save to just copy, but that's hard to know, especially in an automated backup setting)