Comment on How do you manage you DB in a docker environment?
Zikeji@programming.dev 4 days ago
Individually. If the app requires a DB, I put it in the compose file. This simplifies both backups and migrations. My tooling for backups has a pre and post script I can customize on a per app basis so I just have the pre do whatever *dump for that DB and the post clean it up (backup takes a tar of the folder).
Mertn33@lemmy.world 2 days ago
My backup tooling just shuts down the container and associated db, then rysncs it all somwhere safe and restarts the container. Am I missing somethoing critical by not doing a db dump in the middle of that?
Most of the time that’s perfectly fine, but if the database were in the middle of an operation you risk corruption.
Mertn33@lemmy.world 2 days ago
The last thing I want is database corruption. That is why I “docker compose down” before I make a backup then “docker compose up” when the backup is complete. Is that not good enough? Do I have to do something else?
Yes that’s good enough! Sorry to clarify I leave mine running since a dump can recover if it gets corrupt.
Basically my backup contains the database and the SQL dump (or equivalent) - that way I don’t need to shutdown the service.