Changes for less verbose and more robust setup process.

Some documentation added.
This commit is contained in:
tomas 2004-11-24 04:07:46 +00:00
parent 5998395646
commit 41af7984c1
24 changed files with 619 additions and 181 deletions

View File

@ -20,7 +20,7 @@
#
#
# Author : $Author: tomas $
# Version : $Revision: 1.2 $
# Version : $Revision: 1.3 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/Attic/Makefile,v $
#
# @configure_input@
@ -62,17 +62,13 @@ USR_LIB_DIR = ${USR_DIR}/lib
DOXYGEN_CONFIG = ${ETC_DIR}/doxygen.config
GET_GNAME = install/getGname.php
WWW_ROOT := $(shell cd ../storageServer/var/install; php -q getWwwRoot.php)
HTTP_GROUP := $(shell curl -s ${WWW_ROOT}/${GET_GNAME})
PHP_DIR = ${BASE_DIR}/var
INSTALL_DIR = ${PHP_DIR}/install
STOR_DIR = ${PHP_DIR}/stor
ACCESS_DIR = ${PHP_DIR}/access
TRANS_DIR = ${PHP_DIR}/trans
BUFF_DIR = ${STOR_DIR}/buffer
TEST_RUNNER = ${PHP_DIR}/xmlrpc/testRunner.sh
PHP_DIR = ${BASE_DIR}/var
INSTALL_DIR = ${PHP_DIR}/install
STOR_DIR = ${PHP_DIR}/stor
ACCESS_DIR = ${PHP_DIR}/access
TRANS_DIR = ${PHP_DIR}/trans
BUFF_DIR = ${STOR_DIR}/buffer
TEST_RUNNER = ${PHP_DIR}/xmlrpc/testRunner.sh
#-------------------------------------------------------------------------------
# Configuration parameters
@ -93,11 +89,13 @@ TEST_RUNNER = ${PHP_DIR}/xmlrpc/testRunner.sh
#-------------------------------------------------------------------------------
# Targets
#-------------------------------------------------------------------------------
.PHONY: all dir_setup doc clean docclean depclean distclean dist db_init db_clean
.PHONY: all dir_setup doc clean docclean depclean distclean dist \
db_init db_clean
all: dir_setup db_init
dir_setup: ${DOXYGEN_DIR} ${STOR_DIR} ${ACCESS_DIR} ${TRANS_DIR}
dir_setup: ${DOXYGEN_DIR}
bin/setupDirs.sh ${STOR_DIR} ${ACCESS_DIR} ${TRANS_DIR} ${BUFF_DIR}
doc:
${DOXYGEN} ${DOXYGEN_CONFIG}
@ -120,7 +118,8 @@ distclean: clean docclean
#check: all ${TEST_RUNNER}
# ${TEST_RUNNER}
check: all
# $(MAKE) -C ../storageServer transtest
#-------------------------------------------------------------------------------
# Specific targets
#-------------------------------------------------------------------------------
@ -136,25 +135,6 @@ ${TMP_DIR}:
${DOXYGEN_DIR}:
${MKDIR} ${DOXYGEN_DIR}
${STOR_DIR}:
${MKDIR} ${STOR_DIR}
chown .${HTTP_GROUP} ${STOR_DIR}
chmod g+ws ${STOR_DIR}
${ACCESS_DIR}:
${MKDIR} ${ACCESS_DIR}
chown .${HTTP_GROUP} ${ACCESS_DIR}
chmod g+ws ${ACCESS_DIR}
${TRANS_DIR}:
${MKDIR} ${TRANS_DIR}
chown .${HTTP_GROUP} ${TRANS_DIR}
chmod g+ws ${TRANS_DIR}
${BUFF_DIR}:
${MKDIR} ${BUFF_DIR}
chmod g+w ${BUFF_DIR}
${TEST_RUNNER}:
#-------------------------------------------------------------------------------

View File

@ -0,0 +1,44 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2004 Media Development Loan Fund
#
# This file is part of the LiveSupport project.
# http://livesupport.campware.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# LiveSupport is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# LiveSupport is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LiveSupport; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
# Author : $Author: tomas $
# Version : $Revision: 1.1 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/bin/getUrl.sh,v $
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# This script grabs string at suplied URL
#-------------------------------------------------------------------------------
URL=$1
RES=`curl -sf ${URL}` || \
{
ERN=$?;
if [ $ERN == 22 ] ; then
echo "ERROR: curl: 22 - wrong URL ($URL)";
else
echo "ERROR: $ERN - unknown";
fi;
exit 1;
}
echo $RES

