Table of Contents
There are two different structural methods to run multiple instances of Rice within a single Tomcat instance. You can use either method:
Run a staging and a test environment. This requires a rebuild of the source code.
Run multiple instances of a production environment. This requires modification of the Tomcat WEB-INF/web.xml.
To show you how to set up a staging and a test environment within one Tomcat instance, this section presents the configuration recipe as though it were a Quick Start Best Practices section. This means that this section will be laid out using the Quick Start Best Practices section format and system directory structure. It presents a basic process, method, and guide to what you need to do to get a staging and test environment up within a single Tomcat instance. You could accomplish this functionality many different ways; these sections present one of those ways.
This describes how to set up the Rice instances of kualirice-stg and kualirice-tst instances pointing to the same database. However, you could set up two different databases, one for staging and one for testing. How you configure Rice for the scenario of a database for the “stg” instance and a separate database for the “tst” instance depends on how you want to set up Rice. That scenario is not documented here.
We are assuming that you performed all the installation steps above to compile the software from source and deploy the example kualirice.war file. This example begins with rebuilding the source to create a test and staging instance compilation.
You must compile the source code with a different environment variable. To add the environment variable, environment, to the WAR file’s WEB-INF/web.xml file, recompile the source code with this parameter:
ant -Drice.environment=some-environment-variable dist-war
To begin: Log in as the rice user.
Shut down your Tomcat server.
cd /usr/local/tomcat/bin ./shutdown.sh Using CATALINA_BASE: /usr/local/tomcat Using CATALINA_HOME: /usr/local/tomcat Using CATALINA_TMPDIR: /usr/local/tomcat/temp Using JRE_HOME: /usr/java/jdk1.6.0_16
Recompile your WAR files with the specific environment variables:
cd /opt/software/kuali/src/rice-release-1-0-2-br ant -Drice.environment=stg dist-war cd target/ cp -p kr-stg.war /usr/local/tomcat/webapps/kualirice-stg.war cd /opt/software/kuali/src/rice-release-1-0-2-br ant -Drice.environment=tst dist-war cp -p rice-tst.war /usr/local/tomcat/webapps/kualirice-tst.war
Adding an environment variable to the application config variable will setup Rice to point to the two different instances. To allow each instance to point to the same database, edit the rice-config.xml and modify the application.url to correctly point your Rice to load the correct setup:
<param name="application.url">http://yourlocalip:8080/kualirice-${environment}</param>
Now start up your Tomcat server:
cd /usr/local/tomcat/bin ./startup.sh Using CATALINA_BASE: /usr/local/tomcat Using CATALINA_HOME: /usr/local/tomcat Using CATALINA_TMPDIR: /usr/local/tomcat/temp Using JRE_HOME: /usr/java/jdk1.6.0_16
If your Rice instances started up successfully, browse to the sites http://yourlocalip:8080/kualirice-stg and http://yourlocalip:8080/kualirice-tst. You should see the Rice sample application for each site.
Next, shut down your Tomcat server:
cd /usr/local/tomcat/bin ./shutdown.sh Using CATALINA_BASE: /usr/local/tomcat Using CATALINA_HOME: /usr/local/tomcat Using CATALINA_TMPDIR: /usr/local/tomcat/temp Using JRE_HOME: /usr/java/jdk1.6.0_16
To create specific configuration parameters for the specific instances of Rice, add this to the rice-config.xml.
<param name="config.location">/usr/local/rice/rice-config-${environment}.xml</param>
Next, copy the rice-config.xml to both staging and test to enter instance-specific configuration into each of the resulting xml files:
cd /usr/local/rice cp -p rice-config.xml rice-config-stg.xml cp -p rice-config.xml rice-config-tst.xml
Remove anything from rice-config.xml that is specific to the stg or tst implementation. Put those specific stg or tst parameters in the rice-config-stg.xml or rice-config-tst.xml file, respectively.
Now start up your Tomcat server:
cd /usr/local/tomcat/bin ./startup.sh Using CATALINA_BASE: /usr/local/tomcat Using CATALINA_HOME: /usr/local/tomcat Using CATALINA_TMPDIR: /usr/local/tomcat/temp Using JRE_HOME: /usr/java/jdk1.6.0_16
If your Rice instances started up successfully, browse to the sites http://yourlocalip:8080/kualirice-stg and http://yourlocalip:8080/kualirice-tst. You should see the Rice sample application for each site.
As a best practice:
Put all common properties and settings across all Rice instances in the rice-config.xml.
Put instance-specific settings in rice-config-stg.xml and rice-config-tst.xml.