This describes how to set up two production Rice instances running side by side.
The configuration parameter ${environment} must be set to the text: prd
When the configuration parameter ${environment} is set to prd, the code:
Sends email to specified individuals
Turns off some of the Rice “back doors”
This assumes that you performed all the installation steps above to compile the software from source and deploy the example kualirice.war file. This example starts from rebuilding the source to accomplish a test and staging instance compilation.
Create a riceprd1 and riceprd2 database for the first production and second production instance, respectively.
Build the WAR file from the source code.
Unzip the WAR file in a temporary work directory.
Add an environment variable, prd1, to the WEB-INF/web.xml in the unzipped-war-file-directory.
Re-zip the WAR file into kualirice-prd1.war.
Copy kualirice-prd1.war to /usr/local/tomcat/webapps.
Change the environment variable from prd1 to prd2 in the WEB-INF/web.xml in the unzipped-war-file-directory.
Re-zip the WAR file into kualirice-prd2.war.
Copy kualirice-prd2.war to /usr/local/tomcat/webapps.
In /usr/local/rice, copy rice-config.xml to rice-config-prd1.xml.
In /usr/local/rice, copy rice-config.xml to rice-config-prd2.xml.
In rice-config.xml, remove any instance-specific parameters.
Modify rice-config-prd1.xml for instance-specific parameters.
Modify rice-config-prd2.xml for instance-specific parameters.
Start up Tomcat.
Here are the details:
Start by logging 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
Set Up the ImpEx Process to Build the Database for the process to create the riceprd1 and riceprd2 databases.
Set your directory to the rice home directory:
cd ~ vi impex-build.properties
For the rice-prd1 database, modify this in the ImpEx file:
# # Uncomment these for a local MySQL database # import.torque.database = mysql import.torque.database.driver = com.mysql.jdbc.Driver import.torque.database.url = jdbc:mysql://kmysql:3306/riceprd1 import.torque.database.user=riceprd1 import.torque.database.schema=riceprd1 import.torque.database.password=kualirice
Save the file, change directory to the folder where the ImpEx build.xml is, and create the database:
cd /opt/software/kuali/db/trunk/impex ant create-schema ant satellite-update
You may receive this error because the ANT and SVN processes cannot write to a directory on the hard drive:
Buildfile: build.xml Warning: Reference torque-classpath has not been set at runtime, but was found during build file parsing, attempting to resolve. Future versions of Ant may support referencing ids defined in non-executed targets. satellite-update: Warning: Reference torque-classpath has not been set at runtime, but was found during build file parsing, attempting to resolve. Future versions of Ant may support referencing ids defined in non-executed targets. satellite-init: [echo] Running SVN update in /opt/software/kuali/devdb/rice-cfg-dbs [svn] <Update> started ... [svn] svn: '/opt/software/kuali/devdb/rice-cfg-dbs' is not a working copy [svn] svn: Cannot read from '/opt/software/kuali/devdb/rice-cfg-dbs/.svn/format': /opt/software/kuali/devdb/rice-cfg-dbs/.svn/format (No such file or directory) [svn] <Update> failed ! BUILD FAILED /opt/software/kuali/db/trunk/impex/build.xml:825: Cannot update dir /opt/software/kuali/devdb/rice-cfg-dbs Total time: 3 seconds
If you received the error above, go to the window where the root user is logged in and execute this command:
rm -rf /opt/software/kuali/devdb/rice-cfg-dbs
Then return to where you have the rice user logged in and re-execute the command:
ant satellite-update
The creation of the Rice riceprd1 database should begin at this time.
For the rice-prd2 database, modify this in the ImpEx file:
# # Uncomment these for a local MySQL database # import.torque.database = mysql import.torque.database.driver = com.mysql.jdbc.Driver import.torque.database.url = jdbc:mysql://kmysql:3306/riceprd2 import.torque.database.user=riceprd2 import.torque.database.schema=riceprd2 import.torque.database.password=kualirice
Save the file, change directory to the folder where the ImpEx build.xml is, and create the database:
cd /opt/software/kuali/db/trunk/impex ant create-schema ant satellite-update
You may get this error because the ANT and SVN processes cannot write to a directory on the hard drive:
Buildfile: build.xml Warning: Reference torque-classpath has not been set at runtime, but was found during build file parsing, attempting to resolve. Future versions of Ant may support referencing ids defined in non-executed targets. satellite-update: Warning: Reference torque-classpath has not been set at runtime, but was found during build file parsing, attempting to resolve. Future versions of Ant may support referencing ids defined in non-executed targets. satellite-init: [echo] Running SVN update in /opt/software/kuali/devdb/rice-cfg-dbs [svn] <Update> started ... [svn] svn: '/opt/software/kuali/devdb/rice-cfg-dbs' is not a working copy [svn] svn: Cannot read from '/opt/software/kuali/devdb/rice-cfg-dbs/.svn/format': /opt/software/kuali/devdb/rice-cfg-dbs/.svn/format (No such file or directory) [svn] <Update> failed ! BUILD FAILED /opt/software/kuali/db/trunk/impex/build.xml:825: Cannot update dir /opt/software/kuali/devdb/rice-cfg-dbs Total time: 3 seconds
If you received the error above, go to the window where the root user is logged in and execute this command:
rm -rf /opt/software/kuali/devdb/rice-cfg-dbs
Then return to where you have the rice user logged in and re-execute the command:
ant satellite-update
The creation of the Rice riceprd2 database should begin at this time.
Create a temporary work directory where you can unzip the WAR file, once it has finished building. Recompile your WAR files with the specific environment variable:
Execute this as root:
cd /opt/software/kuali mkdir work chmod –R 777 /opt/software/kuali/work
Execute this as the rice user to create the kualirice-prd1.war file:
cd /opt/software/kuali/src/rice-release-1-0-2-br ant -Drice.environment=prd dist-war cd target/ cp -p kr-prd.war /opt/software/kuali/work cd /opt/software/kuali/work mkdir files unzip kr-prd.war -d files cd files/WEB-INF/
Edit the web.xml with VI and change the top parameters to these:
<context-param> <param-name>environment</param-name> <param-value>prd</param-value> </context-param> <context-param> <param-name>rice-prd-instance-name</param-name> <param-value>prd1</param-value> </context-param>
Zip the kualirice-prd1.war file and deploy it:
cd .. zip -9 -r kualirice-prd1.war * mv kualirice-prd1.war /usr/local/tomcat/webapps/
Execute this as the rice user to create the kualirice-prd2.war file:
cd WEB-INF
Edit the web.xml with VI and change the top parameters to these:
<context-param> <param-name>environment</param-name> <param-value>prd</param-value> </context-param> <context-param> <param-name>rice-prd-instance-name</param-name> <param-value>prd2</param-value> </context-param>
Zip the kualirice-prd2.war file and deploy it:
cd .. zip -9 -r kualirice-prd2.war * mv kualirice-prd2.war /usr/local/tomcat/webapps
Remove the work directory:
cd ../.. rm -rf work
Create a Rice-specific set of configuration files:
cd /usr/local/rice cp -p rice-config.xml rice-config-prd1.xml cp -p rice-config.xml rice-config-prd2.xml
Set the following in the rice-config.xml
Set the config.location for each Rice instance-specific setting
Set the settings for all instances in the rice-config.xml
A minimal rice-config.xml might look like this:
<config> <param name="config.location">/usr/local/rice/rice-config-${rice-prd-instance-name}.xml</param> <!-- Please fill in a value for this parameter! --> <param name="application.url">http://10.93.94.206:8080/kualirice-${rice-prd-instance-name}</param> <param name="notification.basewebappurl">${application.url}/ken</param> <param name="workflow.url">${application.url}/en</param> <param name="plugin.dir">/usr/local/rice/plugins</param> <param name="attachment.dir.location">/usr/local/rice/kew_attachments</param> <!-- log4j settings --> <param name="log4j.settings.path">/usr/local/rice/log4j.properties</param> <param name="log4j.settings.reloadInterval">5</param> <!-- Keystore Configuration --> <param name="keystore.file">/usr/local/rice/rice.keystore</param> <param name="keystore.alias">rice</param> <param name="keystore.password">kualirice</param> <!-- Dummy Login Filter - use if you don't want to go through CAS --> <param name="filter.login.class">org.kuali.rice.kew.web.DummyLoginFilter</param> <param name="filtermapping.login.1">/*</param> </config>
A minimal rice-config-prd1.xml might look this:
<config> <!-- set some datasource defaults --> <!-- MySQL example --> <param name="datasource.ojb.platform">MySQL</param> <param name="datasource.platform">org.kuali.rice.core.database.platform.MySQLDatabasePlatform</param> <param name="datasource.url">jdbc:mysql://mysql:3306/riceprd1</param> <param name="datasource.username">riceprd1</param> <param name="datasource.password">kualirice</param> <param name="datasource.driver.name">com.mysql.jdbc.Driver</param> <param name="datasource.pool.size">5</param> <param name="datasource.pool.maxWait">10000</param> <param name="datasource.pool.validationQuery">select 1</param> <!-- Oracle example <param name="datasource.ojb.platform">Oracle9i</param> <param name="datasource.platform">org.kuali.rice.core.database.platform.OracleDatabasePlatform</param> <param name="datasource.url">jdbc:oracle:thin:@localhost:1521:XE</param> <param name="datasource.username">rice</param> <param name="datasource.password">*** password ***</param> <param name="datasource.driver.name">oracle.jdbc.driver.OracleDriver</param> <param name="datasource.pool.size">5</param> <param name="datasource.pool.maxWait">10000</param> <param name="datasource.pool.validationQuery">select 1 from dual</param> --> </config>
A minimal rice-config-prd2.xml might look like this:
<config> <!-- set some datasource defaults --> <!-- MySQL example --> <param name="datasource.ojb.platform">MySQL</param> <param name="datasource.platform">org.kuali.rice.core.database.platform.MySQLDatabasePlatform</param> <param name="datasource.url">jdbc:mysql://mysql:3306/riceprd2</param> <param name="datasource.username">riceprd1</param> <param name="datasource.password">kualirice</param> <param name="datasource.driver.name">com.mysql.jdbc.Driver</param> <param name="datasource.pool.size">5</param> <param name="datasource.pool.maxWait">10000</param> <param name="datasource.pool.validationQuery">select 1</param> <!-- Oracle example <param name="datasource.ojb.platform">Oracle9i</param> <param name="datasource.platform">org.kuali.rice.core.database.platform.OracleDatabasePlatform</param> <param name="datasource.url">jdbc:oracle:thin:@localhost:1521:XE</param> <param name="datasource.username">rice</param> <param name="datasource.password">*** password ***</param> <param name="datasource.driver.name">oracle.jdbc.driver.OracleDriver</param> <param name="datasource.pool.size">5</param> <param name="datasource.pool.maxWait">10000</param> <param name="datasource.pool.validationQuery">select 1 from dual</param> --> </config>
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-prd1 and http://yourlocalip:8080/kualirice-prd2. You should see the Rice sample application for each site.