View File

@ -0,0 +1,59 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2004 Media Development Loan Fund
#
# This file is part of the LiveSupport project.
# http://livesupport.campware.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# LiveSupport is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# LiveSupport is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LiveSupport; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
# Author : $Author: tomas $
# Version : $Revision: 1.1 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/bin/setupDirs.sh,v $
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# This script does httpd writeable directories setup
#-------------------------------------------------------------------------------
WWW_ROOT=`cd var/install; php -q getWwwRoot.php` || exit $?
echo "# archiveServer root URL: $WWW_ROOT"
HTTP_GROUP=`bin/getUrl.sh $WWW_ROOT/install/getGname.php` || \
{
ERN=$?;
echo $HTTP_GROUP;
echo " -> Probably wrong setting in var/conf.php: URL configuration";
exit $ERN;
}
echo "# group running http daemon: $HTTP_GROUP"
for i in $*
do
echo "mkdir $i"
mkdir -p $i || exit $?
chown :$HTTP_GROUP $i || \
{
ERN=$?;
echo " -> You should have permissions to set group owner to group $HTTP_GROUP";
exit $ERN;
}
chmod g+sw $i || exit $?
done
echo "# Directories setup finished OK"
exit 0

View File

@ -5,7 +5,7 @@ Install steps for file uploading (do it with appropriate changes):
2) move put.cgi there from var subdir
3) add to apache2 config (i.g. commonapache2.conf):
<Location /livesupport/modules/archiveServer/var/trans>
<Location /livesupportArchiveServer/trans>
Script PUT /cgi-bin-put/put.cgi
</Location>
ScriptAlias /cgi-bin-put/ "/usr/local/apache2/cgi-bin-put/"
@ -31,5 +31,9 @@ For running archiveServer on different HW then storageServer:
- check if include_path in php.ini points to PEAR too
(/usr/lib/php or /usr/local/lib/php)
- setup var/conf.php - at least "basic configuration" part
- create symlink with name corresponding to "URL configuration" part
of var/conf.php file - example for default values:
http://localhost:80/livesupportArchiveServer/ should point to
<livesupport-cvs>/modules/archiveServer/var directory
- run 'make check' to: setup directories, create db tables and run test scripts
OR 'make all' without tests

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $
Version : $Revision: 1.3 $
Version : $Revision: 1.4 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/conf.php,v $
------------------------------------------------------------------------------*/
@ -65,12 +65,12 @@ $config = array(
/* ==================================================== URL configuration */
// on central archive side: storage=archive !
'storageUrlPath' => '/livesupport/modules/archiveServer/var',
'storageUrlPath' => '/livesupportArchiveServer',
'storageXMLRPC' => 'xmlrpc/xrArchive.php',
'storageUrlHost' => 'localhost',
'storageUrlPort' => 80,
// only for returning right URLs:
'archiveUrlPath' => '/livesupport/modules/archiveServer/var',
'archiveUrlPath' => '/livesupportArchiveServer',
'archiveXMLRPC' => 'xmlrpc/xrArchive.php',
'archiveUrlHost' => 'localhost',
'archiveUrlPort' => 80,

View File

@ -0,0 +1,39 @@
<?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
LiveSupport is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: tomas $
Version : $Revision: 1.1 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/install/getGname.php,v $
------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------
* This (web-callable) script returns group running httpd
*----------------------------------------------------------------------------*/
header("Content-type: text/plain");
$egid = posix_getegid();
$info = posix_getgrgid($egid);
echo $info['name'];
?>

View File

@ -0,0 +1,39 @@
<?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
LiveSupport is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: tomas $
Version : $Revision: 1.1 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/install/getWwwRoot.php,v $
------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------
* This script returns storage root URL
*----------------------------------------------------------------------------*/
header("Content-type: text/plain");
require "../conf.php";
echo "http://{$config['storageUrlHost']}:{$config['storageUrlPort']}".
"{$config['storageUrlPath']}";
?>

View File

@ -0,0 +1,39 @@
<?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
LiveSupport is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: tomas $
Version : $Revision: 1.1 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/install/getXrUrl.php,v $
------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------
* This script returns storage XMLRPC root URL
*----------------------------------------------------------------------------*/
header("Content-type: text/plain");
require "../conf.php";
echo "http://{$config['storageUrlHost']}:{$config['storageUrlPort']}".
"{$config['storageUrlPath']}/{$config['storageXMLRPC']}";
?>

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $
Version : $Revision: 1.2 $
Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/install/install.php,v $
------------------------------------------------------------------------------*/
@ -36,51 +36,53 @@ function errCallback($err)
if(assert_options(ASSERT_ACTIVE)==1) return;
echo "ERROR:\n";
echo "request: "; print_r($_REQUEST);
echo "gm:\n".$err->getMessage()."\ndi:\n".$err->getDebugInfo()."\nui:\n".$err->getUserInfo()."\n</pre>\n";
exit;
echo "gm:\n".$err->getMessage()."\ndi:\n".$err->getDebugInfo().
"\nui:\n".$err->getUserInfo()."\n</pre>\n";
exit(1);
}
PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s<hr>\n");
$dbc = DB::connect($config['dsn'], TRUE);
if(PEAR::isError($dbc)){
echo "Database connection problem.\n";
echo "Check if database '{$config['dsn']['database']}' exists with corresponding permissions.\n";
echo "Database access is defined by 'dsn' values in conf.php.\n";
exit;
echo "Check if database '{$config['dsn']['database']}' exists".
" with corresponding permissions.\n";
echo "Database access is defined by 'dsn' values in var/conf.php.\n";
exit(1);
}
$dbc->setFetchMode(DB_FETCHMODE_ASSOC);
$gb = &new GreenBox(&$dbc, $config);
echo "Archive: Install ...\n";
echo "\n# archiveServer: Install ...\n";
$dbc->setErrorHandling(PEAR_ERROR_RETURN);
$gb->uninstall();
PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s<hr>\n");
$gb->install();
echo " Testing ...\n";
echo "# Testing ...\n";
$gb->test();
$log = $gb->test_log;
echo " TESTS:\n$log\n---\n";
echo " TESTS:\n{$log}";
#echo " Reinstall + testdata insert ...\n";
#echo "# Reinstall + testdata insert ...\n";
#$gb->reinstall();
#$gb->sessid = $gb->login('root', $gb->config['tmpRootPass']);
#$gb->testData();
#$gb->logout($gb->sessid); unset($gb->sessid);
echo " TREE DUMP:\n";
echo $gb->dumpTree();
#echo "# TREE DUMP:\n";
#echo $gb->dumpTree();
echo " Delete test data ...\n";
echo "# Delete test data ...\n";
$gb->deleteData();
if(!($fp = @fopen($config['storageDir']."/_writeTest", 'w')))
echo "\n<b>!!! make {$config['storageDir']} dir webdaemon-writeable !!!</b>\nand run install again\n\n";
echo "\n<b>make {$config['storageDir']} dir webdaemon-writeable</b>".
"\nand run install again\n\n";
else{
fclose($fp); unlink($config['storageDir']."/_writeTest");
echo "\nArchive is probably installed OK\n";
echo "#archiveServer install: OK\n\n";
}
$dbc->disconnect();

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $
Version : $Revision: 1.1 $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/install/uninstall.php,v $
------------------------------------------------------------------------------*/
@ -36,8 +36,9 @@ function errCallback($err)
if(assert_options(ASSERT_ACTIVE)==1) return;
echo "ERROR:\n";
echo "request: "; print_r($_REQUEST);
echo "gm:\n".$err->getMessage()."\ndi:\n".$err->getDebugInfo()."\nui:\n".$err->getUserInfo()."\n</pre>\n";
exit;
echo "gm:\n".$err->getMessage()."\ndi:\n".$err->getDebugInfo().
"\nui:\n".$err->getUserInfo()."\n</pre>\n";
exit(1);
}
@ -45,16 +46,17 @@ PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s<hr>\n");
$dbc = DB::connect($config['dsn'], TRUE);
if(PEAR::isError($dbc)){
echo "Database connection problem.\n";
echo "Check if database '{$config['dsn']['database']}' exists with corresponding permissions.\n";
echo "Check if database '{$config['dsn']['database']}' exists".
" with corresponding permissions.\n";
echo "Database access is defined by 'dsn' values in conf.php.\n";
exit;
exit(1);
}
$dbc->setFetchMode(DB_FETCHMODE_ASSOC);
$gb = &new GreenBox(&$dbc, $config);
# $dbc->setErrorHandling(PEAR_ERROR_RETURN);
echo "Trying to uninstall Archive ...\n";
echo "# Trying to uninstall archiveServer ...\n";
$gb->uninstall();
$dbc->disconnect();

