Back up & export

As a component in a digital preservation ecosystem, Pocket Archive allows for planning an exit strategy to migrate to other platforms, and to back up the whole archive for additional resilience. These tools are available via the command line interface.

Back up and restore

A full system backup can be created with

pkar backup PATH

A directory will be created under PATH (which must be a folder) containing all the necessary parts to rebuild the archive from scratch. Regardless of whether those parts were in the filesystem, they will be gathered under the same backup folder, which will contain:

  • Data files (ORes) in their original layout;
  • DRes database;
  • Configuration directory;
  • Custom presentation templates (if present);
  • A manifest file containing all the instructions required to restore the archive from that backup;
  • A self-start configuration directory for running the backed up archive directly.

The command invocation returns a report, in JSON format, summarizing the operation. While this is not a critical element, the manifest file is. The manifest is used by the restore process to place all the components back to their place.

Self-start

As a convenient option, the backup archive can be run as an independent Pocket Archive instance directly, without moving its files. All is required to do is running Pocket Archive (invoking the command line, starting the admin server or the watchdog, etc.) by setting the PKAR_CONFIG_DIR environment variable to the self-start directory, whose full path is indicated in the report, named selfstart_config inside the backup archive.

The self-start configuration is a copy of the original configuration with some of its path references modified so that they point to the backup files. This directory will not be involved in the restoring process.

Restoring a backup

The inverse operation of a backup is a restore. It is invoked on the command line with

pkar restore MANIFEST

This operation will destroy all data in the folders designated as destinations of the restore operation, and rebuild the archive from the backup there. The PKAR_CONFIG_DIR, normally dictating which configuration and which data files to use, has no effect here. It is advisable (as the message in the confirmation prompt remind) to inspect the paths in the manifest file before proceeding.

Export

While a backup is meant to be used exclusively with Pocket Archive and maintains all data and metadata in Pocket Archive's own format, a separate export function allows to generate data in a standard format readable by other applications, which can be used to migrate away from the current platform, or to integrate with external data repositories.

The export command syntax is very simple:

pkar export [PATH]

PATH is an optional file path to write the data to. If omitted, the data are sent to standard output.

The export is created in the TriG format, a common serialization of RDF supported by many systems that handle Linked Data.

Note that this is only a metadata export, which contains all metadata and includes the archival path of each file resource, relative to the DRes root folder. This allows to reconnect each file with its metadata.

Since this export method is meant to be used with foreign systems that don't understand Pocket Archive's internals, the software just provides the necessary information to rebuild the complete semantic corpus. Development of custom scripts tailored to the external system may be required to automate this process.