|
| 1 | +--- |
| 2 | +myst: |
| 3 | + html_meta: |
| 4 | + "description": "How to Back up and restore a Plone site that was installed using buildout" |
| 5 | + "property=og:description": "How to Back up and restore a Plone site that was installed using buildout" |
| 6 | + "property=og:title": "Back up and restore a Plone site" |
| 7 | + "keywords": "Plone 6, admin, install, configuration, upgrade, buildout" |
| 8 | +--- |
| 9 | + |
| 10 | +(back-up-and-restore-a-plone-buildout-label)= |
| 11 | + |
| 12 | +# Back up and restore a Plone buildout |
| 13 | + |
| 14 | +This chapter explains how to back up and restore a Plone site that was installed using buildout. |
| 15 | + |
| 16 | +(backup-your-plone-site-label)= |
| 17 | + |
| 18 | +## Back up your Plone site |
| 19 | + |
| 20 | +```{danger} |
| 21 | +Always back up your Plone site before upgrading. |
| 22 | +``` |
| 23 | + |
| 24 | +This back up guide assumes the following. |
| 25 | + |
| 26 | +- You back up your Plone site. |
| 27 | +- You back up your buildout and its caches. |
| 28 | +- You back up your persistent data storage using a strategy that maintains data integrity without taking down your Plone site, that is performed periodically with adequate frequency, and that stores sufficient versions of your data. |
| 29 | +- You've tested the restore process. |
| 30 | + |
| 31 | + |
| 32 | +### Where's my data? |
| 33 | + |
| 34 | +Your Plone instance installation contains a directory {file}`./var`. |
| 35 | +This directory is located in the same directory as the file {file}`buildout.cfg`. |
| 36 | +It holds the frequently changing data files for the instance. |
| 37 | +{file}`./var` contains the instance's log, process ID, and socket files. |
| 38 | + |
| 39 | +The following directories contain your instance's content. |
| 40 | + |
| 41 | + |
| 42 | +#### {file}`./var/filestorage` |
| 43 | + |
| 44 | +The Zope Object Database ({term}`ZODB`) file storage is maintained in the directory {file}`./var/filestorage`. |
| 45 | +The default file name is {file}`Data.fs`, although you could have multiple files or renamed it. |
| 46 | +It's typically a large file which contains everything except {term}`blob`s. |
| 47 | + |
| 48 | +The other files in this directory with the file extensions of `.index`, `.lock`, `.old`, or `.tmp` are ephemeral, and will be recreated by Zope if they're absent. |
| 49 | + |
| 50 | + |
| 51 | +#### {file}`./var/blobstorage` |
| 52 | + |
| 53 | +The directory {file}`./var/blobstorage` contains a deeply nested directory hierarchy that contains the blobs of your database. |
| 54 | +These files may include PDFs, images, videos, office automation files, and other binary objects. |
| 55 | + |
| 56 | +`filestorage` and `blobstorage` are maintained synchronously. |
| 57 | +`filestorage` has references to blobs in `blobstorage`. |
| 58 | +If the two storages are not synchronized, you'll get errors whenever their data is accessed. |
| 59 | + |
| 60 | + |
| 61 | +### `collective.recipe.backup` |
| 62 | + |
| 63 | +[`collective.recipe.backup`](https://pypi.org/project/collective.recipe.backup/) is a well-maintained buildout recipe that maintains data integrity for a live Plone database. |
| 64 | + |
| 65 | +See its `README.md`'s section [Introduction](https://github.com/collective/collective.recipe.backup?tab=readme-ov-file#introduction) for its buildout recipe configuration. |
| 66 | + |
| 67 | +The recipe supports several options, all of which are documented its `README.md`'s section [Supported options](https://github.com/collective/collective.recipe.backup/blob/master/README.rst#supported-options). |
| 68 | + |
| 69 | +Perhaps the most useful option is `location`, which sets the destination for backup files. |
| 70 | +Its default value is `var/backups`, inside the buildout directory. |
| 71 | +The backup destination, may be any attached location, including another partition, drive, or network storage. |
| 72 | + |
| 73 | + |
| 74 | +#### Operation |
| 75 | + |
| 76 | +After running buildout to configure `collective.recipe.backup`, you'll find {file}`bin/backup` and {file}`bin/restore` scripts in your buildout directory. |
| 77 | +Since all options are set via buildout, there are few command-line options, and operation is generally through bare commands. |
| 78 | + |
| 79 | +{file}`bin/restore` will accept a date-time argument, if you keep multiple backups. |
| 80 | +For restore operations, stop Plone before starting your restore, and restart after the restore is complete. |
| 81 | + |
| 82 | +{file}`bin/backup` is commonly included in a cron table for regular operation. |
| 83 | +You can run backup operations without stopping Plone. |
| 84 | +Make sure you test your backup and restore process before you need it. |
| 85 | + |
| 86 | + |
| 87 | +### Incremental backups |
| 88 | + |
| 89 | +`collective.recipe.backup` offers both incremental and full backups, and will maintain multiple versions of backups. |
| 90 | +Tune these to meet your needs. |
| 91 | + |
| 92 | +When you enable incremental backups, the database packing operation will automatically cause the next backup to be a full backup. |
| 93 | + |
| 94 | +If your backup continuity need is critical, then your incremental backup schedule may need to be frequent. |
| 95 | +Some Plone sites require incremental backups every few minutes. |
0 commit comments