View File

@ -23,7 +23,7 @@
#
#
# Author : $Author: tomas $
# Version : $Revision: 1.1 $
# Version : $Revision: 1.2 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/xmlrpc/testRunner.sh,v $
#-------------------------------------------------------------------------------
@ -31,8 +31,8 @@ COMM=$1
shift
GUNID=$1
XMLRPC=http://localhost:80/livesupport/modules/archiveServer/var/xmlrpc/xrArchive.php
echo "XMLRPC server URL (check it in troubles):"
XMLRPC=`cd var/install; php -q getXrUrl.php` || exit $?
echo " archiveServer XMLRPC URL:"
echo $XMLRPC
TESTDIR=`dirname $0`

View File

@ -20,7 +20,7 @@
#
#
# Author : $Author: tomas $
# Version : $Revision: 1.4 $
# Version : $Revision: 1.5 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/Attic/Makefile,v $
#
# @configure_input@
@ -62,17 +62,13 @@ USR_LIB_DIR = ${USR_DIR}/lib
DOXYGEN_CONFIG = ${ETC_DIR}/doxygen.config
GET_GNAME = install/getGname.php
WWW_ROOT := $(shell cd var/install; php -q getWwwRoot.php)
HTTP_GROUP := $(shell curl -s ${WWW_ROOT}/${GET_GNAME})
PHP_DIR = ${BASE_DIR}/var
INSTALL_DIR = ${PHP_DIR}/install
STOR_DIR = ${PHP_DIR}/stor
ACCESS_DIR = ${PHP_DIR}/access
TRANS_DIR = ${PHP_DIR}/trans
BUFF_DIR = ${STOR_DIR}/buffer
TEST_RUNNER = ${PHP_DIR}/xmlrpc/testRunner.sh
PHP_DIR = ${BASE_DIR}/var
INSTALL_DIR = ${PHP_DIR}/install
STOR_DIR = ${PHP_DIR}/stor
ACCESS_DIR = ${PHP_DIR}/access
TRANS_DIR = ${PHP_DIR}/trans
BUFF_DIR = ${STOR_DIR}/buffer
TEST_RUNNER = ${PHP_DIR}/xmlrpc/testRunner.sh
#-------------------------------------------------------------------------------
# Configuration parameters
@ -97,9 +93,10 @@ TEST_RUNNER = ${PHP_DIR}/xmlrpc/testRunner.sh
db_init db_clean transtest
all: dir_setup db_init
$(MAKE) -C ../archiveServer all
# $(MAKE) -C ../archiveServer all
dir_setup: ${DOXYGEN_DIR} ${STOR_DIR} ${ACCESS_DIR} ${TRANS_DIR}
dir_setup: ${DOXYGEN_DIR}
bin/setupDirs.sh ${STOR_DIR} ${ACCESS_DIR} ${TRANS_DIR} ${BUFF_DIR}
doc:
${DOXYGEN} ${DOXYGEN_CONFIG}
@ -113,7 +110,7 @@ docclean:
${RMDIR} ${DOXYGEN_DIR}/html
depclean: clean
$(MAKE) -C ../archiveServer clean
# $(MAKE) -C ../archiveServer clean
dist:
${TAR_C} ${MODULE_NAME}${DATE}${DIST_EXT} *
@ -122,19 +119,15 @@ distclean: clean docclean
check: all ${TEST_RUNNER}
${TEST_RUNNER}
$(MAKE) transtest
# $(MAKE) transtest
#-------------------------------------------------------------------------------
# Specific targets
#-------------------------------------------------------------------------------
transtest:
@echo "Transfer module test (needs ArchiveServer installed):"
cd var/tests; php -q transTest.php
db_init:
@echo "Settings:"
@echo "Http daemon group: ${HTTP_GROUP}"
@echo "WWW root: ${WWW_ROOT}"
cd var/install; php -q install.php
db_clean:
@ -146,29 +139,11 @@ ${TMP_DIR}:
${DOXYGEN_DIR}:
${MKDIR} ${DOXYGEN_DIR}
${STOR_DIR}:
@echo "Http daemon group: ${HTTP_GROUP}"
@echo "You should be in this group for easy testing"
${MKDIR} ${STOR_DIR}
chown .${HTTP_GROUP} ${STOR_DIR}
chmod g+ws ${STOR_DIR}
${ACCESS_DIR}:
${MKDIR} ${ACCESS_DIR}
chown .${HTTP_GROUP} ${ACCESS_DIR}
chmod g+ws ${ACCESS_DIR}
${TRANS_DIR}:
${MKDIR} ${TRANS_DIR}
chown .${HTTP_GROUP} ${TRANS_DIR}
chmod g+ws ${TRANS_DIR}
${BUFF_DIR}:
${MKDIR} ${BUFF_DIR}
chmod g+w ${BUFF_DIR}
${TEST_RUNNER}:
testonly: ${TEST_RUNNER}
${TEST_RUNNER}
#-------------------------------------------------------------------------------
# Pattern rules
#-------------------------------------------------------------------------------

