What a difference a year makes
Over the past year, my development workflow has changed dramatically. I’m now building client sites locally with GIT and Sass. Whenever I start a new project, I spin up a local WordPress install on a MAC using LocalWP. The ability to deploy my local development site to a staging or live server is one of the things that makes using it so powerful.
Some projects require that I download the client’s existing WordPress site and design the new site using a snapshot of their content and images. During the development process, my MAC is backing up the files on my drive with Time Machine to a NAS storage device in my office. It has two hard drives and keeps an exact copy of my backup on each one, so if one drive fails, my backup is not lost. This solves my need for a local backup. It’s the fastest way to restore a few select files or my entire system. Local backup is the first line of defense. The downside, there is no offsite backup in the event everything in my office suffers a catastrophic loss (theft, fire, tornado, flood….you get the idea).
Given all that – my local database is safe, right?
Well not exactly. I’m using GIT for version control, so I can easily roll back code changes, but what about my database? If it gets corrupted by a rogue plugin or version update – how do I restore it? I thought about this recently when a large client database got corrupted. Fortunately, I did have a backup, but it got me thinking, what if I had spent hours and hours building menus, entering content, and adding images? Where would that leave me?
There is no easy option in Time Machine to restore the database for one local development site. I know I’ve got the option to create a database backup in phpMyAdmin, but that’s a manual process. I am looking for a way to automate the process.
Automatic Backup of Your Local Database
I install the UpdraftPlus plugin on all of my local development sites, including this one I built for the Genesis Communities plugin I created.
If you’re searching for the plugin in the WordPress repository, be sure to select the correct one as there are currently two with similar names. UpdraftPlus (not Updraft) is the one you want.
Once you activate the plugin, configure it through the Settings tab.
Settings are where you schedule backup intervals for the files and your database. I usually leave the files set at manual, since the Time machine is backing up my drive regularly (hourly for the current day). If I need to create a restore point, I can always back up my files manually in UpdraftPlus. I choose every 4 hours for the database backup. That provides an automatic layer of protection. You can also configure how many copies you want it to retain. For the database, I usually bump it up to 30 – just to be safe. If I’m getting ready to do a lot of changes, I can also perform a backup of the database manually as I do with the files.
UpdraftPlus has a lot of nice features that make it an ideal backup solution for your website too. It handles large sites easily and it has the option to copy the backup to a remote server like Amazon S3, Dropbox, Google Drive, Rackspace Cloud, and many more. Their Premium version adds more options and permits scheduling backups for specific times.