Skip to content

Development

Ian Schneider edited this page Jun 25, 2013 · 21 revisions

Extra Docs

These docs should be moved to a more appropriate place.

Syncing with the Dev environment (PostGIS database and data_dir)

Syncing is no longer viable as the DB is too big on dev

  • Create a directory under /var/lib/geoserver/geonode-data and give it the appropriate permissions (e.g. the user running Jetty as the owner)

  • Use rsync to get the data_dir from the dev server and put it locally:

      rsync -Pr -e 'ssh -p 7777' \
        user@mapstory.demo.opengeo.org:/var/lib/geoserver/geonode-data /var/lib/geoserver
    
  • Take the PostGIS dump from the demo server using scp:

      scp -P 7777 user@mapstory.demo.opengeo.org:~ischneider/geonode.dump  .
    
  • Create a geonode user (with the same password as on demo/dev, can be retrieved by looking at the HTML source in the GeoServer web admin and searching for passwd) in your local PostGIS database, also create a database called geonode based on the PostGIS template. If you are running the Suite PostGIS, make sure to change the port from 54321 to 5432 using the Dashboard.

  • Load up the database dump using:

      pg_restore -c -d geonode geonode.dump
    
  • Start up Postgres using:

      ./opt/opengeo/pgsql/8.4/scripts/pg_start_server.sh
    

Syncing is no longer viable as the DB is too big on dev

Running MapStory in Development Mode

  • Clone GeoNode from https://github.com/opengeo/geonode/, check out the mapstory branch, and build as described in the main readme.

  • Clone the mapstory project, activate the GeoNode virtual env (e.g. source ../geonode/bin/activate), and then run the following ( always run manage.py from the mapstory directory ):

      python manage.py syncdb
      python manage.py collectstatic -v0
    
  • Create a local_settings.py with something like the following (this assumes you are running Tomcat with GeoServer on port 8080, if not just omit this):

      GEOSERVER_BASE_URL = "http://localhost:8080/geoserver/"
    
  • To support uploading into postgres and the annotations layer, the following must also be added to the local_settings.py. The final two lines support running tests without using the same db ( don't forget to change user/password to reflect your local setup ). When in doubt, check the config on the dev server. Of course, you also need a PostGIS database named 'geonode_imports':

      DATABASE_ENGINE = 'postgresql_psycopg2'
      DATABASE_NAME = 'geonode_imports'
      DATABASE_USER = 'dbuser'
      DATABASE_PASSWORD = 'password'
      DATABASE_HOST = 'localhost'
      DATABASE_PORT = '5432'
    
      DB_DATASTORE=True
      DB_DATASTORE_NAME='geonode_imports'
      DB_DATASTORE_USER=DATABASE_USER
      DB_DATASTORE_DATABASE='geonode_imports'
      DB_DATASTORE_PASSWORD=DATABASE_PASSWORD
      DB_DATASTORE_HOST=DATABASE_HOST
      DB_DATASTORE_PORT=DATABASE_PORT
      DB_DATASTORE_TYPE='postgis'
      DATABASES = {
        'default': {
          'ENGINE': 'django.contrib.gis.db.backends.postgis',
          'NAME': DATABASE_NAME,
          'USER': DATABASE_USER,
          'PASSWORD': DATABASE_PASSWORD,
          'HOST': DATABASE_HOST,
          'PORT': DATABASE_PORT,
        }
      }
    
      import sys
      if 'test' in sys.argv:
        DATABASES['default']['ENGINE'] = 'sqlite3'
    
  • If you run GeoServer on port 8080, you need to also change dev-paste.ini, the setting [app:gsproxy_app] needs to have the right port.

  • To run GeoServer and GeoNode using Jetty, go to: mapstory/geonode/src/geoserver-geonode-ext and run ./startup.sh. To use the data directory which has been synced with the dev environment (see above), a slightly modified version of the startup.sh can be used, as an example (this will run GeoServer on port 8080):

      #!/bin/bash
      export DISPLAY=:1
      GEONODE_HOME=/Users/bartvde/opengeo/git/mapstory/geocode
      (cd $GEONODE_HOME/src/geoserver-geonode-ext;
      MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=256m \
        -XX:CompileCommand=exclude,net/sf/saxon/event/ReceivingContentHandler.startElement"
      mvn jetty:run -o -Djetty.scanIntervalSeconds=0 \
        -DGEOSERVER_DATA_DIR=/var/lib/geoserver/geonode-data/ \
        -DGEONODE_BASE_URL=http://localhost:8000 -Djetty.port=8080
       )
    
  • If you are running Tomcat, make sure to change catalina.sh and add:

      CATALINA_OPTS="-Xmx512m -XX:MaxPermSize=128m \
        -XX:CompileCommand=exclude,net/sf/saxon/event/ReceivingContentHandler.startElement"
    
  • If you want to use a local geonode-client in debug mode (ant debug -Dapp.port 8081 from the root of the geonode-client directory) then use (do not forget the extra forward slash at the end):

      GEONODE_CLIENT_LOCATION = "http://localhost:8081/"
    
  • Add the parent directory to your Python path:

      export PYTHONPATH=../
    
  • Run paster from the mapstory directory.

      paster serve --reload dev-paste.ini
    

Clone this wiki locally