View File

@ -0,0 +1,44 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2004 Media Development Loan Fund
#
# This file is part of the LiveSupport project.
# http://livesupport.campware.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# LiveSupport is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# LiveSupport is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LiveSupport; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
# Author : $Author: tomas $
# Version : $Revision: 1.1 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/bin/getUrl.sh,v $
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# This script grabs string at suplied URL
#-------------------------------------------------------------------------------
URL=$1
RES=`curl -sf ${URL}` || \
{
ERN=$?;
if [ $ERN == 22 ] ; then
echo "ERROR: curl: 22 - wrong URL ($URL)";
else
echo "ERROR: $ERN - unknown";
fi;
exit 1;
}
echo $RES

View File

@ -0,0 +1,59 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2004 Media Development Loan Fund
#
# This file is part of the LiveSupport project.
# http://livesupport.campware.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# LiveSupport is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# LiveSupport is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LiveSupport; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
# Author : $Author: tomas $
# Version : $Revision: 1.1 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/bin/setupDirs.sh,v $
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# This script does httpd writeable directories setup
#-------------------------------------------------------------------------------
WWW_ROOT=`cd var/install; php -q getWwwRoot.php` || exit $?
echo "# storageServer root URL: $WWW_ROOT"
HTTP_GROUP=`bin/getUrl.sh $WWW_ROOT/install/getGname.php` || \
{
ERN=$?;
echo $HTTP_GROUP;
echo " -> Probably wrong setting in var/conf.php: URL configuration";
exit $ERN;
}
echo "# group running http daemon: $HTTP_GROUP"
for i in $*
do
echo "mkdir $i"
mkdir -p $i || exit $?
chown :$HTTP_GROUP $i || \
{
ERN=$?;
echo " -> You should have permissions to set group owner to group $HTTP_GROUP";
exit $ERN;
}
chmod g+sw $i || exit $?
done
echo "# Directories setup finished OK"
exit 0

