How To Backup Your WordPress Site To Google Drive
We all know that backing up a live WordPress site is a mandatory task for any site owner.Since Snapshot was launched we’ve added sooo much new stuff! Head over to the project page to check out all the new features.
Storing backups in a remote location available from anywhere, is a sound strategy and anyone with a Gmail account has a cheap and easy solution.
In this Weekend WordPress Project, we’ll walkthrough how to use Google Drive as the remote store for those critically important site backups.
There are many, many backup solutions available for WordPress that cover the full range of complexity.
Regardless of a solution’s features, the best backup solution is the one that is undertaken regularly and is easily understood. Bells and whistles count for nothing if they are never rung or blown.
What’s also important is to think about the reverse process. Backups are created with one thing in mind: to recreate the backed-up site as at a particular time and day. The worst-case scenario is recovering from disaster but backups can also potentially be used to create a test site, deploy a new site or “reset” a site (common for demo sites).
Easy access to the backup file is obviously essential, especially in a disaster scenario, and locating these files in the cloud makes a lot sense. Especially so when you factor in that disk failure is the most likely cause of a disaster scenario and will render any locally (to the website) stored backups unavailable.
There are, of course, a myriad of cloud options and amongst the more popular backup solutions DropBox and Amazon S3 are well catered for. The same can’t be said for Google Drive, however, which is a little surprising given that you get 15GB for free. More than enough to store a reasonable number of backups for an average WordPress site.
The upside of this lack of widespread support is that it makes choosing a backup solution much easier. For this Weekend WordPress Project, we are going to use the basic version of UpdraftPlus.
Configuring UpdraftPlus and Google Drive is a little fiddly but well worth it. At the end of this process you’ll have piece of mind knowing that regular site backups are readily available in a safe offsite location.
Step 1 – Install UpdraftPlus Plugin
You’ll find the UpdraftPlus plugin in the WordPress plugin repository or you can simply search for UpdraftPlus in the Plugins > Add New screen.
You can also read more about the plugin and the various premium features at the UpdraftPlus website.
Step 2 – Configure Backup Contents And Schedule
Jump to Settings > UpdraftPlus Backups and set up your preferred options for what is backed up on your site and the backup schedule.
Unless you post multiple times a day, then daily is likely to be sufficient (you can always run a manual backup if you make substantial updates to the site). As for the number of backups, this will depend on whether you think you’ll always be restoring to the latest backup or whether you want the ability to roll-back to a particular day.
Of course, you have the option to run different schedules for files and database and this is worth considering. Chances are that most files will be copies of files that you have stored locally or can easily re-download, so you may not need to backup as regularly as the database which is going to be an unique store.
Perhaps start with backing up files weekly and database daily.
Step 3 – Configuring Google Drive As The Remote Storage
This is where it gets a little fiddly. What we need to do is create a Google Project that uses the Drive API, set up remote access to the Project and then authorize the UpdraftPlus plugin to use the Project. Sounds more complicated than it really is.
First step, of course, is to tell UpdraftPlus that we want to use Google Drive so, select Google Drive from the Choose your remote storage dropdown.
The content will automatically update to give you guidance on how to complete the configuration, along with the all-important redirect URI. Don’t worry if this doesn’t make any sense, just copy the URI and head over to your Google API Console (if you have a Google account then you’ve got a console).
Create A Project
When the Console appears, click on Create Project.
Enter a Project Name and Project ID that makes sense to you and click Create.
An Activity window in the bottom right-hand corner of your browser window will open displaying the progress of your project creation task. Once the task has completed, you’ll be taken to new project’s Project Dashboard.
Enabling The Google Drive API
We need to enable access to the Google Drive API for this project, so click on Enable an API.
You’ll presented with a list of the huge range of available Google APIs. Scroll down to Drive API and click on OFF.
A message will appear when the API has been enabled and Drive API will be listed at the top of the API list along with a number of other APIs that are automatically enabled when you created the project.
Allowing UpdraftPlus To Use The Drive API
You’ve now set up a Project that provides access to your Google Drive via an API. Now you need to enable UpdraftPlus to use that Project.
We’re going to jump around the menu items a bit, but it makes sense to do so. Go to your project’s API & auth menu and click on Consent.
This form is setting up the look of authorization confirmation that is displayed later in the process. There’s an example confirmation next to the form and if you’ve ever used a social network credentials to log into another site then you’ll already be familiar with the layout.
1.6 million WordPress Superheroes read and trust our blog. Join them and get daily posts delivered to your inbox - free!
The form looks a little complicated but all you need to do is select an EMAIL ADDRESS (if it’s not already pre-selected) and fill in a PRODUCT NAME – I’ve used WP Back Up – and click on Save.
Next, we need to set up the Credentials.
Under your project’s APIs & auth menu, click on Credentials and under OAuth, click on Create new Client ID.
Click on Create Client ID.
The dialog will close and you’ll see a new table titled Client ID for web application.
Copy the CLIENT ID and the CLIENT SECRET from the Console to the Google Drive Client ID and Google Drive Client Secret, respectively, in the UpdraftPlus Settings.
Click on Save Changes at the bottom of the UpdraftPlus Settings screen.
Annoyingly, this will take you back to the Current Status tab, so click on the Settings tab and either click on the link in the notification at the top of the page or scroll down to Authenticate with Google and click on the linked text there.
You should get the following page (notice the product name – WP Back Up – that we set up in Consent) – click on Accept to allow access to your Google Drive.
You should automatically return to the UpdraftPlus settings (this is also part of the test) and you will see a notification with details about your Google Drive account.
Success, indeed. You have successfully configured Google Drive as a remote store for your backups.
Step 4 – Test With A Manual Backup
Before popping any champagne corks, though, you need to test the backup process.
On the Current Status tab of the Updraft Settings, click Backup Now.
A popup dialog will appear allowing you to do some basic configuration of what is backed up but let’s leave the options unchecked and give UpdraftPlus a thorough workout.
Click on Backup Now and watch as UpdraftPlus updates you on the backup’s progress.
When it’s finished, UpdraftPlus will tell you that ‘the backup apparently succeeded’, which doesn’t exactly inspire confidence. So, check that the backups have indeed been created.
Click on the Existing Backups tab.
Don’t be put off by the (0) in the title, it will change almost immediately. If the backup was successful you should see an entry in the Existing Backups list.
Of course, the real measure of success is the existence of your backup files on your Google Drive account.
Jump into Google Drive and look for a folder called UpdraftPlus (this name is fixed unless you go for the premium version of the plugin). Double-click on the folder and check it contains files. The number of files will depend on what you’ve selected to be backed up but generally UpdraftPlus will create separate files for the database, the plugins folder and the themes folder.
You can now be confident that you are backing up to a remote location and the cornerstone of your Disaster Recovery Plan is now in place.
Restoring A Backup With UpdraftPlus
As I mentioned, a backup solution is really only as good as its restore and it’s probably a good idea to practice restoring rather than trying to break your duck under the pressure of a real disaster scenario.
Part of practicing is developing a run sheet – a list of the steps that you need to undertake to restore. It’s important to note, then, that UpdraftPlus does not back up your core WordPress files taking the approach that you can simply download these from the WordPress.org archives. This seems a pretty sensible approach to focus only what is likely to be unique on a WordPress installation.
In a complete disaster recovery situation, you are likely to be looking at:
- Downloading and running the installation process for the appropriate version of WordPress
- Install and reconfigure the UpdraftPlus plugin
- Restoring the database, plugins, themes and uploads (if backed-up) folders
If you want to just roll-back to a particular backup then you can do this in situ by hitting the Restore button next to any backup. Again, just as with the backup process itself, UpdraftPlus does a good job monitoring progress.
Worth The Time And Effort
There is practically no scenario where backing up is not worthwhile. Disk failures, host failures, security failures can all leave you up that proverbial creek and if you don’t have a backup of your site to fall back on then you are definitely paddle-less.
Setting up UpdraftPlus to backup to Google Drive can be a little fiddly, especially if you haven’t created a Google Project before, but it’s well worth the perseverance to have those backups stored remotely.
And well worth 15 minutes of your time this weekend.