GridSphere User's Guide


Table of Contents

Introduction
Required Tools and Applications
Download GridSphere
Bundled Software Packages
Installing Jakarta Ant
Installing Jakarta Tomcat
Configuration
GridSphere core services
Initialized Portlet Web Applications
Portal Layout Configuration
Database Configuration
Messaging Configuration
Deployment GridSphere
Database configuration
Support for the Jetty servlet container
Updating from earlier GridSphere
Logging and Debugging
Configuring the Portal URL
Redeploying a customized portal
Running GridSphere with Apache httpd2 and mod_jk
Additional Resources

Introduction

The GridSphere User's Guide describes how to install and configure GridSphere. For more information on developing and packaging portlets, please consult the GridSphere PortletReference Guide and the GridSphere Tutorials. The current implementation is based upon the GridSphere Technical Design Document. The GridSphere portal framework comes in both source and binary forms. Binaries can be created from the source code and in both cases, the build environment is generally the same. The GridSphere source code comes with a README file explaining how to build the binary distribution. Both source and binaries come packaged with all the necessary third party libraries and requires a GridSphere compatible servlet container, currently Tomcat 4.1+ and Tomcat 5 are supported

Required Tools and Applications

  • JDK 1.4.2+http://java.sun.com/j2se

  • Jakarta Ant 1.6+ Ant is used to compile and deploy the GridSphere framework

  • Jakarta Tomcat Servlet Container Tomcat 4.1+, Tomcat 5.0.25+, is required. (Currently, only Tomcat fully supports the Manager web application that allows for dynamic portlet management.) (Make sure you get the full Tomcat version and not the Light Edition (LE))

Download GridSphere

You should download the latest source code release of GridSphere at http://www.gridsphere/gridsphere/gridsphere?cid=download and unzip/tar it.

Bundled Software Packages

GridSphere uses many quality open source libraries listed below for completeness: It is not recommended to replace the bundled libaries.

  • Castor is used to provide Java to XML bindings

  • Hibernate is used to provide SQL based database support

  • JUnit provides a unit testing framework

  • Cactus provides a unit testing framework for testing GridSphere in a servlet container

  • Log4J provides an optimized logging library

  • Hypersonic SQL database provides a pure Java SQL database

  • Jakarta Commons utility classes for performing file uploads, etc.

  • Xalan is used for XSLT processing

Installing Jakarta Ant

In order to build the source distribution or deploy GridSphere to a Tomcat servlet container, you will need to download Jakarta Ant. Ant is also used to run the unit tests.

  1. Download Ant 1.6+ distribution

  2. Unzip ant into your preferred location and set the ANT_HOME environment to point to this location

  3. Copy junit-3.8.1.jar from your GRIDSPHERE_HOME/lib into ANT_HOME/lib (only necessary if you want to run the tests)

  4. Add ANT_HOME/bin to your PATH environment

Installing Jakarta Tomcat