View File

@ -6,6 +6,10 @@
- setup var/conf.php - at least "basic configuration" part
(follow comments in the source - or use doxygen and its output)
- setup archiveServer/var/conf.php too - test scripts will use archive
- create symlink with name corresponding to "URL configuration" part
of var/conf.php file - example for default values:
http://localhost:80/livesupportStorageServer/ should point to
<livesupport-cvs>/modules/storageServer/var directory
- configure apache for archiveServer file upload
(as described in archiveServer/doc/INSTALL)
- run 'make check' to: setup directories, create db tables and run test scripts

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $
Version : $Revision: 1.6 $
Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/GreenBox.php,v $
------------------------------------------------------------------------------*/
@ -48,7 +48,7 @@ require_once "Transport.php";
* LiveSupport file storage module
*
* @author $Author: tomas $
* @version $Revision: 1.6 $
* @version $Revision: 1.7 $
* @see Alib
*/
class GreenBox extends Alib{
@ -717,7 +717,7 @@ class GreenBox extends Alib{
$ac =& StoredFile::recallFromLink(&$this, $acf['tmplink'], $sessid);
$ac->releaseRawMediaData($sessid);
}
parent::logout($sessid);
return parent::logout($sessid);
}
/**
@ -1000,7 +1000,7 @@ class GreenBox extends Alib{
";
$this->test_dump = $this->dumpTree($this->storId);
if($this->test_dump==$this->test_correct)
{ $this->test_log.="Storage: OK\n"; return true; }
{ $this->test_log.="storageServer: OK\n"; return true; }
else PEAR::raiseError('GreenBox::test:', 1, PEAR_ERROR_DIE, '%s'.
"<pre>\ncorrect:\n.{$this->test_correct}.\n".
"dump:\n.{$this->test_dump}.\n</pre>\n");

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $
Version : $Revision: 1.4 $
Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/conf.php,v $
------------------------------------------------------------------------------*/
@ -63,13 +63,13 @@ $config = array(
'accessDir' => dirname(getcwd()).'/access',
/* ==================================================== URL configuration */
'storageUrlPath' => '/livesupport/modules/storageServer/var',
'storageUrlPath' => '/livesupportStorageServer',
'storageXMLRPC' => 'xmlrpc/xrLocStor.php',
'storageUrlHost' => 'localhost',
'storageUrlPort' => 80,
/* ================================================ archive configuration */
'archiveUrlPath' => '/livesupport/modules/archiveServer/var',
'archiveUrlPath' => '/livesupportArchiveServer',
'archiveXMLRPC' => 'xmlrpc/xrArchive.php',
'archiveUrlHost' => 'localhost',
'archiveUrlPort' => 80,

View File

@ -1,6 +1,38 @@
<?
<?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
LiveSupport is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: tomas $
Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/install/getGname.php,v $
------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------
* This (web-callable) script returns group running httpd
*----------------------------------------------------------------------------*/
header("Content-type: text/plain");
# $gid = posix_getgid();
$egid = posix_getegid();
$info = posix_getgrgid($egid);
echo $info['name'];

View File

@ -1,4 +1,37 @@
<?
<?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
LiveSupport is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: tomas $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/install/getWwwRoot.php,v $
------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------
* This script returns storage root URL
*----------------------------------------------------------------------------*/
header("Content-type: text/plain");
require "../conf.php";
echo "http://{$config['storageUrlHost']}:{$config['storageUrlPort']}".

View File

@ -1,4 +1,37 @@
<?
<?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
LiveSupport is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: tomas $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/install/getXrUrl.php,v $
------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------
* This script returns storage XMLRPC root URL
*----------------------------------------------------------------------------*/
header("Content-type: text/plain");
require "../conf.php";
echo "http://{$config['storageUrlHost']}:{$config['storageUrlPort']}".

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $
Version : $Revision: 1.4 $
Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/install/install.php,v $
------------------------------------------------------------------------------*/
@ -36,57 +36,60 @@ function errCallback($err)
if(assert_options(ASSERT_ACTIVE)==1) return;
echo "ERROR:\n";
echo "request: "; print_r($_REQUEST);
echo "gm:\n".$err->getMessage()."\ndi:\n".$err->getDebugInfo()."\nui:\n".$err->getUserInfo()."\n</pre>\n";
exit;
echo "gm:\n".$err->getMessage()."\ndi:\n".$err->getDebugInfo().
"\nui:\n".$err->getUserInfo()."\n</pre>\n";
exit(1);
}
PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s<hr>\n");
$dbc = DB::connect($config['dsn'], TRUE);
if(PEAR::isError($dbc)){
echo "Database connection problem.\n";
echo "Check if database '{$config['dsn']['database']}' exists with corresponding permissions.\n";
echo "Database access is defined by 'dsn' values in conf.php.\n";
exit;
echo "Check if database '{$config['dsn']['database']}' exists".
" with corresponding permissions.\n";
echo "Database access is defined by 'dsn' values in var/conf.php.\n";
exit(1);
}
$dbc->setFetchMode(DB_FETCHMODE_ASSOC);
$gb = &new GreenBox(&$dbc, $config);
echo "Storage: Install ...\n";
echo "\n# storageServer: Install ...\n";
$dbc->setErrorHandling(PEAR_ERROR_RETURN);
$gb->uninstall();
PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s<hr>\n");
$gb->install();
echo " Testing ...\n";
echo "# Testing ...\n";
$gb->test();
$log = $gb->test_log;
echo " TESTS:\n$log\n---\n";
echo " TESTS:\n{$log}";
#echo " Reinstall + testdata insert ...\n";
#echo "# Reinstall + testdata insert ...\n";
#$gb->reinstall();
#$gb->sessid = $gb->login('root', $gb->config['tmpRootPass']);
#$gb->testData();
#$gb->logout($gb->sessid); unset($gb->sessid);
echo " TREE DUMP:\n";
echo $gb->dumpTree();
#echo "# TREE DUMP:\n";
#echo $gb->dumpTree();
echo " Delete test data ...\n";
echo "# Delete test data ...\n";
$gb->deleteData();
if(!($fp = @fopen($config['storageDir']."/_writeTest", 'w')))
echo "\n<b>!!! make {$config['storageDir']} dir webdaemon-writeable !!!</b>\nand run install again\n\n";
echo "\n<b>make {$config['storageDir']} dir webdaemon-writeable</b>".
"\nand run install again\n\n";
else{
fclose($fp); unlink($config['storageDir']."/_writeTest");
echo "\nStorage is probably installed OK\n";
echo "#storageServer install: OK\n\n";
}
echo "Install Transport submodule ...\n";
echo "# Install Transport submodule\n";
require_once "../Transport.php";
$tr =& new Transport(&$dbc, $config);
$r = $tr->install();
echo "\n";
$dbc->disconnect();
?>

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $
Version : $Revision: 1.2 $
Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/install/uninstall.php,v $
------------------------------------------------------------------------------*/
@ -36,8 +36,9 @@ function errCallback($err)
if(assert_options(ASSERT_ACTIVE)==1) return;
echo "ERROR:\n";
echo "request: "; print_r($_REQUEST);
echo "gm:\n".$err->getMessage()."\ndi:\n".$err->getDebugInfo()."\nui:\n".$err->getUserInfo()."\n</pre>\n";
exit;
echo "gm:\n".$err->getMessage()."\ndi:\n".$err->getDebugInfo().
"\nui:\n".$err->getUserInfo()."\n</pre>\n";
exit(1);
}
@ -45,19 +46,20 @@ PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s<hr>\n");
$dbc = DB::connect($config['dsn'], TRUE);
if(PEAR::isError($dbc)){
echo "Database connection problem.\n";
echo "Check if database '{$config['dsn']['database']}' exists with corresponding permissions.\n";
echo "Check if database '{$config['dsn']['database']}' exists".
" with corresponding permissions.\n";
echo "Database access is defined by 'dsn' values in conf.php.\n";
exit;
exit(1);
}
$dbc->setFetchMode(DB_FETCHMODE_ASSOC);
$gb = &new GreenBox(&$dbc, $config);
# $dbc->setErrorHandling(PEAR_ERROR_RETURN);
echo "Trying to uninstall storageServer ...\n";
echo "# Trying to uninstall storageServer ...\n";
$gb->uninstall();
echo "Uninstall Tranport submodule ...\n";
echo "# Uninstall Tranport submodule ...\n";
require_once "../Transport.php";
$tr =& new Transport(&$dbc, $config);
$r = $tr->uninstall();

