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`