IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 17381


Ignore:
Timestamp:
Apr 7, 2008, 3:59:25 PM (18 years ago)
Author:
bills
Message:

Allow the data store server to be installed without a full IPP installation.

Location:
trunk/DataStoreServer
Files:
3 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataStoreServer/scripts/dsfsindex

    r16954 r17381  
    88use warnings;
    99
     10use dsdbh;
    1011use DBI;
    1112
    12 use PS::IPP::Config qw($PS_EXIT_SUCCESS
    13                        $PS_EXIT_UNKNOWN_ERROR
    14                        $PS_EXIT_SYS_ERROR
    15                        $PS_EXIT_CONFIG_ERROR
    16                        $PS_EXIT_PROG_ERROR
    17                        $PS_EXIT_DATA_ERROR
    18                        $PS_EXIT_TIMEOUT_ERROR
    19                        metadataLookupStr
    20                        metadataLookupBool
    21                        caturi
    22                        );
     13my $PS_EXIT_CONFIG_ERROR = 3;
     14my $PS_EXIT_DATA_ERROR = 5;
    2315
    2416my $fileset = pop;
     
    114106    print "$line\n";
    115107}
    116 
    117 sub getDBHandle {
    118     my $ipprc =  PS::IPP::Config->new(); # IPP Configuration
    119     my $siteConfig = $ipprc->{_siteConfig};
    120 
    121     my $dbserver = metadataLookupStr($siteConfig, 'DBSERVER');
    122     my $dbname   = metadataLookupStr($siteConfig, 'DBNAME');
    123     my $dbuser   = metadataLookupStr($siteConfig, 'DBUSER');
    124     my $dbpass   = metadataLookupStr($siteConfig, 'DBPASSWORD');
    125     exit ($PS_EXIT_CONFIG_ERROR) unless defined $dbserver and $dbname and $dbuser and $dbpass;
    126 
    127     my $dsn = "DBI:mysql:host=$dbserver;database=$dbname";
    128 
    129     my $dbh = DBI->connect($dsn, $dbuser, $dbpass) or die "Cannot connect to server\n";
    130     return $dbh;
    131 }
  • trunk/DataStoreServer/scripts/dsprodindex

    r16762 r17381  
    77
    88use DBI;
    9 use PS::IPP::Config qw($PS_EXIT_SUCCESS
    10                        $PS_EXIT_UNKNOWN_ERROR
    11                        $PS_EXIT_SYS_ERROR
    12                        $PS_EXIT_CONFIG_ERROR
    13                        $PS_EXIT_PROG_ERROR
    14                        $PS_EXIT_DATA_ERROR
    15                        $PS_EXIT_TIMEOUT_ERROR
    16                        metadataLookupStr
    17                        metadataLookupBool
    18                        caturi
    19                        );
     9use dsdbh;
    2010
     11my $PS_EXIT_CONFIG_ERROR = 3;
     12my $PS_EXIT_DATA_ERROR = 5;
    2113my $product = shift;
    2214die("must specify product to list") unless defined $product;
     
    145137    print "$line\n";
    146138}
    147 
    148 # TODO: move this to a module
    149 sub getDBHandle {
    150     my $ipprc =  PS::IPP::Config->new(); # IPP Configuration
    151     my $siteConfig = $ipprc->{_siteConfig};
    152 
    153     my $dbserver = metadataLookupStr($siteConfig, 'DBSERVER');
    154     my $dbname   = metadataLookupStr($siteConfig, 'DBNAME');
    155     my $dbuser   = metadataLookupStr($siteConfig, 'DBUSER');
    156     my $dbpass   = metadataLookupStr($siteConfig, 'DBPASSWORD');
    157     exit ($PS_EXIT_CONFIG_ERROR) unless defined $dbserver and $dbname and $dbuser and $dbpass;
    158 
    159     my $dsn = "DBI:mysql:host=$dbserver;database=$dbname";
    160 
    161     my $dbh = DBI->connect($dsn, $dbuser, $dbpass) or die "Cannot connect to server\n";
    162     return $dbh;
    163 }
  • trunk/DataStoreServer/scripts/dsrootindex

    r16762 r17381  
    88use warnings;
    99
     10use dsdbh;
     11
    1012use DBI;
    1113
    12 use PS::IPP::Config qw($PS_EXIT_SUCCESS
    13                        $PS_EXIT_UNKNOWN_ERROR
    14                        $PS_EXIT_SYS_ERROR
    15                        $PS_EXIT_CONFIG_ERROR
    16                        $PS_EXIT_PROG_ERROR
    17                        $PS_EXIT_DATA_ERROR
    18                        $PS_EXIT_TIMEOUT_ERROR
    19                        metadataLookupStr
    20                        metadataLookupBool
    21                        caturi
    22                        );
     14my $PS_EXIT_CONFIG_ERROR = 3;
    2315
    2416my $dbh = getDBHandle();
     
    4638    print $line;
    4739}
    48 
    49 # todo move to a module
    50 sub getDBHandle {
    51     my $ipprc =  PS::IPP::Config->new(); # IPP Configuration
    52     my $siteConfig = $ipprc->{_siteConfig};
    53 
    54     my $dbserver = metadataLookupStr($siteConfig, 'DBSERVER');
    55     my $dbname   = metadataLookupStr($siteConfig, 'DBNAME');
    56     my $dbuser   = metadataLookupStr($siteConfig, 'DBUSER');
    57     my $dbpass   = metadataLookupStr($siteConfig, 'DBPASSWORD');
    58     exit ($PS_EXIT_CONFIG_ERROR) unless defined $dbserver and $dbname and $dbuser and $dbpass;
    59 
    60     my $dsn = "DBI:mysql:host=$dbserver;database=$dbname";
    61 
    62     my $dbh = DBI->connect($dsn, $dbuser, $dbpass) or die "Cannot connect to server\n";
    63     return $dbh;
    64 }
  • trunk/DataStoreServer/scripts/tabledefs.sql

    r16872 r17381  
    7777
    7878# none of these types have any type specific columns
    79 INSERT INTO dsFileType (type) VALUES('psrequest');
    80 INSERT INTO dsFileType (type) VALUES('psresults');
    81 INSERT INTO dsFileType (type) VALUES('pstamp');
     79#INSERT INTO dsFileType (type) VALUES('psrequest');
     80#INSERT INTO dsFileType (type) VALUES('psresults');
     81#INSERT INTO dsFileType (type) VALUES('pstamp');
  • trunk/DataStoreServer/web/cgi/dsfits.cgi

    r16763 r17381  
    1 #!/usr/bin/env perl
    2 
    3 use strict;
    4 use CGI ':standard';
    5 
    6 my $DS_DIR = '/var/www/html/ds/dsroot';
    7 #my $DS_DIR = '.';
    8 
    9 my $uri = $ENV{'REQUEST_URI'};
    10 
    11 $uri = $ARGV[0];
    12 print STDERR "uri is $uri\n";
    13 
    14 (my $left, my $param) = split(/\,/, $uri);
    15 
    16 print STDERR "left: $left param: $param\n";
    17 
    18 if ($left !~ /\.fits$/) {
    19         print header( -status => '404 Not Found' );
    20         exit;
    21 }
    22 
    23 my @path = split(/\//, $left);
    24 
    25 my $fn = @path[$#path];
    26 my $fpath = $DS_DIR.'/'.$left;
    27 
    28 
    29 
    30 print header(   -type => 'image/fits',
    31                                 -attachment => $fn,
    32                                 -content_length => -s $fpath,
    33                         );
    34 
    35 
    36 open F, $DS_DIR.'/'.$left;
    37 
    38 binmode(F);
    39 binmode(STDOUT);
    40 
    41 print while (<F>);
    42 
    43 close F;
     1#!/bin/bash
     2. ./dsshellconfig
     3./dodsfits $*
  • trunk/DataStoreServer/web/cgi/dsgetindex

    r16955 r17381  
    55# The only required argument is the REQUEST_URI.
    66# The number of elements in the URI tell us whether we are listing
    7 # the root, a product, or a fileset.
    8 #
    9 # if a second argument -html is provided, the output is in HTML
     7# the data store root, a product, or a fileset.
     8#
     9# if a second argument -html is provided, the output is in HTML format
     10# otherwise plain text is used
    1011#
    1112# The only thing specific to the ipp used here is the exit codes.
     
    1617use CGI ':standard';
    1718use IPC::Cmd 0.36 qw( can_run run );
    18 use PS::IPP::Config qw($PS_EXIT_SUCCESS
    19                        $PS_EXIT_UNKNOWN_ERROR
    20                        $PS_EXIT_SYS_ERROR
    21                        $PS_EXIT_CONFIG_ERROR
    22                        $PS_EXIT_PROG_ERROR
    23                        $PS_EXIT_DATA_ERROR
    24                        $PS_EXIT_TIMEOUT_ERROR
    25                        metadataLookupStr
    26                        metadataLookupBool
    27                        caturi
    28                        );
     19
     20my $PS_EXIT_CONFIG_ERROR = 3;
     21my $PS_EXIT_DATA_ERROR = 5;
    2922
    3023my $uri = shift;
     
    3427    exit ($PS_EXIT_CONFIG_ERROR);
    3528}
     29
     30my $DS_ROOT = $ENV{DS_ROOT};
     31
     32die("DS_ROOT not found in the environment") unless defined($DS_ROOT);
    3633
    3734my @path;
     
    5956    # there is no file on the url
    6057
    61     print STDERR "html mode\n";
     58    # print STDERR "html mode\n";
    6259
    6360    ($directories, $query_str) = split/\?/, $uri;
     
    9693
    9794if (@dirs) {
     95    # XXX need to output an error page
    9896    warn("unexpected extra directories: @dirs in uri: $uri");
    9997    exit ($PS_EXIT_CONFIG_ERROR);
     
    167165# XXX:
    168166# quick hacky pretty printer
    169 # Stolen Eric's mock up
     167# Stolen from Eric's Data Store mock up
    170168#
    171169
     
    174172
    175173    print header('text/html', '200 OK');
    176     print start_html('Datastore');
     174    print start_html('Data Store');
    177175
    178176        # get free space
    179         # XXX: need to configure DS_DIR
    180         my $DS_DIR = '/var/www/html/ds/dsroot';
    181         my $ref = df($DS_DIR);
     177        my $ref = df($DS_ROOT);
    182178        printf '<p>Free space: %.2fG (%.1f%%)</p>',
    183179                $ref->{bfree}/(1024*1024),
  • trunk/DataStoreServer/web/cgi/dsindex.cgi

    r16763 r17381  
    1 #!/bin/sh
    2 /export/data0/bills/psconfig/default.linrh64/bin/pstamp_runcommand.sh dsgetindex $REQUEST_URI -html
     1#!/bin/bash
     2. ./dsshellconfig
     3dsgetindex $REQUEST_URI -html
  • trunk/DataStoreServer/web/cgi/dstxtindex.cgi

    r16763 r17381  
    1 #!/bin/sh
    2 /export/data0/bills/psconfig/default.linrh64/bin/pstamp_runcommand.sh dsgetindex $REQUEST_URI;
     1#!/bin/bash
     2. ./dsshellconfig
     3./dsgetindex $REQUEST_URI;
  • trunk/DataStoreServer/web/conf/httpd-datastore.conf

    r16763 r17381  
    1 
    2 <Directory "/var/www/html/ds/dsroot">
    3 #<Directory "/ds/dsroot">
     1#
     2# Root of the data store (where the directory hierarchy lives
     3#
     4<Directory "/data/ipp000.0/datastore/dsroot">
    45
    56  DirectoryIndex /ds-cgi/dsindex.cgi
     
    1415  XBitHack on
    1516
    16   # attempt to turn caching off (doesn't seem to work)
    17   ExpiresActive On
    18   # expires 0 seconds after access (doesn't get applied)
    19   ExpiresDefault A0
    20 
    21 #AddType text/plain .txt
     17  AddType text/plain .txt
    2218  AddOutputFilter INCLUDES .txt
    2319
     
    2824</Directory>
    2925
    30 <Directory "/cgi-bin/ds-cgi">
    31 #<Directory "/ds/cgi">
     26
     27#
     28# Location of the cgi scripts
     29#
     30
     31<Directory "/data/ipp000.0/datastore/ds-cgi">
    3232  Options ExecCGI
    3333
     
    3737</Directory>
    3838
    39 Alias       /ds/     /var/www/html/ds/dsroot/
    40 ScriptAlias /ds-cgi/ /var/www/cgi-bin/ds-cgi/
     39Alias       /ds/     /data/ipp000.0/datastore/dsroot/
     40ScriptAlias /ds-cgi/ /data/ipp000.0/datastore/ds-cgi/
    4141
    42 
    43 # these don't do what I want
    44 #AliasMatch (.*)(/index.txt)(.*) $1/$3
    45 
    46 #ScriptAliasMatch ^/.*/index.txt /ds-cgi/dsindex.cgi
    47 #ScriptAlias /var/www/html/ds/dsroot/pstamprequest/index.txt /ds-cgi/dsindex.cgi
    48 
    49 #RedirectMatch /ds/.*/index.txt /ds-cgi/dsindex.cgi
    50 #RedirectMatch /ds/.*  /ds-cgi/dsindex.cgi
    51 
Note: See TracChangeset for help on using the changeset viewer.