View File

@ -1,6 +1,34 @@
<?
<?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
LiveSupport is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: tomas $
Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/tests/transTest.php,v $
------------------------------------------------------------------------------*/
header("Content-type: text/plain");
echo "\nTransport test\n\n";
echo "\n# archiveServer transport test:\n";
require_once '../conf.php';
require_once 'DB.php';
@ -16,22 +44,38 @@ $gunid = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA';
$mediaFile = '../tests/ex1.mp3';
$mdataFile = '../tests/mdata1.xml';
echo"login: ".($sessid = $gb->login('root', 'q'))."\n";
echo"# Login: ".($sessid = $gb->login('root', 'q'))."\n";
echo"Store:\n";
$r = $gb->storeAudioClip($sessid, $gunid, $mediaFile, $mdataFile); var_dump($r);
echo"# Store: ";
$r = $gb->storeAudioClip($sessid, $gunid, $mediaFile, $mdataFile);
if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."\n"; exit(1); }
echo "$r\n";
echo"Upload:\n"; $r = $gb->uploadFile('', $gunid, $sessid); var_dump($r);
echo"# Upload: "; $r = $gb->uploadFile('', $gunid, $sessid);
if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."\n"; exit(1); }
echo join(', ',$r)."\n";
echo"Cron:\n"; $r = $gb->cronJob(); var_dump($r);
echo"# Cron: "; list($r1, $r2) = $gb->cronJob();
if(PEAR::isError($r1)){ echo "ERROR: ".$r1->getMessage()."\n"; exit(1); }
if(PEAR::isError($r2)){ echo "ERROR: ".$r2->getMessage()."\n"; exit(1); }
echo "$r1, $r2\n";
echo"Delete:\n"; $r = $gb->deleteAudioClip($sessid, $gunid); var_dump($r);
echo"# Delete: "; $r = $gb->deleteAudioClip($sessid, $gunid);
if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."\n"; exit(1); }
echo "$r\n";
echo"Download:\n"; $r = $gb->downloadFile($gunid, $sessid); var_dump($r);
echo"# Download: "; $r = $gb->downloadFile($gunid, $sessid);
if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."\n"; exit(1); }
echo join(', ',$r)."\n";
echo"Cron:\n"; $r = $gb->cronJob(); var_dump($r);
echo"# Cron: "; $r = $gb->cronJob();
if(PEAR::isError($r1)){ echo "ERROR: ".$r1->getMessage()."\n"; exit(1); }
if(PEAR::isError($r2)){ echo "ERROR: ".$r2->getMessage()."\n"; exit(1); }
echo "$r1, $r2\n";
echo"logout: ".($r = $gb->logout($sessid))."\n";
echo"# logout: "; $r = $gb->logout($sessid);
if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."\n"; exit(1); }
echo "$r\n";
echo"\n";
echo "#Transport test: OK.\n\n"
?>

