Backing Up (And Restoring) a Plone Instance

Backing up (and restoring) a Plone instance

The only directory that normally contains variable data is the var/ directory (data, logfiles). parts/* will be re-generated, for instance.

And even simpler, normally you only need to backup the var/filestorage/Data.fs file: that one contains your "ZODB" database with all your plone data. If you have a brand new plone, there also might be a var/blobstorage/ directory for storing big files (pdf, mp3, etc): back that one up as well.

Restoring in a new instance just means copying the Data.fs (and possibly the blobstorage files). It doesn't matter if the instance is newer or on the server or so. I regularly copy my server's Data.fs to my local harddisk for easier testing.

Two big warnings:

  • If I say "just back up the Data.fs file", I'm assuming you can rebuild your instance, especially that you can get hold of any add-on products you installed. Basically: use that buildout.cfg (assuming a recent plone version) and back that one config file up as well.

  • "Copying Data.fs": better use the bin/repozo script to make your backups. That one can handle incremental backups (should you wish) and it can safely backup your Data.fs while your plone site is running. The most comfortable is to add collective.recipe.backup to your buildout, that gives you a bin/backup script with all the necessary options filled in.

See also http://plone.org/documentation/faq/plone-backup-move

How to restore Plone 3?

Was your previous Plone 3.x version 3.2 or later? If so, both old and new use buildout for configuration management. If so, the general plan is:

1) Copy the eggs, develop, zcml and versions directives from old to new. Copy the src and products directory from old to new.

2) Run buildout. Resolve problems that occur.

3) Start your new Plone and see if it functions. Resolve problems.

4) Stop you new Plone and restore the Data.fs file from the old system to overwrite the new Data.fs (under var/). Resolve problems.

The "resolve problems" notes may be insignificant or non-existent if old and new versions are the same. If they aren't, you may need to update some add on package version.

If you're updating from < 3.2, see the guide for updating from non-buildout systems.

Plone data migration to another instance on Windows 7

When you want to move a complete instance, you need to copy over the same data as you would back up.

That means you'll need to copy over:

  1. The Data.fs object storage file
  2. The blobstorage directory
  3. All your customizations and installed packages, beyond Plone.

See the Plone FAQ and Backing up (and restoring) a Plone instance.

How do I restore a zope database from a .fsz file?

The command looks fine at first glance, so perhaps something else is wrong. You did stop the zope instance first, and if this is a zeo setup you did stop the zeo server first?

If you have the .fsz file, then you can also use standard unzipping tools. The .fsz file is simple a gzipped file. It may help to rename it to .fs.gz, otherwise some tools will refuse to work as the file does not have the expected extension.

I like to do it like this:

gzcat mybackup.fsz > var/filestorage/Data.fs

or similarly:

cat mybackup.fsz | gunzip > var/filestorage/Data.fs

Backing up and Restoring Jenkins configuration and Logs

You can just copy the files on JENKINS_HOME or for a better approach you can use

thinBackup

With thinBackup you can easily make the backup and restore.

Is it possible to recover deleted folder in plone 4.1?

If you haven't yet packed away the transaction that deleted the folder, you can recover the folder.

First, use the "Undo" tab on the parent folder, in the ZMI. It could that doesn't work, too many other things on the system have changed (usually the catalog), for all the changes to be rolled back effectively.

Next step is a little more cumbersome and involved. What you then have to do is open the Object Database (ZODB) with a wrapper that will show you the state of the database at a given point in history. Doing this requires some manual editing of your Zope server configuration. I've written up the steps in a blog post but those steps are a little outdated.

In a modern Plone buildout, you need to add the zc.beforestorage egg to your buildout, and you need to switch the enable-product-installation setting of Zope to False; using the beforestorage wrapper makes your database read-only and the product installation code would try to commit to database, resulting in a failure to start:

[instance]
eggs +=
zc.beforestorage
zope-conf-additional +=
enable-product-installation False

After rebuilding the buildout, you need to open the zope.conf file associated with your instance. If you normally start your server with bin/instance, then that file is located in parts/instance/etc/zope.conf; the script in bin/ used matches the part name (instance in this example).

Locate the part where it defines the ZODB main database:

<zodb_db main>
# Main database
cache-size 10000

# Blob-enabled FileStorage database
<blobstorage>
blob-dir /path/to/var/blobstorage
<filestorage>
path /path/to/var/filestorage/Data.fs
</filestorage>
</blobstorage>
mount-point /
</zodb_db>

You need to add the beforestorage wrapper into that declaration:

<zodb_db main>
# Main database
cache-size 10000

%import zc.beforestorage
<before>
before 2012-12-01T12:00:00

# Blob-enabled FileStorage database
<blobstorage>
blob-dir /path/to/var/blobstorage
<filestorage>
path /path/to/var/filestorage/Data.fs
</filestorage>
</blobstorage>

</before>

mount-point /
</zodb_db>

Note the before <iso timestamp> line in there; when you start your instance, the site will be presented as it was at that timestamp. Choose one close to when you deleted the folder. Now you can export it (again using the ZMI) to a .zexp file. Undo the changes to your zope.conf file, restart, and import the recovered folder.

How to move a plone install on the file system

It currently thinks your python is at:

/home/atf/Plone-3.3.6/Python-2.4/bin/python

Just re-run bootstrap with the new python:

/path/to/where/python/is/now bootstrap.py

Then

./bin/buildout

plone change in code not visible in development site

Make sure you start your Zope server with bin/instance fg, most likely the name of the script if you used the Plone universal installer buildout.

To see changes in python code you'll either need to restart the server (CTRL-C then start again) or use something like plone.reload to request a reload of changed code.

When starting your server with the fg command, it is automatically running in debug mode and any templates, resources and skin items are reloaded automatically. Start the server with console or start and it'll run in production mode and templates and such are loaded from disk only once.

See the Plone.org documentation on buildout for more information.

The bin/instance command has a built-in help command, try:

bin/instance help

for a list of supported commands or run:

bin/instance help console

to get help on a specific command; the above example will print the help on the console command.



Related Topics



Leave a reply



Submit