Deploying the questionnaire

  1. If necessary, build a new egg: python bdist_egg in the appropriate directory
  2. Copy the egg to the NDG egg repository on triton (/var/www/ndg_site/htdocs/dist/)
  3. Login to flood.
    1. Change directory to /usr/local/cmip5q
    2. Become superuser (sudo -i)
  4. make buildout
    • If make buildout has network errors get files manually and execute ./bin/buildout -o
  5. change directory down into the egg you've just deployed until you get to the directory with and in it.
  6. manually fix (add database names etc from a previous deployment
    • 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)
  7. fix
    • Remove the source command associated with virtualenv
  8. If the database has been set up previously, make sure that all tables are cleared out before running
  9. get the special "py" interpreter for executing the setup and execute it ...
    cp ../../../bin/py .
    export PYTHON=./py
    chmod u+x
  10. Copy cmip5q-<version>-py2.5.egg/cmip5q/templates/css to /srv/www/vhosts/ (generally the style.css and any icon files). Yes this is a hack that needs fixing.
  11. Change back to /usr/local/cmip5q
  12. chown -R cmip5q.cmip5q *
  13. make install_wsgi
  14. restart apache to make sure: /etc/init.d/apache2 restart

CMIP5q deployment 2010-07-01

Backing up and trashing the database

  1. 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 .
  2. 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
  3. Drop the database
    badc$ dropdb -U postgres -h bora cmip5q
  4. 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
    ALTER DATABASE cmip5q OWNER TO cmip5q;
  5. Create a blank database:
    badc$ createdb -U postgres -h bora --owner cmip5q --encoding UTF8 cmip5q
    badc$ exit

Intialising CMIP5q

Following instructions at Most of this had been done already by Phil. the cmip5q-1.0 egg was in /usr/local/cmip5q/eggs.

  1. Edit in cmip5q egg to match the settings in the previous egg.
  2. and py were already fixed.
  3. Executed as described.
  4. The css had not been updated yesterday so I backed up /srv/www/vhosts/ and re-copied it.
  5. Restarted apache2