Deploying the questionnaire
- If necessary, build a new egg: python setup.py bdist_egg in the appropriate directory
- Copy the egg to the NDG egg repository on triton (/var/www/ndg_site/htdocs/dist/)
- Login to flood.
- Change directory to /usr/local/cmip5q
- Become superuser (sudo -i)
- make buildout
- If make buildout has network errors get files manually and execute ./bin/buildout -o
- change directory down into the egg you've just deployed until you get to the directory with settings.py and setupProto.sh in it.
- manually fix settings.py (add database names etc from a previous deployment settings.py)
- Set debug to False
- need to make sure that the SECRET_KEY, database name, static_doc_root and template_dirs are appropriate for deployment not a sandbox. Database (Fill in <> where appropriate):
DATABASE_ENGINE = 'postgresql_psycopg2' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. DATABASE_NAME = 'cmip5q' DATABASE_USER = '<name>' # Not used with sqlite3. DATABASE_PASSWORD = '<password>' # Not used with sqlite3. DATABASE_HOST = '<database host domain name>' # Set to empty string for localhost. Not used with sqlite3. DATABASE_PORT = '5432' # Set to empty string for default. Not used with sqlite3.
- (this may no longer need doing)
- fix setupProto.sh
- Remove the source command associated with virtualenv
- If the database has been set up previously, make sure that all tables are cleared out before running setupProto.sh
- get the special "py" interpreter for executing the setup and execute it ...
cp ../../../bin/py . export PYTHON=./py chmod u+x setupProto.sh ./setupProto.sh
- Copy cmip5q-<version>-py2.5.egg/cmip5q/templates/css to /srv/www/vhosts/q.cmip5.ceda.ac.uk/htdocs (generally the style.css and any icon files). Yes this is a hack that needs fixing.
- Change back to /usr/local/cmip5q
- chown -R cmip5q.cmip5q *
- make install_wsgi
- restart apache to make sure: /etc/init.d/apache2 restart
CMIP5q deployment 2010-07-01
Backing up and trashing the database
- Create place to put database backup:
$ ssh flood $ sudo -s root$ cd /usr/local/cmip5q root$ mkdir backup root$ cd backup root$ chgrp badcint . ; chmod g+w .
- Become user badc (required to access bora database as user postgres) and dump the database, including the CREATE DATABASE commands
badc$ su badc badc$ pg_dump -U postgres -h bora -C --file=cmip5q-20100701.sql cmip5q
- Drop the database
badc$ dropdb -U postgres -h bora cmip5q
- Check how the database was created by examining cmip5q-20100701.sql. The following commands at the top are relevent:
-- -- Name: cmip5q; Type: DATABASE; Schema: -; Owner: cmip5q -- CREATE DATABASE cmip5q WITH TEMPLATE = template0 ENCODING = 'UTF8'; ALTER DATABASE cmip5q OWNER TO cmip5q;
- Create a blank database:
badc$ createdb -U postgres -h bora --owner cmip5q --encoding UTF8 cmip5q badc$ exit root$
Intialising CMIP5q
Following instructions at http://metaforclimate.eu/trac/wiki/WP4/QDeployment. Most of this had been done already by Phil. the cmip5q-1.0 egg was in /usr/local/cmip5q/eggs.
- Edit settings.py in cmip5q egg to match the settings in the previous egg.
- setupProto.sh and py were already fixed.
- Executed setupProto.sh as described.
- The css had not been updated yesterday so I backed up /srv/www/vhosts/q.cmip5.ceda.ac.uk/htdocs/css/ and re-copied it.
- Restarted apache2
