evertramos / docker-wordpress-backup

Docker Wordpress Backup
Other
29 stars 9 forks source link

About a secondary backup mechanism #4

Open mcastillof opened 4 years ago

mcastillof commented 4 years ago

Hello Evertramos, I have been using your docker repos for more than a year and I'm more than happy.

I was playing a bit with this repo, and I see that the backup of the database is made by dumping the database to a .sql file (just like Wordpress backups docs shows). Since we are using docker, I would like to suggest a secondary backup method, to be enabled by a variable in .env.

With this new method, data/ folder should be treated exactly as data/site folder is currently working. By this way, data/db and data/site will end up in the same .tar.gz. With this mode, it could be easier to restore a backup, as you will only have to uncompress the file and restart the containers.

And I also think that it could be a good idea to backup docker-compose.yml and .env files. What do you think?

Even more, I think that to be a complete backup, the script should also get the repoDigest of the images that the containers have ("docker image inspect | grep -A2 Digest"). When restoring from the backup, the images to build the container have to be pulled using the same repoDigest. As I understand (I could be wrong), with those images (using the digest) and volumes you could create an exact copy of what you had earlier. As opposed, without the repoDigest, it wouldn't be an exact copy, and you could even have a broken system (I think). Let's say that a user has his containers running from a year ago, an he was using "mariadb:latest" (let's say that "latest" a year ago was 10.3 ) and "wordpress:latest" (let's say that a year ago "latest" was 4.9), if he has to restore from a backup or move the containers to another machine, as soon as he runs docker-compose up -d, he will get up to date "latest" images (let's say mariadb 10.4 and wordpress 5.4), and he could be with a broken system if there's no compatibility between both versions and the data/ folder.

If this sounds reasonable, I could help to implement this.

evertramos commented 4 years ago

Yes sir.

Some of what you say we are already doing in some other scripts.. I will release it all soon. Being very busy these days, but will be out soon.

Thanks and I will check the digest, now we are setting the image version instead of latest... but you got a good point on that.