If you run a self-hosted WordPress site, don’t forget to include it in your backup plan!
Right now my WordPress backups are haphazard. I occasionally make a manual backup, download it to my computer, then let my usual backup process take over to copy the backup to my local and cloud destinations. Automating my WordPress backup has been on my to-do list for quite some time but hasn’t yet made it to the top.
The folks at Backblaze have written a nice overview of the various options for automatically backing up your self-hosted WordPress site. It’s worth a read. I’ll be using this to finally help choose my automated backup strategy for WordPress.
After checking out some of the options in the article linked above, all my WordPress sites are now being backed up automatically!
I chose BackUpWordPress, a free open source WordPress plugin to perform my backups. It backs up the database daily, and performs a full backup of all the WordPress files once a week. Setup is trivial. If you accept the default scheduled times for backups, all you need to do is install the plugin and activate it.
But BackUpWordPress alone is not good enough. The backups are stored on the server with the WordPress installation. If something goes wrong on the server to accidentally delete all my files, the backups are gone. Some of the options in the article linked above supports backing up to various cloud storage services. Even BackUpWordPress has premium extensions to backup to some cloud services. But I wasn’t happy with the costs of any of the plugins that support cloud backups, especially with multiple WordPress sites to backup.
So I geeked out and rolled my own cloud backup script for free.
I found rclone, a free open source command line utility for Linux, Windows and Mac that can synchronize files with just about every cloud storage service on the planet. It supports my preferred cloud storage service, Backblaze B2. It supports encryption. It works on my web host’s Linux OS. It can be installed without requiring root permission (very important when you’re using a shared hosting environment) and doesn’t have any fiddly prerequisites like Python or Java or whatever. And did I say it’s free?
After a few hours of investigation, I installed rclone on my web host, ran some test commands to make sure it worked, and wrote a simple script to copy the backup files created by BackUpWordPress to my B2 account. I installed my script in crontab to run once a week after my weekly full backup has completed.
Now, all my WordPress sites are being backed up automatically to the local server via BackUpWordPress and to my B2 account using rclone.