Difference between revisions of "Backup of geonode"

From stgo
Jump to: navigation, search
m (Backup DB)
m (Restore GeoNode Server)
Line 43: Line 43:
 
# stop all services: apache2, tomcat7, psql
 
# stop all services: apache2, tomcat7, psql
 
# restore GeoNode config and GeoServer  
 
# restore GeoNode config and GeoServer  
#* <code>sudo tar -C / -xvzf /home/ssteinig/geonodeConfigBackup.tgz</code><br/> Note this step above may actually best to '''not do''' this step, but to manually edit ''local_settings.py''. The logo image that is currently in that archive is also not super important and gets placed in it position when I restore from ''geonodeWWWBackup.tgz'' that contains ''/var/www/geonode''.  
+
#* <code>sudo tar -C / -xvzf /home/ssteinig/geonodeConfigBackup.tgz</code><br/> Note it may actually best to '''not do''' this step, but to manually edit ''local_settings.py''. The logo image that is currently in that archive is also not super important and gets placed in it position when I restore from ''geonodeWWWBackup.tgz'' that contains ''/var/www/geonode''.  
 
#* <code>sudo tar -C / -xvzf /home/ssteinig/geonodeDataBackup.tgz</code> <br/>This step may also '''not''' be very '''useful''', as the file does not contain any data since the folder ''/var/lib/geoserver/geonode-data/'' is empty. However, GeoServer data seems to be  ''/usr/share/geoserver/data/'' instead)
 
#* <code>sudo tar -C / -xvzf /home/ssteinig/geonodeDataBackup.tgz</code> <br/>This step may also '''not''' be very '''useful''', as the file does not contain any data since the folder ''/var/lib/geoserver/geonode-data/'' is empty. However, GeoServer data seems to be  ''/usr/share/geoserver/data/'' instead)
 
#* when moving to a different server, I did re-run now:
 
#* when moving to a different server, I did re-run now:

Revision as of 15:13, 12 February 2014

>> return to Cedeus IDE


Below I describe the backup procedure taken from: http://docs.geonode.org/en/latest/deploy/backup.html

For migrating from one GeoNode version to another, in particular 1.2 to 2.0 check this document: http://docs.geonode.org/en/latest/tutorials/admin/migrate/index.html#migrate

For moving to another server, the general advise is:

  • backup GeoNode - Django project + DB, backup GeoServer (DataDirectory)
  • update/upgrade the current server to the latest version
  • create a new server + move all the project files
  • see this link for a GeoNode style template: http://github.com/GeoNode/geonode-project


Backup GeoNode Server (with GeoNode 2.0c8):

  1. Backup Geonode users DB (psql needs to be running)
    • sudo -u postgres -i pg_dump -c -Fc geonode > /home/ssteinig/geonodedb.backup
  2. Stop services
    • sudo service apache2 stop
    • sudo service tomcat7 stop
    • sudo postgresql-8.4 stop o: sudo service postgresql stop
      (I am actually running PSQL 9.1.11 on cedeusgis1)
  3. Backup Geonode config & GeoServer data directory:
    • sudo tar -cvzf /home/ssteinig/geonodeConfigBackup.tgz /etc/geonode
      Note, doing this step for backup is good, but when archiving for moving to a different server, it is better to edit the important local_settings.py file manually.
    • sudo tar -cvzf /home/ssteinig/geonodeDataBackup.tgz /var/lib/geoserver/geonode-data/
      Note, this step my not be very useful as the GeoServer data seems to be in a different folder (see next step). Hence, geonodeDataBackup.tgz may be empty and...
    • it looks like GeoServer data are here: /usr/share/geoserver/data/ . So we shall make a backup of it too:
      • sudo tar -cvzf /home/ssteinig/geoserverDataBackup.tgz /usr/share/geoserver/data/
  4. In addition, any templates, design changes, uploaded documents, and CSS files will also need to be captured.
    • e.g. my modified css and logo have been in /etc/geonode/media/geonode/img/ ... so they should be backed-up within the config tgz file.
    • but my text modifications to the start pages (i18n strings) are in a different location (...but see as well below where I save the whole Django GeoNode package)
      • sudo tar -cvzf /home/ssteinig/geonodei18nBackup.tgz /usr/local/lib/python2.7/dist-packages/geonode/locale/
    • just to be save I may also do a backup of the GeoNode web folder where I have the CSS, the thumbnails, and uploaded documents (pdf + xls +doc, etc):
      • sudo tar -cvzf /home/ssteinig/geonodeWWWBackup.tgz /var/www/geonode/
    • and a copy of the Django GeoNode folder and the egg-info folder that I needed later:
      • sudo tar -cvzf /home/ssteinig/geonodePyDjangoBackup.tgz /usr/local/lib/python2.7/dist-packages/geonode/
      • sudo tar -cvzf /home/ssteinig/geonodePyDjangoEggBackup.tgz /usr/local/lib/python2.7/dist-packages/GeoNode-2.0-py2.7.egg-info/
  5. re-start the previously stopped services: Apache2, Tomcat7, PSQL

