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 (
DesktopServer) LocalbyFlywheel. The ability to deploy my local development site to a staging or live server is one of things that makes using DesktopServer 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. I’m using a Synology 2-Bay NAS similar to this one: Synology America DiskStation 2-Bay Network Attached Storage (DS215j) (affiliate link)
To address that, I subscribe to CrashPlan to remotely backup my MAC every night.
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 is where you schedule backup intervals for the files and your database. I usually leave the files set at manual, since Time machine is backing up my drive regularly (hourly for the current day). If I need to create a restore point, I can always backup 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 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.
Want to do a quick database backup locally? Click Backup Now and check the last two boxes.
The existing backups tab, shows a list of your backups with a handy Restore button.
How to Backup and Restore DesktopServer