• how to restore an openplans project from a zodb backup

last modified July 21, 2008 by rmarianski

Summary 

If a project accidentaly loses data or otherwise needs to be restored from backup, currently (2008/07/21) your best bet is to restore from an earlier date.

Audience Assumptions

This HOWTO assumes you can get around in the Zope Management Interface (ZMI), and that you know what server and port the production and dev instances of the relevant site are running on.  We also assume you know how to use repozo to create and restore ZODB backups. It also assumes you're using a filesystem layout like we use at TOPP with our fassembler build tools, and that your opencore instance is named "openplans".

If you're not working at TOPP, adjust the filesystem and ZMI paths to reflect your deployment conventions.

Limitations and Caveats

This procedure will only include data as recent as your most recent ZODB backup. You are doing those regularly, right? ;-)

This procedure will recover the project preferences, team members, mailing lists, and wiki pages. 

Historical revisions of wiki pages will be lost.  You will only have the most recent version of each page.

I think wordpress content and tasktracker tasks should be safe but I'm not sure - have not tested this with a project that has either of those.


Instructions

 

  1. On the production server, you may wish to make a ZODB backup before you start working. You also may wish to make an export of the project's data:
    1. On the production server, point your browser at the ZMI (usually running at base_port +1), at the path /openplans/projects/manage_main
    2. Select your project name and click "Import/Export"
    3. I recommend checking the "Save to file on server" option
    4. click "Export"
    5. put the .zexp file wherever you normally keep backups, and give it a descriptive name with a date
  2. On flow or another dev server, restore a ZODB backup from the day before the problem. Use stage.openplans.org  or dev.openplans.org  for this work, whichever is not otherwise in use.  Be sure the server is running a compatible version of the software, ideally the exact same versions as the production server.
  3. On the dev server, point your browser at the ZMI (usually running at base_port +1), at the path  /openplans/projects/manage_main
    1. Select the project and click the "import/export" button
    2. check "Save to file on server" and click Export. This may take a while if the project has a lot of content.
    3. Note the path to the exported file on the filesystem.
    4. On the dev server filesystem, the exported file will be named like <project name>.zexp.  Rename it to <project name>-project.zexp
  4. On the dev server, point your browser at the ZMI at the path /openplans/portal_teams/manage_main
    1. Select the team with the same name as the project and click the "import/export" button
    2. check "Save to file on server" and click Export. This should be fairly quick.
    3. Note the path to the exported file on the filesystem.
    4. On the dev server filesystem, the exported file will be named like <project name>.zexp.  Rename it to <project name>-team.zexp
  5. Copy the .zexp files to the production server, using eg. rsync or scp.
  6. On the production server, put the .zexp files in /usr/local/topp/<site name>/current/opencore/zope/import/
  7. On the production server, point your browser at the ZMI at the path /openplans/projects/manage_main
    1. Select the project and click "Delete". This may take a few minutes. ­
    2. Click the "Import/Export" button
    3. Select <project name>-project.zexp from the dropdown list and click "Import". This may take a few minutes.
  8. On the production server, point your browser at the ZMI at the path /openplans/portal_teams/manage_main
    1. Click the "Import/Export" button
    2. Select <project name>-team.zexp from the dropdown list and click "Import". This should be quick.
  9. Check the live site to make sure your imported project works as expected.