configuring obstac

Table of Contents

1 Prerequisites

These instruction presumes obstac and its prerequisits have been installed (see *Installing obstac's dependencies and *Installing obstac).

2 Generate a web directory

The obstac user interface serves a set of web pages. Because these pages include temporary files (plots generated "on the fly"), the web directory of the obstac installation should not be served directly; instead, a dedicated directory is used. In these instructions, this directory is assumed to be /home/precam/obstac/web.

Begin by copying static content from the obstac product into this directory:

setup obstac mkdir -p ~/obstac/web cd ~/obstac/web mkdir js xslt css html plots ln -s $OBSTAC_DIR/web/*.xslt xslt ln -s $OBSTAC_DIR/web/*.js js ln -s $OBSTAC_DIR/web/*.css css ln -s $OBSTAC_DIR/web/*.html html ln -s $OBSTAC_DIR/web/epydoc .

3 Edit the obstac configuration file

Obstac currently reads its configuration from its own configuration file, set in the eUPS table file, or (if started from the architect) the SISPI architect's .INI file. In the future, obstac's configuration file will be phased out, and the data contained therein moved to either the architect's .INI file or the SISPI constants database.

Create an initial version of the config file by copying a sample from the product exported from the SVN repository to the desired location of the configuration file, for example:

setup obstac cp $OBSTAC_DIR/etc/precam/obstac.conf /home/precam/obstac/etc/obstac.conf

Now open the configuration file in your favorite editor. Most values should be left alone, but the following will need to be updated:

DEFAULT/base_dir

should be the directory of the installation of obstac (the same value as the OBSTACDIR shell variable after a setup obstac)

DEFAULT/config_dir

the directory where configuration files can be found. This value is used by obstac to find (optional) configuration files for its logger and for CherryPy.

Interface/web_dir

the directory in which the user interface content can be found; see *Generate a web directory.

Interface/host

the hostname on which the obstac interface will be run. If set to localhost then the obstac interface will be visible only to browsers running on the same host as the obstac interface.

Interface/port

the port on which to serve the obstac user interface.

Queue/min_duration

If obstac is configured to place targets on the SISPI OCS queue automatically, it will keep the queue duration this length or longer (in seconds).

Queue/OCS

If "True", obstac will place observations directly on the SISPI OCS queue. If "False", obstac keeps its own queue, which must be exported as a text file and then executed by a separate script to be observed.

Exposure table/SISPI

If "True", obstac will determine what fields have been observed already by querying the exposure table maintained by SISPI (exposure.exposure). If "False", obstac uses its own internal table, which much be updated by users by uploading text files of exposures to be added.

4 Add obstac and supporting roles to the SISPI architects .INI file

This step is only needed it obstac will placing observations directly on the queue. Otherwise, obstac may be started indendently of the architect.

First, add the following roles to the .INI file:

[[OBSTACSRVR]] xterm = True product = obstac product_version = 1.0.0 obstac_config = /home/precam/obstac/precam/etc/obstac.conf application_prog = python application_path = /software/products/obstac-1.0.0/python/obstac application_name = ObsServerPML.py loglevel = INFO [[OBSTACWEB]] xterm = True product = obstac product_version = 1.0.0 obstac_config = /home/precam/obstac/precam/etc/obstac.conf application_prog = python application_path = /software/products/obstac-1.0.0/python/obstac/ui application_name = ObstacWebApp.py loglevel = INFO [[AUTOOBS]] xterm = True product = obstac product_version = 1.0.0 application_prog = python application_path = /software/products/obstac-1.0.0/python/autoobs application_name = AutoObs.py

Note that you will need to update this if you declare a new version current. Note also the use of a full path for application_path rather than the shell varible $OBSTACDIR set by eUPS; this is needed to allow the configuration to continue working even when xterm is set to false, in which case shell variables are not expanded.

Once the roles have been defined, assign them to machines in the Nodes section, for example:

obstachost = ctiozv.ctio.noao.edu [Nodes] [[machineD]] host = %(obstachost)s roles = OBSTACSRVR, OBSTACWEB, AUTOOBS

5 Reset the obstac database

Do this section only if you want to erase all data in obstac's database and start over.

First, make sure the environment variables needed by obstac are set. If they are not, set them:

setup obstac export SISPI_OBSTAC_DB_HOST=$SISPI_DB_HOSTexport SISPI_OBSTAC_DB_NAME=$SISPI_DB_NAMEexport SISPI_OBSTAC_DB_USER=$SISPI_DB_WRITERexport SISPI_OBSTAC_DB_PORT=$SISPI_DB_PORTexport SISPI_OBSTAC_DB_WRITER_PASSWORD=$SISPI_DB_WRITER_PASSWORD

and start the SQL interface to the database:

psql --host $SISPI_OBSTAC_DB_HOST --port $SISPI_OBSTAC_DB_PORT $SISPI_OBSTAC_DB_NAME $SISPI_OBSTAC_DB_USER

(The above set of environment variable assignments should only be necessary because of the older version of the DB product that seems to be installed on the precam machine.)

Now, get rid of any old data in the obstac database. /Only do this if you want to loose all data already in the obstac schema of the database!/

At the postgreSQL sql prompt:

DROP SCHEMA obstac CASCADE; VACUUM;

Again from a UNIX shell, double check that OBSTAC_CONFIG doesn't point the wrong place, because it is possible for it to override environment variables. This is what the check should look like:

[precam@ctiozr ~]$ egrep '(dbname|dbuser|dbschema)' $OBSTAC_CONFIG dbschema = obstac [precam@ctiozr ~]$ echo $SISPI_OBSTAC_DB_NAME $SISPI_OBSTAC_DB_USER decam_dev decam_writer

If everything looks okay:

remake_database

This creates the tables, functions, and views of the obstac schema in the database, and fills the tables with starting values.

Author: Eric H. Neilsen, Jr.

Date: November 21, 2010

HTML generated by org-mode 7.01 in emacs 23