Chapter 10. Backing up Docserv² data

Table of Contents

Maintaining, backing up, and restoring configuration files
Backing up the metadata store
Backing up Docserv² content

Docserv² itself has no built-in backup functionality. Neither for the configuration nor for its configuration or its document metadata store.

You need make sure to back up all relevant data yourself.

Maintaining, backing up, and restoring configuration files

To maintain and back up configuration, create a Git repository at /etc/docserv/. To do so, run git -C /etc/docserv/ init. Then add, commit, and push all content as desired.

To restore configuration, use Git commands. You do not need to exit or restart Docserv² to apply most configuration, as it is re-evaluated upon every build instruction. The exception to this is restoring site configuration: In this case, make sure to exit Docserv² and restart after having restored it.

Backing up the metadata store

The metadata store contains metadata extracted from documents, such as document titles and subtitles. If it is deleted, all metadata will have to be created anew. This means, all docsets of the site have to be rebuilt which can take a substantial amount of time. If you do not do so, navigational pages will lose links to most content after the immediate next build.

To maintain and back up the metadata store, create a Git repository at /var/cache/docserv/. To do so, run git -C /var/cache/docserv/ init. Create a .gitignore file that ignores .json files on the top level of the repository to avoid backing up build queue files. Then add, commit, and push all content as desired.

It usually makes sense to create a cronjob or similar that automatically adds/commits/pushes all changes on a regular basis.

Backing up Docserv² content

Docserv² content is stored in the directory configured as the backup_dir in the site configuration for each target. This directory can be compressed (for example with: tar -cvf "[BACKUP_FILE].tar" -C "[BACKUP_DIR_FOR_TARGET]" .). Finally, upload or copy the backup.

To restore content, exit Docserv², temporarily rename the backup_dir. Then extract the content of the backup to backup_dir.