Please note that these Trac pages are no longer being updated. Wiki contents/documentation have moved to GitHub.

Archive/SeattleGeniProductionHttp

SeattleClearinghouse in Production

The SeattleClearinghouse portal runs on Apache and uses mod_python to interface with django. This page describes how to redeploy SeattleClearinghouse from the current svn trunk as well as some additional configuration information for using SeattleClearinghouse in production.



File and Directory Permissions


The way we have things setup on SeattleClearinghouse and betabox, if you try to access the website before running the other service after you have just deployed then you are likely to get a permissions error of apache not being able to write files in /home/geni/live/seattle. However, this is not a problem if you use the start_seattlegeni_components.sh script because it will start the lockserver and backend before restarting apache, and the result will be that all of the '.repy' files that need to be turned into '_repy.py' will have already been processed, so the website (mod_python running under apache's user) won't try to do that.

Apache Settings


The Apache settings on our server can all be found in /etc/apache2/. The general information is described in wiki:SeattleGeniInstallation?.

The primary configuration file (that specifies the django path, and URL mappings, http/https mappings, etc) is /etc/apache2/sites-enabled/000-default

Note that the GENI site uses a SSL certificate and uses HTTPS (port 443) for all URLs that map into the GENI portal.


Logrotate


The SeattleClearinghouse website's log data goes to the apache error log. However, the log files of the individual scripts (polling daemons, transition scripts, lockserver, and backend) go to file in the /home/geni/logs directory. These need to be rotated by logrotate.

We use the following logrotate configuration (found in /etc/logrotate.d/seattlegeni):

/home/geni/logs/*.log {
  rotate 60
  daily
  compress
  missingok
  notifempty
  # The !SeattleClearinghouse scripts don't know how to start a new log file, so we have
  # logrotate make a copy of the log files and truncate the original ones.
  copytruncate
  # move the compressed files into the 'archived' directory that's in the same
  # directory as the log files themselves.
  olddir archived
}



Redeploying SeattleClearinghouse from SVN


To deploy SeattleClearinghouse code from SVN trunk into production:

  1. Log in to either seattleclearinghouse.poly.edu or betaseattleclearinghouse.poly.edu (depending on which installation you are updating).
  2. Get a root shell: sudo -i
  3. Open the screen running as root: screen -r
  4. There should be only one session in the screen and you will find yourself looking at a running instance of start_seattlegeni_components.sh with output that looks like this:
    root@betabox:~# /home/geni/start_seattlegeni_components.sh
    Starting lockserver.
    Starting backend.
    Gracefully restarting apache.
    Starting check_active_db_nodes.py.
    Starting transition script transition_donation_to_canonical
    Starting transition script transition_canonical_to_onepercentmanyevents
    Starting transition script transition_onepercentmanyevents_to_onepercentmanyevents
    All components started. Kill this process (CTRL-C or 'kill 24038') to stop all started components (except apache).
    
  5. Press CTRL-C and wait for start_seattlegeni_components.sh to exit (you will see "Shutting down SeattleClearinghouse components." a few times, that's OK).
  6. Run the command /home/geni/update_seattlegeni_from_trunk.sh. Answer "y" when it asks. It will look like this:
    root@betabox:~# /home/geni/update_seattlegeni_from_trunk.sh
    A    trunk/dist/rebuild_base_installers_for_seattlegeni.sh
    U    trunk/dist/update_software.py
    A    trunk/dist/push_update_to_all_clients.sh
    Updated to revision 3052.
    WARNING: existing directory found at directory to deploy: live/
    Backup and replace this directory (copying config files to the new deployment)? [y/n]y
    
    Renaming existing directory live/ to live.bak.1254859630.23
    Creating directory live/
    Copying trunk/seattlegeni to live/seattlegeni
    Deploying seattle and repy library code to live/seattle
    Copying live.bak.1254859630.23/seattlegeni/website/settings.py to live/seattlegeni/website/settings.py
    Copying live.bak.1254859630.23/seattlegeni/keydb/config.py to live/seattlegeni/keydb/config.py
    Copying live.bak.1254859630.23/seattlegeni/backend/config.py to live/seattlegeni/backend/config.py
    
    Deployed successfully. The file trunk/seattlegeni/README.txt contains the
    rest of the info you'll need to get things running.
    
  7. Now run /home/geni/start_seattlegeni_components.sh. It will look like this (just like you saw when you connected to the screen session):
    root@betabox:~# /home/geni/start_seattlegeni_components.sh
    Starting lockserver.
    Starting backend.
    Gracefully restarting apache.
    Starting check_active_db_nodes.py.
    Starting transition script transition_donation_to_canonical
    Starting transition script transition_canonical_to_onepercentmanyevents
    Starting transition script transition_onepercentmanyevents_to_onepercentmanyevents
    All components started. Kill this process (CTRL-C or 'kill 20452') to stop all started components (except apache).
    
  8. Get out of screen (either CTRL-SHIFT-A then CTRL-SHIFT-D or just close your terminal if you don't trust your screen skills).