GOCDB/Regional Module Technical Documentation
|Main||EGI.eu operations services||Support||Documentation||Tools||Activities||Performance||Technology||Catch-all Services||Resource Allocation||Security|
|GOC DB menu:||Home •||Documentation Index •|
This page is the main install documentation for GOCDB Version 5
LATEST VERSION: GOCDBv5
- A packaged V5 release will also be made available for download soon.
- In the meantime, early adopters can check out the v5 src from svn:
svn checkout https://www.sysadmin.hep.ac.uk/svn/grid-monitoring/branches/gocdb/Doctrine%20Web%20Portal
Note, if you are asked to authenticate with a client certificate as below, you can dismiss by pressing Enter
Authentication realm: https://www.sysadmin.hep.ac.uk:443 Client certificate filename: <ENTER to dismiss>
OLD v4.4 Install doc has been relocated
(Under Construction - more details comming soon)
GOCDB-5 has two components: a database and a web front end. Both components can work on the same machine but it is very likely that in most environments they will be separated. This is what we would advise. Machine requirements for these 2 components are described below.
Version 5 of GocDB uses Doctrine ORM (Object Relational Mapping) as it's interface to the datastore. This allows GocDB to be deployed to either a Oracle, MySQL or SQLite database (Postgres comming soon).
- Required database: Oracle 11g or higher (note: the free Oracle 11g XE Express Editions which comes with a free license is perfectly suitable. 10g may also work but is untested)
- Required space: 150 MB Dowload free Oracle XE from the following link and follow the installation instructions: http://www.oracle.com/technetwork/database/express-edition/overview/index.html
- For gocdb admin tasks, we also recommend the SQL Developer tool.
- Required database: Any version of MySQL will work including the free MySQL Community Server edition
- Required space: See MySQL install guide:http://dev.mysql.com/doc/refman/5.7/en/installing.html
- Required database: SQLite 3.x.x or higher. SQLite is produced as an open source database and all versions are free to use.
- Required: See the SQLite documentation: www.sqlite.org/docs.html
The machine to use as the web frontend will need the following:
- Apache http server version 2.2 or higher.
- PHP version 5.3 or higher (version <=5.2 has some OOP related bugs).
- PHP oci8 extension
- PHP oci8 extension
- a X509 host certificate for the machine
- PHP Unit for testing developments
Preparing your installation
GocDB v5 comes with deploy script which will setup the schema required for GocDB. The only preperation is that you have setup a database in your chosen database provider and have the user access details which are required later in the installation when configuring GocDB for deployment.
GOCDB file system
Place the GocDB source folder on your chosen web server.
Pear is recommended to install Doctrine and PHPUnit, many builds of PHP come pre-bundled with PEAR.
Verify the PEAR installation by running pear version on the command line.
$ pear version PEAR Version: 1.9.4 PHP Version: 5.3.8 Zend Engine Version: 2.3.0 Running on: Windows NT ESCPC0095 6.1 build 7601 (Windows 7 Business Edition Service Pack 1) i586
Doctrine can be installed using PEAR. First add the Doctrine and Symfony channels to PEAR:
$pear channel-discover pear.doctrine-project.org $pear channel-discover pear.symfony.com
Then install Doctrine and it's dependencies:
$pear install --alldeps doctrine/DoctrineORM
Verify the Doctrine installation by running "doctrine --version" on the command line:
$ doctrine --version Doctrine Command Line Interface version 2.3.3
See the possible errors and troubleshooting section if you encounter errors at this point.
Apache http server version 2.2 or higher.
PHPUnit is an optional choice for GOCDB users. GOCDB5 includes a test suite of unit tests that can be used to verify buisness logic and database connections for a deployed instance of GOCDB. In addition developers extending and modifying GOCDB can write unit tests for their own developements. To install PHPUnit use PEAR:
$pear clear-cache $pear config-set auto_discover 1 $pear install pear.phpunit.de/PHPUnit
This install can then be verified using "phpunit --version" on the command line:
$ phpunit --version PHPUnit 3.7.27 by Sebastian Bergmann.
Configuration of the database connection
You should now have all the required blocks in place to deploy GOCDB V5. To Deploy the database schema to your desired database using Doctrine navigate to to gocDBSrc/lib/Doctrine/Deploy folder. In this folder you will configure the database connection details for your database. Depending on the type of database you are using open the bootstrap_doctrine.php file your database:
bootstrap_doctrine.php.mysql -> For MySQL databases bootstrap_doctrine.php.oci -> For Oracle databases bootstrap_doctrine.php.sqlite -> For SQLite databases
In the bootstrap_doctrine file complete the connection details for your database.
$conn = array( 'driver' => 'oci8', 'user' => 'doctrine', 'password' => 'password', 'host' => 'localhost', 'port' => 1521, /*'service' = true,*/ 'dbname' => 'XE' ); # Note, you may need to add 'service' = true as commented out above depending on your Oracle server
$conn = array( 'driver' => 'pdo_mysql', 'user' => 'Doctrine', 'password' => 'password', 'host' => '127.0.0.1', 'dbname' => 'doctrine' );
$conn = array( 'driver' => 'pdo_sqlite', 'path' => __DIR__ . '/db.sqlite', );
Note: Doctrine can use APC caching however this is not suitable for all deployments. To disable comment out the APC configuration lines within the bootstrap_doctrine.php file:
$config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ApcCache()); $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ApcCache());
To deploy GocDB can be deployed as a blank instance ready for use of as a sample instance with a small set of example data to demonstrate GocDB. There are three deploy scripts provided for each database supported, these can be found in the /lib/Doctrine/deploy folder:
oracleDeploy.sh mysqlDeploy.sh sqliteDeploy.sh
By supplying a flag when executing the script you can deploy either a new empty database or a sample database eg:
$ ./oracleDeploy.sh -s Deploying GocDB with sample data
$ ./oracleDeploy.sh -n Deploying new empty GocDB instance
Now that your database is deployed the final step is to configure Apache.
A few modules need to be enabled for GOCDB to work, check these are enabled on your Apache and if not enable them.
In httpd.conf enable ssl_module by un-commenting these lines:
LoadModule ssl_module modules/mod_ssl.so
Depending on the database you are using the supporting module may also need to be enabled. For example Oracle requires the oracle module to be uncommented:
Take the file gocdbssl.conf and place this file in the apache/conf/extra folder. In httpd.conf include the gocdbssl.con by adding the following line under the heading Supplemental Configuration:
This file defines the location of resources required by GocDB.
The first step is to setup the paths for the DocumentRoot, ErrorLog and TransferLog and define the ServerName and ServerAdmin details for your particular web service where you are hosting GocDB.
The SSLCertificateFile should point to the location of your server SSL key file. The SSLCertificateKeyFile -- The SSLCACertificationPath should point to the location of your CA certificates which can be obtained from: //Ask Dave
For development the SSLCertificatedFile and SSLCertificateKeyFile can be self signed certificates. However these must not be used in production.
The final step is to set the Alias to map your desired directory for GocDB webportal and Programmatic Interface (PI) to the correct folder and ensure the correct rules are defined for your server.
For the webportal the following settings are an example:
Alias "/portal" "/gocDBsrc/htdocs/web_portal" <Directory "/gocDBsrc/htdocs/web_portal"> SSLVerifyClient require Options FollowSymLinks Indexes Order deny,allow Allow from 127.0.0.1 deny from all </Directory>
The alias should and file location should also be set for the public PI and private PI. Public PI:
Alias "/gocdbpi/public" "/gocDBsrc/htdocs/PI/public" <Directory "/gocDBsrc/htdocs/PI/public">
Alias "/gocdbpi/private" "/gocDBsrc/htdocs/PI/private" <Directory "/gocDBsrc/htdocs/PI/private">
You should now be able to navigate to the GocDB webportal on your host using the URL defined in your alias. You will need to install a browser certificate that is suitable for the SSL keys you defined for your host to be able to view GocDB.
GocDB v5 comes with a suite of tests that can be run to validate the install and check that Doctrine and your chosen database are operating as expected. These tests require PHPUnit, the install instructions for this can be found in section 3.6. The tests can be found in the GocDB/tests/ folder.
Deploying a Test Database
We recommend that you deploy a second database that will be used for testing. Once you have created your second database input the connection details into the bootstrap_doctrine.php file found in GocDB/tests/doctrine. Within this file there are 3 sets of connection configurations, once for MySQL, Oracle and SQLite. Complete the section for your database and ensure that the other connection details are deleted or commented out. In addition to the standard Doctrine connection to the database the tests make use of a PDO connection to validate that the results that Doctrine is returning are true. To setup the pdo connection open 'bootstrap_pdo.php'. Within this file you will again find 3 connection blocks. Complete the details for the connection details for your database and ensure that the other 2 connections are either deleted or commented out.
Un-comment the area for your chosen database and fill in the details for your chosen database. ///////////////////////SQLITE CONNECTION DETAILS///////////////////////////////////////////// // $sqliteFile = __DIR__ . '/../db.sqlite'; // $pdo = new PDO("sqlite:" . $sqliteFile); // return new PHPUnit_Extensions_Database_DB_DefaultDatabaseConnection($pdo, 'sqlite'); ///////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////ORACLE CONNECTION DETAILS///////////////////////////////////////////// // $pdo = new PDO('oci:dbname=//localhost:1521/xe', 'DoctrineUnitTests', 'doc'); // return new PHPUnit_Extensions_Database_DB_DefaultDatabaseConnection($pdo, 'USERS'); ///////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////MYSQL CONNECTION DETAILS////////////////////////////////////////////// // $pdo = new PDO('mysql:host=localhost;dbname=doctrine;charset=UTF8', 'doctrine', 'doc'); // return new PHPUnit_Extensions_Database_DB_DefaultDatabaseConnection($pdo); /////////////////////////////////////////////////////////////////////////////////////////////
Running the Test Suite
A initial test suite is provided that will excercise core functions of GocDB and Doctrine, this suite can be ran using the command:
You will be prompted to continue as this operation will drop any tables in your test database and then recreate the schema ready to run the tests. These tests should return with no errors to demonstrate that GocDB and Doctrine are installed correctly and are working as expected.
Running Individual Tests
Individual tests can be run by calling phpunit testName.php. It is advised that at the beginning of a testing session you drop and recreate the database by running:
Found in the GocDB/tests/doctrine folder.
If you intend to develop new functionality for your instance of GocDB you can support this development by writing unit tests for the new features. A simple example of a test can be found in GocDB/tests/exampleTests. 'FirstTest.php' demonstrates how to create data and assert that it is as expected.
A good tutorial for getting started with PHPUnit can be found here.
Writing a Doctrine Test
When working with Doctrine there are a number of setup functions that needed to be included in your test file. A template file has been provided in GocDBSrc/tests/exampleTests called 'DoctrineTestTemplate.php'. When executing any tests based on this template two files need to be present in the same folder as the test being executed:
The first holds your connection details and the second will initialize the database with the correct tables ready for testing.
You can write multiple test functions at the bottom of this skeleton file.