| ▲ | beagle3 5 hours ago | |
scp works as long as the app is not making changes at the same time. If there's a chance someone is writing to the database during the copy, you should "sqlite3 database.sqlite .backup" (or ".dump") first; Or, alternatively, on a new enough sqlite3, you have a builtin sqlite3_rsync that is like rsync except it interacts with the sqlite3 updates to guarantee a good copy at the other end. | ||
| ▲ | lifetimerubyist 4 hours ago | parent [-] | |
Great tips and you’re right. We just flip into an app-side maintenance mode before we run the backup so we know there’s no writes, scp the file and then flip it back. We only do nightlies so it’s not a problem. The shell script is super simple and we’ve only needed to do nightly backups so far so we run it in a cron at midnight when no one is working. Ezpz. Literally took us an hour to implement and been chugging along without issues for nearly 2 years now without fail. If we ever need more than that I’d probably just setup litestream replication. | ||