Backing up and Restoring GeoNode

In order to completely backup a GeoNode installation requries that each separate component of GeoNode be tackled separately. There are separate backup files for Geonode/Django, GeoNetwork, and GeoServer.

Creating a backup

  1. Make a backup of the GeoNode database (PostgreSQL needs to be running):

    sudo -u postgres -i pg_dump -c -Fc geonode > geonodedb.backup
    
  2. Stop all services:

    sudo /etc/init.d/apache2 stop
    sudo /etc/init.d/tomcat6 stop
    sudo /etc/init.d/postgresql-8.4 stop
    
  3. Backup Geonode config & GeoServer data directory:

    tar -cvzf geonodeConfigBackup.tgz /etc/geonode
    tar -cvzf geonodeDataBackup.tgz  /var/lib/geoserver/geonode-data/
    
  4. In addition, any templates, design changes, and/or CSS files will also need to be captured.

  5. Restart all services:

    sudo /etc/init.d/apache2 start
    sudo /etc/init.d/tomcat6 start
    sudo /etc/init.d/postgresql-8.4 start
    

Restoring a backup

  1. First stop all services:

    sudo /etc/init.d/apache2 stop
    sudo /etc/init.d/tomcat6 stop
    sudo /etc/init.d/postgresql-8.4 stop
    
  2. Restore Geonode config & GeoServer data directory:

    sudo tar -C / -xvzf geonodeConfigBackup.tgz
    sudo tar -C / -xvzf geonodeDataBackup.tgz
    
  3. In addition, any templates, design changes, and/or CSS files will need to be restored.

  4. Make a backup of the GeoNode database (PostgreSQL needs to be running):

    sudo /etc/init.d/postgresql-8.4 start
    sudo -u postgres -i "psql -c 'drop database geonode;'"
    sudo -u postgres -i "psql -c 'create database geonode;'"
    sudo -u postgres -s "pg_restore -Fc -d geonode /path/to/geonodedb.backup"
    
  5. Start all services:

    sudo /etc/init.d/apache2 start
    sudo /etc/init.d/tomcat6 start
    
  6. Restore GeoNetwork data with:

    geonode updatelayers
    

Notes

This approach works between machines with the same version of Linux and Geonode, and may not work between different versions of Linux, PostgreSQL, and PostGIS.