OrganizedFellow Posted September 10, 2019 Posted September 10, 2019 I have an old script that no longer works. My previous workflow was: prior to running git push, I would run a git alias that did a quick backup of the project, save with timestamp-filename, and then after successfully backing up, it would continue with git push to remote. That script is old and not working anymore. Rather than fix the script, I am wondering if anyone here has one they might share?!
netcarver Posted September 10, 2019 Posted September 10, 2019 Sorry, I have no regular script for this but mysqldump is good for creating a db.sql file that you can then store under git. You may be able to use something like a pre-commit git hook to automate the dump as part of your git workflow. https://github.com/DavidJRobertson/ProcessWire-ScheduleCloudBackups might be useful for live site backups - I've not used it myself. Wasabi is S3 compatible and much cheaper.
bernhard Posted September 10, 2019 Posted September 10, 2019 See here: https://github.com/BernhardBaumrock/tabulator.test/blob/837d509f1ef6816fe3629c163bd66d53c5e39209/site/ready.php#L31-L73 That's exactly doing what you are looking for but also creates a ZIP of the sql (which reduces size drastically). It also comes with a restore script: https://github.com/BernhardBaumrock/tabulator.test/blob/master/site/assets/mysqldump/restore.php This is the first time I'm using it, so it's not well tested and some parts are hardcoded (eg tabulator.sql / tabulator.zip). But it should get you going. I created this because the pw internal dump takes ages to restore ( for @dragan it took several hours? ). My workflow: logout commit changes push changes 4
dragan Posted September 10, 2019 Posted September 10, 2019 I'm using this: https://github.com/dragan1700/site-backup One script creates a ZIP of the entire site, the other creates a DB-dump. They can be also used with Cron, if you just put in the shebang (may vary in your server setup). Since normally I'm not working with huge databases, I didn't do an option to zip the .sql as well, but I might add that later if the need arises. 4 1
bernhard Posted September 10, 2019 Posted September 10, 2019 26 minutes ago, dragan said: I'm using this: https://github.com/dragan1700/site-backup That looks very similar to my version, didn't know about your script! I'd love to have a module that handles that properly...
dragan Posted September 10, 2019 Posted September 10, 2019 Well, I had it for ages, but only today made a Github repo and thought I could just as well share it. And yes, it's similar because we apparently use the same core class ifsnop :-) It's especially useful if you have to work on a site where you can't quickly create a files-backup as ZIP, nor un-zip easily via control panel (which is standard in Plesk et al). Or if you can't run system commands, because the hosting company doesn't allow it. On some sites, I have it running with a hook and/or PW lazycron. And before any major changes (dev/prod), I just trigger it manually. 2
Recommended Posts