Tuesday, March 24, 2009

Backing up Joomla

Backup with Joomlapack

We now have the joomlapack extension installed and want to see about backing up. We select components, joomlapack which displays the control panel for the extension. Only problem is we have a warning message:

JoomlaPack is ready to backup your site, but there are potential issues

This does not appear fatal but what are the 'issues'? We look under status and see:

Default output directory in use

Since this is a hyperlink we click on the error message and it takes us to http://www.joomlapack.net/help-support-documentation/warnings/q203.html which explains:
You got to this page because JoomlaPack detected that you are using the default backup output and / or temporary directories. This page will inform you on the potential pitfalls and security concerns of the default configuration, as well as how to secure your installation.
Sweet. Nice that error messages have explanations.
The temporary directory files holds database dumps (.sql files), while the database dump step is running. They are deleted upon proceeding to the next step, if the process ends with catchable errors or when a new backup is started (if the previous backp attempt failed). If the backup fails with a PHP fatal error, these files remain in place.
Ok - so we need to change the default. JoomlaPack uses the temporary directory specified in \xampp\htdocs\joomla\configuration.php so we take a look. About the only thing like a temp directory is :

var $tmp_path = 'F:\\xampp\\htdocs\\joomla\\tmp';

There is no temp_dir variable in the file. Taking a look at the joomlapack default output directory in the configuration tab we see:

F:\xampp\htdocs\joomla\administrator\components\com_joomlapack\backup

So do we create one and set it to another folder? It would see desirable to store the site backups in a folder outside of the web root (htdocs) tree. We create a backup folder in the xampp directory. There may be some things we need to do to make this writable and accessble from Joomla but let's try it out. We set the Output Directory to:

F:\xampp\backup

One more drive letter to change when the USB Stick moves to another computer. It would be very useful to be able to specify relative paths instead of drive letters. Reading further along we see the main issue behind changing the default backup directory is one of security.

The other issue listed under the Status Details is that zip file format is selected which is the default. Clicking the link reveals the issues with .ZIP:
  • It is very disk and database intensive; on some overloaded hosts the process might fail during the archiving stage

  • A ZIP file consists of two parts: the actual file data and the Central Directory, an appendix to the archive with a list of the included files. For efficiency reasons the Central Directory is written on a separate file and the two files are "glued" together at the end of the process. On sites with a great number of files, this might cause the process to fail.

  • There are several limitation concerning the calculation of CRC checksums, a necessary step to creating ZIP archives. JoomlaPack can detect most of them and warn you, as failure to calculate correct CRC's will result in non-conforming archives requiring several workarounds to extract them. Moreover, even on newer systems, the calculation of a large file's CRC might cause the process to fail with a timeout.

Ok so we also need to change the default format of the backup to use .JPA which is the optimized joomlapack archive format. Makes you wonder why the default is set to .ZIP

We click the Configuration icon and expand the Profile Settings, Advanced and set the Archiver Engine to JPA JoomlaPack Archive.

Click SAVE. We get the green go-ahead message:

JoomlaPack is ready to backup your site

Ok, let's start the backup and go for an orange.

We're back and SUCCESS!. Backup up successfully and created a log file. We take a peek and it offers us the chance to download the log which we do as joomlapack debug log.txt and it has the right output directories. In \xampp\backup are two files, the joomlapack debug log.txt file and site-localhost-20090324-141353.jpa which is the backup.

Of course the only real test of a backup is a restore. The best test would be to restore on a clean install of joomla. The problem is - we did a clean install of joomla to solve the extensions problem so there is nothing really worth restoring. But this will be useful as students can create joomla sites and submit the backups which i then restore on a clean install to check their designs.

2 comments: