Categories
WordPress

Duplictity & Deja Dup as my WordPress backup workflow

I’ve been using duplicity to backup my personal WordPress website’s wp-content folder for a month and I love this new process.

Duplicity is a Linux terminal backup application that you may know by its Gnome desktop client Deja Dup which I also use to backup my computers.

My backup workflow

I backup my WordPress database daily using MySQL and bash

It quickly creates a snapshot of the database but I needed an efficient way to manage my wp-content folder where WordPress saves all my themes, plugins and media files. This is where duplicity comes in.

While logged into my website via ssh I use a simple command to create and update an archive of my wp-content folder and save it just out of public reach.

# duplicity /var/www/html/wp-content/ file:/var/www/backups/

Note: My website’s setup uses /var/www/html as the public folder and /var/www/ is not shared by my apache web server.

Not much has changed from a my last backup a moment ago

Duplicity quickly updates a snapshot of my wp-content folder.

As you can see above, the archive is 649 MB but nothing new was added since the last backup a few minutes earlier. This is key, only changes are recorded and it doesn’t duplicate files that haven’t changed.

In practice I run a duplicity backup every time I perform a database backup. This allows me to restore static files along the database.

Selecting a backup date in Deja Dup
Selecting a specific date to restore from my backups.
Restoring files in Deja Dup
Restoring this website’s wp-content folder to my desktop
Thunar file manager
My wp-content folder restored to my desktop

Duplicity would have been perfect for restoring that plugin I deleted six months ago ::smh::

Joseph Dickson – a month ago

Why I Love Duplicity

A few months back I had deleted a WordCamp slide presentation that accompanied my session on WP_Query. I didn’t have this workflow in place and it would have saved me a lot of time. I could have simply restored the missing files along with the database to my local testing server.

As duplicity’s archive grows I will probably prune it along with my webhost’s log files to keep my Ubuntu droplet nice an lean.

Over the next few months I may even go as far to run a cron job that updates the duplicity backup and the WordPress database so all I need to do is log in to download them. πŸ˜‰

Offline and Duplicate Backups

Below is an example of an local archive I earlier today which includes the duplicity backup, MySQL database, wp-config.php and .htaccess that can be used to clone or restore my website at another location. πŸ˜€

Most importantly I can store this on my desktop where I run daily backups and copy it to a USB flash drive in the event my webhost, computer crash on the same day I’ll still have a third offline backup.

Why Backup Manually?

I wanted to take a more personal and intentional approach to backing up this website and canceled my Jetpack account a few months ago which provided flawless daily backups and restoration via VaultPress.

Jetpack has a lot of features I really didn’t use or appreciate so taking on the challenge of keeping my own local archive of my website seemed like a good idea. I now backup my website’s backups along with my desktop and laptop πŸ™‚

8-bit icon of Joseph Dicksonlinuxbookpro.com

Joseph Dickson is a WordPress Developer in Los Angeles CA.

HomepagePermalink
Categories
WordPress

Break stuff, but don’t forget to have backups

Hole
Pixabay

I’m one of those WordPress guys who rant about keeping regular backups. Even using a fantastic plug-in that automatically runs a backup every weekend. Everything was running great and I had months of backups safely stored on my web server.

Until today, I decided try and install Certbot without testing it on a non-production server first.

Everything seemed to work perfectly. Until I rebooted my server droplet and it was serving up my index.php template as straight code. Certbot and My Digital Ocean WordPress droplet had a conflict, likely I made a mistake.

As best as I could tell Certbot expected Apache to be configured a particular way; perhaps it the droplet’s customizations were at odds. Either way I no longer had access to my droplet via ssh, sshfs, or ftp to download my server side backups. To make things worse I didn’t store any backups locally or on another server.

This could have been easily avoided

  1. Digital Ocean offers snapshots and backups that can be manually deployed at any time. I didn’t bother to create one.
  2. I had months of weekly backups. I didn’t bother to take a few minutes to download one.
  3. My backup plug-in, online communities and my own rants about keeping multiple backups were not heeded.

It’s not all bad – This blog is where I test ideas and break stuff

Of all the posts only three or four contained useful content. The rest was old posts imported from social media and a few bits of custom wallpaper. Nothing was irreplaceable or important.

Feel free to break stuff in production, just don’t forget the backups.

WordPress Codex Resources:

8-bit icon of Joseph Dicksonlinuxbookpro.com

Joseph Dickson is a WordPress Developer in Los Angeles CA.

HomepagePermalink