View File

@ -23,7 +23,7 @@
#
#
# Author : $Author: tomas $
# Version : $Revision: 1.4 $
# Version : $Revision: 1.5 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/testRunner.sh,v $
#-------------------------------------------------------------------------------
@ -31,74 +31,73 @@ COMM=$1
shift
GUNID=$1
#XMLRPC=http://localhost:80/livesupport/modules/storageServer/var/xmlrpc/xrLocStor.php
XMLRPC=`cd var/install; php -q getXrUrl.php`
echo "XMLRPC server URL (check it in troubles):"
echo $XMLRPC
echo ""
XMLRPC=`cd var/install; php -q getXrUrl.php` || exit $?
echo "# storageServer XMLRPC URL: $XMLRPC"
TESTDIR=`dirname $0`
XR_CLI="$TESTDIR/xr_cli_test.py -s $XMLRPC"
XR_CLI="$TESTDIR/xr_cli_test.py -s ${XMLRPC}"
login() {
echo "login:"
SESSID=`$XR_CLI login root q`
echo -n "# login: "
SESSID=`$XR_CLI login root q` || exit $?
echo "sessid: $SESSID"
}
test() {
echo "test:"
$XR_CLI test $SESSID stringForUppercase
echo "# test: "
$XR_CLI test $SESSID stringForUppercase || exit $?
}
existsAudioClip() {
echo "existsAudioClip:"
$XR_CLI existsAudioClip $SESSID $GUNID
echo "# existsAudioClip: "
$XR_CLI existsAudioClip $SESSID $GUNID || exit $?
}
accessRawAudioData() {
echo "accessRawAudioData:"
FPATH=`$XR_CLI accessRawAudioData $SESSID $GUNID`
echo "# accessRawAudioData: "
FPATH=`$XR_CLI accessRawAudioData $SESSID $GUNID` || exit $?
FPATH="<?echo urldecode(\"$FPATH\")?>"
FPATH=`echo "$FPATH" | php -q`
echo $FPATH
ls -l $FPATH
echo "releaseRawAudioData:"
$XR_CLI releaseRawAudioData $SESSID $FPATH
# ls -l $FPATH
echo -n "# releaseRawAudioData: "
$XR_CLI releaseRawAudioData $SESSID $FPATH || exit $?
#$XR_CLI getAudioClip $SESSID $GUNID
}
storeAudioClip() {
echo "storeAudioClip:"
echo -n "# storeAudioClip: "
MEDIA=../tests/ex1.mp3
METADATA=../tests/testStorage.xml
RGUNID=`$XR_CLI storeAudioClip "$SESSID" '' "$MEDIA" "$METADATA"`
RGUNID=`$XR_CLI storeAudioClip "$SESSID" '' "$MEDIA" "$METADATA"` || exit $?
echo $RGUNID
}
deleteAudioClip() {
echo "deleteAudioClip:"
$XR_CLI deleteAudioClip $SESSID $GUNID
echo -n "# deleteAudioClip: "
$XR_CLI deleteAudioClip $SESSID $GUNID || exit $?
}
updateAudioClipMetadata() {
echo "updateAudioClipMetadata:"
$XR_CLI updateAudioClipMetadata $SESSID $GUNID '../tests/mdata3.xml'
echo -n "#updateAudioClipMetadata: "
$XR_CLI updateAudioClipMetadata $SESSID $GUNID '../tests/mdata3.xml' || exit $?
}
getAudioClip() {
echo "getAudioClip:"
$XR_CLI getAudioClip $SESSID $GUNID | $TESTDIR/urldecode
echo -n "#getAudioClip: "
$XR_CLI getAudioClip $SESSID $GUNID | $TESTDIR/urldecode || exit $?
}
searchMetadata() {
echo "searchMetadata:"
# $XR_CLI searchMetadata $SESSID '../tests/srch_cri1.xml'
$XR_CLI searchMetadata $SESSID 'John %'
echo -n "# searchMetadata: "
# $XR_CLI searchMetadata $SESSID '../tests/srch_cri1.xml' || exit $?
$XR_CLI searchMetadata $SESSID 'John %' || exit $?
}
logout() {
echo "logout:"
$XR_CLI logout $SESSID
echo -n "# logout: "
$XR_CLI logout $SESSID || exit $?
}
usage(){
@ -147,6 +146,8 @@ elif [ "x$COMM" == "x" ]; then
accessRawAudioData
deleteAudioClip
logout
echo "#XMLRPC tests: OK."
echo ""
elif [ "$COMM" == "help" ]; then
usage
else