What Is CodeGuard?
CodeGuard is an automated, cloud-based backup service for websites and databases, and it's well suited to securely backing up your WordPress sites in real time.
When it comes to backing up WordPress, we need to consider all the files in our WordPress configuration, e.g. WordPress itself, themes, plugins, image uploads, etc., as well as our database. CodeGuard can manage backups for all of these.
Every day, CodeGuard will watch for changes and update its backups:
In this tutorial, I'm going to walk you through the process of using CodeGuard to configure backups on a typical self-hosted WordPress site.
How Much Does It Cost?
With the Ninja plan, you can back up one WordPress site for $5 per month, while the Ronin plan covers 12 sites for $39 monthly. More advanced plans are shown below. Every plan includes a 14 day free trial.
Signing Up With CodeGuard
Visit CodeGuard's website and click Sign Up Free to begin your trial. You'll be asked to provide your contact information and billing details:
You'll also need to specify a password:
Configuring CodeGuard for WordPress
CodeGuard works by backing up your files and databases via FTP, Secure FTP, and optionally SSH tunneling. Here's the information you'll need to configure CodeGuard for your site:
- Your FTP server information.
- Your MySQL server information.
- If using a shared WordPress host, you may need access to cPanel—some hosts may need you to whitelist CodeGuard's server IP addresses.
Here's a short video that shows how to set up CodeGuard with WordPress on a shared host environment with cPanel support:
I'm going to walk you through setting up CodeGuard with a typical self-hosted WordPress site on a Linux server. In my case, I'm using my generic Digital Ocean WordPress configuration.
Adding Your WordPress Site Files
Here's the CodeGuard Add Your Website form:
As I described in Securing Your Server Login, I like to run my instances on different ports. CodeGuard supports this as well:
When you click the Test Website Connection button, you should see the following success notice:
Before you go to Connect Your Website, let's make sure that our WordPress directory tree is accessible via FTP/SFTP on the account that we've specified for login in the above form.
Typically, FTP/SFTP will allow users to see their home directory. But often, the WordPress directory tree is in /var/www/
and/or outside the user's home directory.
CodeGuard has a simple recommendation provided here: How do I backup files not in my FTP/SFTP user's home directory? I'll walk you through the basics.
The short answer is to create a symbolic link to your WordPress tree in your user's home directory. For example:
cd ~ ln -s /var/www/wordpress
In some cases, you may also need to ensure that the user account you're providing to CodeGuard has permissions to see the WordPress directory. One approach to this is to create a user account just for SFTP access and add it to the www-data
group, e.g. the Apache user. Something like this:
sudo chown -R www-data:www-data /var/www sudo chmod -R g+rw /var/www sudo adduser sftp sudo adduser sftp www-data
Configure CodeGuard to use the sftp
user account. Then, when you click Connect Your Website, you should see your WordPress directory in the selection tree:
You'll need to select the folders and files to include and/or exclude from backups:
Now, CodeGuard is ready to begin your backup. At this time, you'll be offered a tour of the Dashboard!
Here is the Backup Progress Tracker, which shows you how far along CodeGuard is in capturing your first site image:
Every day CodeGuard will watch your site for changes and update its backup:
Adding Your WordPress Database
Does your WordPress site have a database? Of course it does.
Here's CodeGuard's standard Add Your Database form, but this time click Skip This Step, because we're going to use the advanced form.
Here's the Advanced Form, but with a typical Linux configuration, you'll actually need to choose the radio button for Tunnel over SSH:
Here's what the Add New Database form with SSH Tunneling looks like:
In order for CodeGuard to reach our MySQL Database, it will create an SSH Tunnel connection using our SSH login credentials—the same ones we log in to our server with, including the unique SSH port. Then, ideally, you'll have MySQL database credentials specific to your WordPress site, and provide those for it to access the database. I prefer to set up individual WordPress site database permissions, as opposed to using root or a global database account.
Once CodeGuard connects, it will ask you to choose from available databases which you can add:
Here's CodeGuard's Database Backup Progress Tracker:
When completed, CodeGuard will show you how many posts, pages, comments and users you have in your database:
The CodeGuard Dashboard
The CodeGuard Dashboard will provide you a daily summary of its activities. If you have lots of sites and servers, CodeGuard can back up one or all of them:
In case you're wondering, CodeGuard used to offer a WordPress plugin, but has moved away from that solution for security and reliability reasons.
If you're interested in WordPress Multisite, there are a couple of ways to configure CodeGuard to back up WordPress Multisite.
In Closing
I hope you've found this introduction to CodeGuard for WordPress to be useful. Please feel free to post corrections, questions and comments below. I do try to keep up with the Tuts+ discussions. You can also reach me on Twitter @reifman or email me directly.
Comments