Deployment Guide
General
- Make a clean checkout.
- python bootstrap.py
- . bin/activate
- paver build
- paver package_all or paver make_release
- Put files from shared/packages into correct places
Apache
Needs mod_wsgi.
TO DO: sample Apache configuration, explanation of directives with links to mod_wsgi documentation.
Webapp
The Django web application deployment is the most complicated part of the GeoNode deployment process.
- Put geonode-webapp.pybundle and bootstrap.py in the desired WSGI deployment directory
- Run the bootstrap script with Python 2.6.
sudo python bootstrap.py --python=/full/path/to/desired/python2.6
- See #408. If this error occurs, enter the virtualenv and run
pip install geonode-webapp.pybundle
- Make sure everything is owned by the Apache user.
chown -R the-apache-user:the-apache-user ./
- Edit mod_wsgi config to point to this environment. Here is an example of the .wsgi script you could use:
# This is a sample WSGI script to use when deploying the GeoNode import os, site # CHANGE THIS to point to your site packages site.addsitedir('/absolute/path/to/lib/python/site-packages') os.environ['DJANGO_SETTINGS_MODULE'] = 'capra.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()
- Edit the geonode settings file
- Provide an absolute path to the database.
- Set DEBUG = False
- Provide the right static resources path
- Set GEOSERVER_BASE_URL to the appropriate url
- Make sure the Google Maps API key is appropriate to your new domain
TODO: regarding proxies:
Gotcha. This will also be a consideration for a vanilla install of a GeoNode out of the box if we're worrying about that yet, so if we're keeping production deployment notes, we should add that. Restricting based on the mime-type catches exposure of data, but requires that the request is still forwarded to the service if I understand correctly. This alone can entail side effects in the case of an otherwise unsecured local RESTful service. I can see allowing mainly unrestricted access to remote hosts, but it seems like the set of services deployed on the same machine should be fairly limited? Mainly to GEOSERVER_BASE_URL and presumably GeoNetwork?
Client
- Make sure you have Apache exposing a directory that will be used for static files. In this example, the URL path is /geonode-client
- Put the file geonode-client.zip in the web-exposed directory.
- Unzip the file.
- In the Webapp's geonode.settings file, set the GEONODE_CLIENT_LOCATION to the absolute url path of the static resources, e.g. http://my.domain.com/geonode-client
GeoServer
- Drop the .WAR file into Tomcat.
- Start Tomcat to expand the WAR.
- The GeoServer WAR doesn't include a datadir by default, so you need to modify web.xml to specify what datadir to use.
Open the tomcat/webapps/geoserver-geonode-dev/WEB-INF/web.xml file and find the section that looks like this:
<!-- <context-param> <param-name>GEOSERVER_DATA_DIR</param-name> <param-value>C:\eclipse\workspace\geoserver_trunk\cite\confCiteWFSPostGIS</param-value> </context-param> -->Uncomment it and change the path within the param-value tags to the path of your data directory.
GeoNetwork
- Run
Old Notes
(modified from Whit's "packaging bits" email)
The task called 'make_release' that takes optionally drives package_all, and then wraps up the results in a nicely named tarball.
The command has some flags so you can override or extend the automatic folder and tarball naming if you like. It also shoves a file with the svn url and revision number in the tarball for later debugging (in version.txt).
The deployment workflow goes like this:
Check out branch of choice to release or deploy. Then activate, build, run tests, determine your build is ready, tag release, etc, etc.
(GN)$ paver make_release (GN)$ scp share/Geonode-xxx-release.tar.gz http://targetserver:/wsgi/deployment-envs/ (GN)$ ssh targetserver # cd /wsgi/deployment-envs/ # zcat Geonode-xxx-release.tar.gz | tar -xf -; cd Geonode-xxx-release # sudo python bootstrap.py --python=/full/path/to/desired/python2.6 # chown -R the-apache-user:the-apache-user ./
Now all python pieces should be installed. Edit mod_wsgi config to point at this environment.
Edit the geonode settings file
- Provide an absolute path to the database.
- Set DEBUG = False
- Provide the right static resources path
- Set GEOSERVER_BASE_URL to the appropriate url
Place other artifacts (js, war). Restart apache and any other servers that need restarting. See if it all works (run linkchecker). If all looks good, blow away old environment.