The Jakarta Tomcat servlet container is required to provide a hosting environment for the GridSphere framework. Make sure you install both Tomcat and GridSphere with normal user permissions or consider creating a special portal user and installing under the portal user id.

  1. Download Jakarta Tomcat distribution (Tomcat 4.1+ or Tomcat 5.0.25+. If you use Tomcat 5.5+ download also the Tomcat's packages: Admin, Deployer and Compat )

  2. Unzip tomcat into your preferred location and set the CATALINA_HOME environment to point to this location

    [Important]Important
    If using Windows, set the path with backslashes e.g C:\MyApps\MyTomcat-4.29!

  3. The Portlet Manager Portlet requires the Tomcat manager webapp to be configured to allow the gridsphere user to manage web applications. You must modify $CATALINA_HOME/conf/tomcat-users.xml and create a user with the manger and admin role. An example is shown:

    <user username="gridsphere" password="gridsphere" roles="manager,admin"/>

    You must edit the file webapps/gridsphere/WEB-INF/GridSphereServices.xml and edit the user name and password used in the first Portlet Manager Service entry to be the name and password used in the tomcat-users.xml.

    To ensure that clients can't access the manager webapp directly, add as a child of <host> $CATALINA_HOME/conf/server.xml the following where $CATALINA_HOME is replaced with the actual path to Tomcat e.g. "/usr/local/tomcat":

    <Context path="/manager" debug="0" privileged="true" docBase="$CATALINA_HOME/server/webapps/manager"> <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127.0.0.1"/> </Context>

    [Important]Important
    Make sure there are no line-breaks between beginning and closing tags!

    In addition if you are running the portal using HTTPS, then you must import your server's credentials into your java keystore in order for the application manager to work. You can do this using the Java keytool tool as in the following:

                            

    keytool -keystore $JAVA_HOME/jre/lib/security/cacerts -import -file $DER_OR_PEM_ENCODED_CA_CERT -alias $SOME_ALIAS SOME_ALIAS is something like 'verisignclass3g2ca' or 'equifaxsecureglobalebusinessca1'.

Configuration

Before deploying GridSphere to a servlet container, various configuration settings can be adjusted to customize layout, database configuration, portlet services and the portlet web applications that are started at run time. Below is a description of the various configuration files and how they are used.

GridSphere core services

Several service options can be configured in

Initialized Portlet Web Applications

When deployed, GridSphere requires access to deployed portlet web applications. Since portlets are packaged according to the web application repository (WAR) format defined in the Java 2.3 Servlet Specification, the names of the WAR files or web applications needs to be added as an empty file whose filename is defined by the name of portlet web application to the $CATALINA_HOME/webapps/gridsphere/WEB-INF/CustomPortal/portlets directory. The filename may contain an additional integer suffix ".#" to ensure a priority when the container will load the portlet application. By default, you will see $CATALINA_HOME/webapps/gridsphere/WEB-INF/CustomPortal/portlets/gridsphere.1 which instructs the container to load the set of core gridsphere portlets first. Below is a sample directory listing showing a deployed GridSphere and a couple additional portlet applications:

Example 1. 

            

%>ls $CATALINA_HOME/webapps/gridsphere/WEB-INF/CustomPortal/portlets/ grid gridsphere.1 jsrtutorial examplets mysamples.2 README-portlets.txt

Portal Layout Configuration

The defined layouts used in GridSphere are found in webapps/gridpshere/WEB-INF/CustomPortal/layouts of your GridSphere distribution and contain the GuestUserLayout.xml which defines the guest layout. Initially before a user has logged in, they will see the layout as presented in GuestUserLayout.xml. The guest layout contains the Login portlet to allow people to login and little else. This file may be edited to provide additional portlets to guest portal users. Group layouts specify the layout for a particular group and are stored in $CATALINA_HOME/webapps/gridsphere/WEB-INF/CustomPortal/layouts/groups. Please see the GridSphere Administartor's Guide for more information on customizing group layouts. Users' layouts are persisted and stored in $CATALINA_HOME/webapps/gridsphere/WEB-INF/CustomPortal/layouts/users. Simply removing any of these layout files will force a new one to be created when a user logs in.

Database Configuration

By default, GridSphere is configured (using Hibernate) to use HSQL pure Java database. To configure GridSphere to use some other database, please edit the gridsphere/webapps/gridsphere/WEB-INF/CustomPortal/database/hibernate.properties before deploying. file and comment out the HSQL lines and uncomment the lines for the database you wish to use. The connection url setting should point to the physical location of your database. The same applies if you want to deploy any 3rd party webapp which uses persistence. In addition, install any 3rd party JDBC jar files needed into $CATALINA_HOME/shared/lib Next, issue "ant create-database" to create the database using the updated configuration. Finally restart the application server.

Messaging Configuration

To take advantage of GridSphere's messaging system you need to edit gridsphere/webapps/WEB-INF/tmfconfig/tmf.xml. Please enable the services and the configuration files for the services you want to use. Currently mail and AOL Aim service are supported. For AIM you need to edit gridsphere/webapps/WEB-INF/tmfconfig/services/aim.xml and fill in the approriate values for the username/password for the aimbot you wish to use. For Mail modification of gridsphere/webapps/WEB-INF/tmfconfig/services/mail.xml with the values of MailServer, Port and Sender is needed. Redeploy gridsphere after making any changes.

Deployment GridSphere

As explained in the INSTALL file, GridSphere relies on Ant for its compilation and deployment. The build script, build.xml provides various targets for compiling, deploying, building javadoc api documentation, creating new portlet projects.

From inside the GridSphere source directory, you should be able to issue:

ant install
which will compile the framework code, create documentation if necessary and deploy GridSphere to a Tomcat container. After the installation completes and you see "BUILD SUCCESFUL", start up the Tomcat container and go to http://127.0.0.1:8080/gridsphere/gridsphere You should now see the running GridSphere portal. If an error occurs, please consult the FAQ and possibly mail the mailing lists if you encounter problems.

Database configuration

Gridsphere is deployed using the HSQL database by default. If you wish to use another hibernate supported database (like mysql, postgresql) you will need to download the required JDBC drivers from the database vendor and put them in the $CATALINA_HOME/shared/lib directory. You are also required to make changes to the $CATALINA_HOME/webapps/gridsphere/CustomPortal/database/hibernate.properties hibernate properties file. Next, issue "ant create-database" to create the database using the updated configuration. Finally restart the application server.

Support for the Jetty servlet container

GridSphere's default installation supports Jakarta's Tomcat servlet container. If you want to use Jetty as webserver for the portal you need to change the build.properties file located in the root of the source directory of GridSphere. Change

gridsphere.appserver=tomcat
            
to
gridsphere.appserver=jetty
            
Furthermore the environment variable CATALINA_HOME is not used, instead you need to define APPSERVER_HOME to point to the installationdirectory of the webserver. In future versions support for other servlet containers might be added. Please substitute all CATALINA_HOME variables used in this guide with APPSERVER_HOME if you are using the Jetty servlet container.

Updating from earlier GridSphere

To update to a recent version of GridSphere, you should first make a backup of your existing GridSphere configuration. To do this backup your $CATALINA_HOME/webapps/gridsphere/WEB-INF/CustomPortal directory. After downloading and installing the newer version of GridSphere using

ant install
copy your existing configuration back to the same location and issue the following command (make sure Tomcat is shutdown):
ant update-database
which will update the GridSphere database if any new data fields were added.

Logging and Debugging

GridSphere uses the Log4J logging framework and logs all messages to $CATALINA_HOME/logs/catalina.out and to $CATALINA_HOME/logs/localhost_gridsphere_log.{yyyy-mm-dd}.txt If you encounter any errors, please look at the log files for more information. In addition, the logging level can be selectively controlled by configuring the log4j.properties located in the config directory of the GridSphere source directory and then re-deploying.

Configuring the Portal URL

By default, the portal is configured as http://localhost:8080/gridsphere/gridsphere. It is possible to change the context by editing the deployed context. Under Tomcat 4, the context file is located in $CATALINA_HOME/webapps/gridsphere-context.xml. Under Tomcat 5, the context file is located in $CATALINA_HOME/conf/Catalina/localhost/gridsphere.xml Change the following:

            <Context path="/gridsphere" docBase="gridsphere" debug="0" reloadable="false" crossContext="true">
            <Logger className="org.apache.catalina.logger.FileLogger"
           prefix="localhost_gridsphere_log." suffix=".txt" timestamp="true"/>
            </Context>
        

to

            <Context path="/myorg" docBase="myorg" debug="0" reloadable="false" crossContext="true">
            <Logger className="org.apache.catalina.logger.FileLogger"
           prefix="localhost_gridsphere_log." suffix=".txt" timestamp="true"/>
            </Context>
        

Where the context path element corresponds to your desired context.

[Important]Important
First move the file gridsphere.xml over to myorg.xml (or whatever name you specified in the context path)
[Important]Important
Second move the gridsphere webapp to myorg i.e. $CATALINA_HOME/webapps/gridsphere should be moved to $CATALINA_HOME/webapps/myorg
[Important]Important
Third move the $CATALINA_HOME/webapps/myorg/WEB-INF/CustomPortal/portlet/gridsphere.1 file to $CATALINA_HOME/webapps/myorg/WEB-INF/CustomPortal/portlet/myorg.1
[Important]Important
Finally if you are using the local hsqldb you must edit $CATALINA_HOME/webapps/myorg/WEB-INF/CustomPortal/database/hibernate.properties to use myorg and not gridsphere in the hibernate.connection.url

Now change the servlet mapping by editing $CATALINA_HOME/webapps/gridsphere/WEB-INF/web.xml

            <servlet-mapping>
            <servlet-name>gridsphere</servlet-name>
            <url-pattern>/gridsphere/*</url-pattern>
            </servlet-mapping>
        

to

            <servlet-mapping>
            <servlet-name>gridsphere</servlet-name>
            <url-pattern>/start/*</url-pattern>
            </servlet-mapping>
        
and then you can navigate to http://servername/myorg/start/

Redeploying a customized portal

All custom settings including the default database are contained in $CATALINA_HOME/webapps/gridsphere/WEB-INF/CustomPortal. To deploy a new portal configured with the earlier customizations, simply manually copy over this directory to the new portal directory. In order for the database to work, you will have to hand edit the $CATALINA_HOME/webapps/gridsphere/WEB-INF/CustomPortal/database/hibernate.properties hibernate.connection.url entry to match the new Tomcat location.

Running GridSphere with Apache httpd2 and mod_jk

If you want to install GridSphere behind Apache httpd2 please read the following section. Download httpd2 from http://httpd.apache.org/download.cgi.

Example 2. configure apache httpd2

tar xzvf httpd-2.0.49.tar.gz
cd httpd-2.0.49
./configure --prefix=/usr/local/apps/httpd-2.0.49 --enable-ssl --with-ssl=/usr/local/apps/openssl-0.9.7d --enable-so
make
make install
            
[Important]Important
Make sure you have at least openssl 0.9.6e installed it is needed by httpd2.

Next step is to compile the tomcat connectors for httpd2. Download these from http://archive.apache.org/dist/jakarta/tomcat-connectors/jk/source/.

Example 3. configuring apache/tomcat connectors

tar xzvf  jakarta-tomcat-connectors-jk-1.2.5-src.tar.gz
cd  jakarta-tomcat-connectors-jk-1.2.5-src/
./configure --with-apache=/usr/local/apps/httpd-2.0.49 --with-java=/usr/local/packages/java
make
cp apache-2.0/mod_jk.so /usr/local/apps/httpd-2.0.49/modules/
        
Now you need to create a worker2.properties file to connect tomcat and apache httpd2. It can look like this if you use the standard tomcat installation on port 8080.

Example 4. worker2.properties

worker.list=gridsphere

worker.gridsphere.type=ajp13
worker.gridsphere.host=localhost
worker.gridsphere.port=8009
        
It might be a good idea to run apache httpd with virtual hosts. The configuration should look like this:

Example 5. httpd.conf

            

LoadModule jk_module modules/mod_jk.so
<IfModule mod_jk.c>
        JkWorkersFile /usr/local/apps/httpd-2.0.49/conf/workers2.properties
</IfModule>
...
NameVirtualHost YOURIP:80
...
<VirtualHost www.YOURHOST.com:80>
    ServerAdmin webmaster@YOURHOST.com
    DocumentRoot /var/html
    ServerName www.YOURHOST.com
    ErrorLog /logs/error_log
    CustomLog /logs/access_log common
    JkMount /* gridsphere
</VirtualHost>

<VirtualHost www.YOURHOST.com:443>
   ServerAdmin webmaster@YOURHOSTS.com
   DocumentRoot /var/html
   ServerName www.YOURHOST.com
   JkMount /* gridsphere
   SSLEngine on
   SSLCertificateFile    /etc/ssl/server.crt
   SSLCertificateKeyFile /etc/ssl/server.pem
   ErrorLog /logs/error_ssl_log
   CustomLog /logs/access_ssl_log common
</VirtualHost>

            
        
This redirects all incoming requests on port 80 to the running tomcat on port 8080. The second virtual hosts directive will it make possible to access GridSphere over a secure https connection. You need to have valid ssl certificates for that in the specified locations.
[Important]Important
These are just sample configurations. Please change them to reflect your local installation.

Additional Resources

Please read the GridSphere Administrator's and Reference Guides for information on administering and configuring the GridSphere portal.