Backup Spatial Data DB

ToDo

Restore GeoNode Server

copied text - not tested yet

  1. stop all services: apache2, tomcat7, psql
  2. restore GeoNode config and GeoServer
    • sudo tar -C / -xvzf /home/ssteinig/geonodeConfigBackup.tgz
      Note it may actually best to not do this step, but to manually edit local_settings.py. The logo image that is currently in that archive is also not super important and gets placed in it position when I restore from geonodeWWWBackup.tgz that contains /var/www/geonode.
    • sudo tar -C / -xvzf /home/ssteinig/geonodeDataBackup.tgz
      This step may also not be very useful, as the file does not contain any data since the folder /var/lib/geoserver/geonode-data/ is empty. However, GeoServer data seems to be /usr/share/geoserver/data/ instead)
    • when moving to a different server, I did re-run now:
      • sudo geonode-updateip 10.0.2.15 to get the same db settings
      • modify the file local_settings.py
        • change the geonode db password to the one from the new machine
        • set the Allowed_Hosts variable to "*"
      • sudo geonode collectstatic -v0 to copy the styles/logo into /var/www/geonode/static/geonode
  3. restore the template and design files
    • restore the static web page part
      • sudo tar -C / -xvzf /home/ssteinig/geonodeWWWBackup.tgz
    • when moving to another server with a different GeoNoder version (2.0 final instead of 2.0c8), then I got a DB error, ala: "DatabaseError at / [...] <column base_resourcebase.license_id does not exist [...] LINE 1: ...ype_id", "base_resourcebase"."constraints_other", "base_reso... " with the location /usr/local/lib/python2.7/dist-packages/geonode/search/views.py in search_api, line 160
    • hence, I deleted the django folders of GeoNode 2.0 final:
      • /usr/local/lib/python2.7/dist-packages/geonode/ and
      • sudo rm /usr/local/lib/python2.7/dist-packages/GeoNode-2.0.egg-info/
    • and restored the whole django-geonode package backup-ed from 2.0c8 before using
      • sudo tar -C / -xvzf /home/ssteinig/geonodePyDjangoBackup.tgz
      • sudo tar -C / -xvzf /home/ssteinig/geonodePyDjangoEggBackup.tgz
      • This will also restore my i18n strings, i.e. the text on the GeoNode startpage.
  4. Restore the GeoNode database
    • sudo service postgresql start (or: sudo /etc/init.d/postgresql-8.4 start)
    • sudo -u postgres psql
    • drop database geonode;
    • create database geonode;
    • \q
    • sudo -u postgres -i pg_restore -Fc -d geonode /home/ssteinig/geonodedb.backup
  5. When switching Server to a new GeoNode version, then the problem is that the new GeoServer does not know the data yet. Hence, if I want to display a layer in GeoExplorer, then nothing is show. Looking into GeoServer, there are also no layers. So the data need to be updated from the db. For that I use
    • geonode syncdb --noinput --all
  6. start services: apache2, tomcat7

Restore DB

ToDo