-
Notifications
You must be signed in to change notification settings - Fork 40
Upgrade Software Versions
This page outlines the procedure for upgrading from one version of DistrictBuilder to another. This process should be undertaken by an experienced linux systems administrator, and are not for the faint of heart.
The following instructions assume that one is working on the DistrictBuilder AMIs. If you are running DistrictBuilder on a different linux distribution, or with different versions of apache and tomcat, modify the commands to reflect your system configuration.
All command entered below should be entered as the superuser, or using 'sudo'.
-
Stop apache, tomcat, and celeryd.
$ service apache2 stop $ service tomcat6 stop $ service celeryd stop
-
Change to the publicmapping trunk directory.
$ cd /projects/publicmapping/trunk/
-
Switch from the 1.1 tag to the 1.2 tag.
$ git checkout v1.2
-
Backup the working SLDs. The git update procedure may wipe out the current SLDs, as they were renamed in a previous revision. If you have local modifications, you may loose them if you don't backup your SLDs and restore them after the update.
$ cd /projects/publicmapping/trunk/sld $ tar -zcf styles.tgz *sld
-
Rename the SLD files. The mapserver namespace must be prepended to the SLD filenames, in order to distinguish between multiple DistrictBuilder applications using the same geoserver. This set of commands will extract the current working styles, and overwrite the SLDs under source control. In this example, we're renaming from the "old" namespace to the "new" namespace.
$ cd /projects/publicmapping/trunk/sld $ tar -zxf styles.tgz $ rename "s/old:/new:" *.sld
-
Run the SQL update scripts in order. Important: the SQL update scripts must be run in order, from low to high. These instructions assume that the database name is 'publicmapping', and the database user name is 'publicmapping'.
$ cd /projects/publicmapping/trunk/sql $ for sql in 01[3-8]*; do psql -f $sql -U publicmapping publicmapping; done
-
Start apache, tomcat, and celeryd.
$ service apache2 start $ service tomcat6 start $ service celeryd start
-
Update the user-selectable score functions. The score functions now have a finer-grained control as to which score functions are available at which legislative bodies. If there are some score functions that you, the administrator, don't want to be user selectable in specific legislative bodies, then follow these steps: 1. Log in to the DistrictBuilder admin. 2. Navigate to Redistricting > Score functions 3. Select the !ScoreFunction that you want to change 4. Adjust the selection under "Selectable bodies"
-
Update configuration for user-selectable score functions. The configuration has changed to accommodate the user-selectable setting per legislative body. See the ScoreFunction Configuration for more information. To update the configuration: 1. Open the configuration XML in your favorite text editor. 2. Locate each <ScoreFunction> element that had the attribute "user-selectable" 3. Remove the "user-selectable" attribute 4. Add a <LegislativeBody> element as a child of <ScoreFunction> for each body where this score function should be user selectable.
-
Update the sorting of the legislative bodies. Legislative bodies now have a field named "sort_key" that determines the order in which they appear in the application. To set this in the application: 1. Log in to the DistrictBuilder admin. 2. Navigate to Redistricting > Legislative bodies 3. Select the LegislativeBody that you want to change 4. Set the "Sort key" field to the ranking position, relative to all the other legislative bodies.
-
Update configuration for legislative body sorting. See the LegislativeBody Configuration for more information. To update the configuration: 1. Open the configuration XML in your favorite text editor. 2. Locate the primary <LegislativeBody> configuration elements. 1. Add the "sort_key" attribute and value.
-
Update SLDs for district choropleths. The Target configuration elements have been removed from the XML configuration in 1.2, and the relevant values have been extracted into district SLDs. 1. For each combination of legislative body and displayed subject, open the file sld/<namespace>:<legislative body>_<subject>.sld (e.g. "pmp:congressional_poptot.sld") in your favorite text editor. 2. Update the values in the <ogc:Literal> tags to match the target ranges from your 1.1 config.
-
Remove Targets from the XML configuration. Since Targets have been removed from the application, in favor of Calculators, their corresponding configuration elements need to be removed. 1. Open the configuration XML in your favorite text editor. 2. Remove the <Targets> element and all its children. 3. Remove all the <LegislativeTargets> elements and all their children.
-
Install new python packages.
$ easy_install django-tagging inflect
The password encryption in v1.3 has changed, and any upgrade to a running system will lock out users until they use the forgotten password recovery facility to change their password. If you are upgrading a running v1.2 system to v1.3, please ensure that your email settings are correct, and that the forgotten password recovery facility is working properly. If not, it will be impossible for users to reset their password or log in.
First, switch from the 1.2 tag to the 1.3 tag.
$ git checkout v1.3
If you have made any changes to your configuration via the django admin application, and not updated your config.xml file to reflect those changes, proceed to "Configurations out of sync" below. If you have not made any changes to your configuration, and your config.xml represents the state of the running application, proceed to "Configuration in sync" below.
If your configuration file matches your run-time configuration in the admin application, the following steps will upgrade your 1.2 installation to 1.3:
-
Update your Python libraries to get the latest requirements:
$ cd /projects/PublicMapping/DistrictBuilder $ apt-get install python-pip $ pip install -r requirements.txt
-
Run the setup command. This will reset your unique secret key, requiring all sessions to be reset in django:
$ cd django/publicmapping $ ./setup.py ../path/to/your/schema.xsd ../path/to/your/config.xml -d -s
-
Truncate the django session table:
$ psql -U publicmapping -d publicmapping -c "truncate table django_session;"
-
Replace your old celery script with the latest version
$ wget --no-check-certificate -O /etc/init.d/celeryd
https://raw.github.com/ask/celery/master/contrib/generic-init.d/celeryd -
Create the new log- and pid-file directories so that www-data can read and write them.
$ mkdir /var/log/celery /var/run/celery $ chown www-data:www-data /var/log/celery /var/run/celery/
-
Restart apache and celery services, since the django application code has changed:
$ service apache2 restart $ service celeryd restart
If your configuration file does not match your run-time configuration in the admin application, the following steps will upgrade your 1.2 installation to 1.3:
-
Update your Python libraries to get the latest requirements:
$ cd /projects/PublicMapping/DistrictBuilder $ apt-get install python-pip $ pip install -r requirements.txt $ cd django/publicmapping
-
Remove the "CARROT_BACKEND" setting from settings.py, and replace it with:
BROKER_TRANSPORT = 'djkombu.transport.DatabaseTransport'
-
Remove 'ghettoq' from the "INSTALLED_APPS" setting in settings.py, and replace it with 'djkobmu'.
-
Replace your old celery script with the latest version
$ wget --no-check-certificate -O /etc/init.d/celeryd
https://raw.github.com/ask/celery/master/contrib/generic-init.d/celeryd -
Create the new log- and pid-file directories so that www-data can read and write them.
$ mkdir /var/log/celery /var/run/celery $ chown www-data:www-data /var/log/celery /var/run/celery/
-
Run the syncdb management command:
$ ./manage.py syncdb
-
Update the script and style files:
$ ./manage.py collectstatic --noinput
-
Restart apache services and celery, since the django application code has changed:
$ service apache2 restart $ service celeryd restart
The following upgrade instructions assume the following settings:
- The database name is
publicmapping - The database user name is
publicmapping - The location of the xml configuration file is
docs/config.xml
Most likely your settings will be different from the above, so please adjust the commands accordingly to reflect your local settings.
-
Switch from the 1.3 tag to the 1.4 tag.
$ git checkout v1.4
-
Add the xhtml2pdf, django-compressor, and modestmaps-py libraries
$ pip install -r requirements.txt
-
Add the CACHE directory for django-compressor:
$ pushd django/publicmapping/static-media $ mkdir CACHE $ chmod 775 CACHE $ sudo chgrp www-data CACHE $ popd
-
Run the SQL update scripts in order, starting at 20, and ending at 25. Important: the SQL update scripts must be run in order, from low to high. These instructions assume that the database name is 'publicmapping', and the database user name is 'publicmapping'.
$ cd sql $ for sql in 02[0-5]*; do psql -f $sql -U publicmapping publicmapping; done
-
Run setup to recreate the spatial views and collect the static files.
$ pushd django/publicmapping $ python setup.py ../../docs/config.xsd ../../docs/config.xml -V -s -v2 $ popd
-
Restart the celery and apache services.
$ sudo service celeryd restart; $ sudo service apache2 restart;
-
Update the site domain in the django admin interface:
- Log in to the admin interface:
http://<hostname>/admin/ - Under Sites / Sites, click on "Change"
- Under the only Site, check the domain name. Ensure that this domain name is correct for your installation.
- Log in to the admin interface: