Discussing ProcessWire CMS Infrastructure And Configurations

Episode 5 - ProcessWire Modules: Database Backups and Cronjob Database Backup

Podcast Show Transcipt: PDF Version

Transcript

Episode 5 - ProcessWire Modules: Database Backups and Cronjob Database Backup

Hello, this is Charles Stevens, the Editor of the PW Review.

We will talk about setting up a reliable and maintainable backup strategy. What I look for in a backup solution is a sound backup process that can be automated. My goal is to ensure that all changes or modifications made on a website are preserved. This goes for user-level content modifications, as well as Administrator made updates or changes.

In this episode, we will take a look at two Non-Commercial ProcessWire modules, Database Backups and Cronjob Database Backup. These two modules are the tools that I utilize on all of my ProcessWire installations to satisfy my backup requirements.

Let’s talk about the Database Backups module first. This module was created by Ryan Cramer, Lead Developer and Creator of ProcessWire.

Database Backups provides a reliable means to backup your ProcessWire installation.

Database Backups requires that you are running ProcessWire 3.0.62 or higher. This module was added to the Modules Directory in September 2014. It was last updated in December 2017. The current version number is 0.0.4

Database Backups adds an entry to the Admin Setup Menu called DB-Backups.

When you are within the Admin screen of Database Backups, you will see a table with the following columns:

- File: Shows the name of the MySQL Database file.
- Date: Shows the date that the backup was generated.
- Table: Shows the number of tables to be backed up.
- Rows: The number of rows being backed up.
- Size: Shows the size of the MySQL Database being backed up.
- Actions: There are 4 icons that you can choose from:
- First Icon: You can choose to download the MySQL file, with the .sql file extension.
- Second Icon: You can choose to download the MySQL File, as a .zip file.
- Third Icon: Clicking on that button will start a restore. If you are doing a large restore, you would most likely have downloaded the MySQL file and used phpMyAdmin to do the actual restore.
- Fourth Icon: Clicking on this icon will delete the named backup from your installation.

There are two buttons on the Admin screen, at the top and bottom of the provided table.

The first button, Upload allows you to upload a MySQL database file to the Database Backups module.

The second button, Backup will start an individual backup of your website. If you chose that one, it would prompt you to name the backup MySQL file and right here you could provide a description of the backup.

The option of “Backup All Tables” is already checked. If you decide to uncheck that option, you will be able to select and choose which Data Tables that you want to backup individually.

You should find Database Backups a very useful module that will provide you with basic backup capabilities.

Let’s now talk about the Cronjob Database Backup module. This module was created by K-I-X-E (Christoph Thelen, I seriously hope that I pronounced your name correctly).

Cronjob Database Backup requires ProcessWire Version 2.4.15 or later.
This module was added to the Modules Directory in November 2014. It was last updated in November 2016. The current version number is 1.1.5

This module has a requirement that the LazyCron core module is installed on your website.

The Cronjob Database Backup module provides you with the capability to automate your backups. You can select a time interval or backups can be triggered by logouts to your website.

The standard time intervals are:

- Never
- 1 hour
- 6 hours
- 1 day
- 2 days
- 1 week
- 2 weeks
- 4 weeks (which is the installed default)
- Logout Trigger

On all of the websites that I manage, I have the interval set to every 6 hours.

You can state the max backups that you want to retain. The minimum is 1 and the maximum that can be set is 100 backups. This is based on what is defined by the constant MAXFILES. I set all of my installations to 10 max backups.

There is an option to remove backups older than the following:

- Never
- 1 day
- 1 week
- 1 month
- 1 year

I set all my installations to 1 month.

You can configure what the backup MySQL file name will be. I normally give it the name of the domain with a dash (-) character after. If you don’t specify a name, the module has a set pattern that will be applied to name the backup. Normally that will be the name of the MySQL database. A .sql file extension is added to the file.

You can configure a custom backup file info string. I normally leave this blank.

You can configure a custom storage path for the backups. I leave this at the default which is /site/assets/backup/database/.

The “Backup All” option is checked by default. If you uncheck this option, you can pick which Data Tables you want to backup. I normally leave this option checked.

The last option that you are able to configure is “Burn Backups Now”. If you select this option, you can specify the number of backups to remain in the storage directory.

There is an “Edit Backups” button that when clicked, will allow you to edit the backups listed in Ryan Cramer’s Database Backups module.

Cronjob Database Backup, to me, is a great time-saver and ensures that you have multiple point-in-time backups.

While these two modules are great assets to have, I still routinely do other things to ensure that I am able to restore a ProcessWire website to a particular point-in-time.

On a routine set schedule, I will use phpMyAdmin to backup a website MySQL database. I will use Transmit (which is a Mac file transfer client program) to download a copy of the /Site ProcessWire folder in it’s entirety. All of this data is then downloaded to secure online and offline resources, for safekeeping purposes.

Backing up your website is something you should never leave to chance. You would be surprised how helpful things are when you really need to restore an installation whenever something goes wrong.

The 2 modules, Database Backups and Cronjob Database Backup are useful tools that are beneficial and worth taking the time to install and configure on your website.

That’s all for now.

Thank you for listening to this PW Review Podcast.