
How to create a new installation of the IPP pstamp system:

* Build an installation of the IPP code, e.g.:
  # psconfig ipp-pstamp
  * sets the build / install environment for code below which does not go into
    the apache server cgi location

* Create a database to host the relevant tables:
  * create a mysql user (this is needed generically for all IPP tools):
  > create user 'ipp'@'localhost' identified by 'XXX'
  > grant all on *.* to 'ipp'@'localhost'

  * in mysql, create the PSTAMP database:
  > create database pstamp;

  Note: the database name, user, etc can be arbitrary but they must
  match the entries in site.config such as PS_DBNAME.  

  * create the tables:
  # mysql -h localhost -u ipp -p pstamp < IPP/pstamp/doc/tabledefs.sql

  This generates the tables needed by the pstamp web pages and tools

* In IPP/psconfig, to install needed perl libraries:
  # pscheckperl pstamp-ubuntu -build

* in IPP/pstamp, to install the apache CGI elements:
  # ./autogen.sh --with-cgidir=/MY/PSTAMP/ps-web
  # make cgi
  * edit /MY/PSTAMP/ps-web/authenticate.php
    ** set auth_user and auth_passwd
    ** optionally set alt_user and alt_passwd
  * edit /MY/PSTAMP/ps-web/pstampconfig.php
    ** set WORKDIR, DS_ROOT, DS_URL
    ** set DATASTORE mysql info
    ** set PSTAMP mysql info
    ** set psconfig info for the full IPP install

* install the apache vhost configuration file:
  * NOTE: this likely needs root access
  * cp IPP/pstamp/web/03_pstamp.conf /etc/apache2/sites-available
  * edit to match location of WORKDIR and ps-web
  * enable the new site (a2ensite)
  * enable required modules: rewrite, cgi, includes
  * start or restart the apache server

* create a minimum set of pstamp support info:
  pstamptool -dbname pstamp -adduser -set_user magnier -set_domain hawaii.edu -set_accessLevel 1 -set_defaultProduct pstampresults -set_defaultLabel EAM
  pstamptool -dbname pstamp -adddomain -set_domain ifa.hawaii.edu -set_accessLevel 2 -set_defaultProduct ipp-pstamp-results -set_defaultLabel ifa-stamps
  pstamptool -dbname pstamp -addproject -name simtest -imagedb simtest -inst SIMTEST -telescope SIMTEST 
  pstamptool -dbname pstamp -addaccesslevel -set_project_name simtest  -set_accessLevel 1

* create a minimal DataStoreServer product:
  dsprodtool --add pstampresults --type PSRESULTS --description "test pstamp product" --ps0 req_id

* copy ptolemy.rc and ipprc files to ps-work:
  cp web/ipprc /MY/PSTAMP/ps-work/.ipprc
  cp web/ptolemy.rc /MY/PSTAMP/ps-work/.ptolemyrc
  * edit .ipprc : modify PATH
  * edit .ptolemyrc : modify HOSTNAME

* update site.config.  Here are critical things to define:
  * database info:
    * science database server: DBSERVER, DBNAME, DBUSER, DBPASSWORD, DBPORT
    * datastore database server: DS_DBSERVER, DS_DBNAME, DS_DBUSER, DS_DBPASSWORD
    * pstamp database server: PS_DBSERVER, PS_DBNAME, PS_DBUSER, PS_DBPASSWORD
  * DATA_STORE_ROOT : /MY/DATASTORE/dsroot
  * PSTAMP_WORKDIR  : /MY/PSTAMP/ps-work
  * PSTAMP_RUNDIR   : pstamp pantasks location 
  * PSTAMP_DATA_STORE_PRODUCT : pstampresults

* server check:
  pstamp_save_server_status.pl --verbose --update-link
  * this should create the status.html file along with the ps-work directory structure

* run the test 


*** other notes:
  MOTD is not automatically created, but does not cause a problem if it is missing
  MOTD goes in /MY/PSTAMP/ps-web/pstamp_motd.html
  WORKDIR for the apache server is automatically created by pstamp_save_server_status.pl



