This section will walk a developer through the steps of setting up Moves, on Windows or Linux. It does not cover OC4J installation, since that is covered elsewhere in this Wiki.

Prerequisites

A machine running Windows or Linux. (This should work for Macs too... but the author does not use a mac).

What we'll set up

  • A recent JDK, with strong cryptography enabled
  • SSH (or PuTTY on Windows)
  • Kerberos
  • Subversion with kerberos authentication
  • Maven (with MIT trustore)
  • The link to the Development Moves component registry.

Setting up your JDK.

Get as recent a version of the JDK as MIT IS&T support, and install the Java Cryptography Extension (JCE) Unlimited Strength FOR THAT JDK. Make sure you get the JDK, and not just the JRE. Also make sure that the JDK is the FIRST java found in your path, and that you have the System environment variable JAVA_HOME pointing to that JDK. To install the JCE, simply backup %JAVA_HOME%/jre/lib/security/local_policy.jar and %JAVA_HOME%/jre/lib/security/US_export_policy.jar with the copies in the JCE zip file. For my windows jdk, the location was C:/Program Files/Java/jdk1.6.0_29/jre/lib/security.

Setting up OC4J.

The complete setup of an OC4J container for IS&T is available here Environment Setup.
To set up your container for moves, go to Configuring a Moves container

SSH setup

SSH on Ubuntu

type sudo apt-get install openssh-client

SSH on Windows

  • Download PuTTY (e.g from here)
  • Make a note of the path (usually C:/Program Files/PuTTY or C:/Program Files (x86)/PuTTY).
    At this stage you must be able to type C:/Program Files (x86)/PuTTY/plink svn.mit.edu and get a connection. The connection will look something like the following, until you hit CTRL-C
    Last login: Wed Nov 30 12:22:56 2011 from west-ninetytwo-fourty.mit.edu
    
    RHN kickstart on 2009-01-14
    
    ( success ( 2 2 ( ) ( edit-pipeline svndiff1 absent-entries commit-revprops depth log-revprops partial-replay ) ) )
    

Kerberos

Moves does a WHOLE LOT of subversion activity. Unless you set yourself up for password-less authentication, you're gonna spend most of your life typing in your kerb username and password over and over again. Since you probably won't get an ssh private key installed on svn.mit.edu, you're gonna have to set yourself up with Kerberos. When we have Kerberos hooked up with svn, you'll only have to type in your username once per session. (A session lasts for about 10 hours). Sharing a production ssh key is not advisable (though it's been done).

Kerberos on Ubuntu (should work for Debian)

  • type sudo apt-get install ssh-krb5 krb5-user krb4-config
  • type kinit and enter in your kerberos username and password. If that works, you're done.

If you weren't authenticated then

  • backup existing /etc/krb5.conf file if it exists (type sudo mv /etc/krb5.conf /etc/krb5.backup)
  • copy the attached file to /etc/krb5.conf

Kerberos on Windows

If you have 64 bit windows, install the 64 bit kerberos client first, from http://www.secure-endpoints.com/#kfw
For 32 bit AND 64 bit windows, install the 32 bit client from http://web.mit.edu/kerberos/dist/index.html#kfw-3.2
Restart windows if it asks you to

If all went well you should be able to open a (new) command prompt and type
C:/Program Files (x86)/PuTTY/plink svn.mit.edu
This time, instead of asking you at the command line to type in your username, a dialog box will pop up, looking something like this:

The beauty of this is that next time you type C:/Program Files (x86)/PuTTY/plink svn.mit.edu you will not be asked for your password.
Try it and see. You should get this step working before proceeding.

Subversion

Subversion on Ubuntu

  • type sudo apt-get install subversion

Subversion on Windows

  • Download Subversion from Collabnet. (You'll probably need to register).
  • The 32 bit client is recommended, even if you have 64 bit windows... 'cos we'll be talking to Putty and Kerberos, and Putty is 32 bit only.
  • Put Subversion in your path.

If all is well we should now be able to list subversion repositories without a password (or at least the second time we try listing a repository we should not get asked for a password. Try the following command twice. You should be asked for a password 0 or 1 times only. (0 if you're already authenticated with kerberos, 1 if you're not).

svn ls svn+ssh://svn.mit.edu/sais-sis-common/maven/releases/trunk

Maven (with MIT trustore)

Get the latest 2.x version of maven from http://maven.apache.org/download.html (unless MIT IS&T is already on 3.x when you're reading this document).

Maven on Ubuntu

  • Extract the maven download to /usr/local/apache-maven-x.x.x (where x.x.x is the version you downloaded).
  • Set system property MAVEN_HOME=/usr/local/apache-maven-x.x.x (where x.x.x is the version you downloaded)
  • Add $MAVEN_HOME/bin to your path
  • Set system property MAVEN_OPTS=-Xmx1024m -Xms1024m -XX:MaxPermSize=1024m -Djavax.net.ssl.trustStore=/home/${your-user-name}/keystores/serverTruststore.jks -Djavax.net.ssl.trustStorePassword=changeit

Maven on Windows

  • Extract the maven download to C:/Program Files/apache-maven-x.x.x (where x.x.x is the version you downloaded).
  • Set system property MAVEN_HOME=C:/Program Files/apache-maven-x.x.x (where x.x.x is the version you downloaded)
  • Add %MAVEN_HOME%/bin to your path
  • Set system property MAVEN_OPTS=-Xmx1024m -Xms1024m -XX:MaxPermSize=1024m -Djavax.net.ssl.trustStore=c:/Users/${your-user-name}/keystores/serverTruststore.jks -Djavax.net.ssl.trustStorePassword=changeit

Maven common steps

Now we will export settings.xml into your maven m2 home directory from the bamboo build configuration repository (which should always have the latest/greatest version). If you've never used maven before, you will have to create the folder ${user.home}/.m2 (ie C:/Users/${your-user-name}/.m2 or /home/${your-user-name}/.m2). If this folder already exists, that's cool... but if it contains a file called settings.xml, rename it to settings.xml.backup

In a DOS box (or unix command shell), cd to ${user.home}/.m2
type svn export svn+ssh://svn.mit.edu/sais-sis-common/sais-common-conf/trunk/.m2/settings.xml

There should now be a new file in ${user.home}/.m2 called settings.xml.

  • It is highly recommended that you delete the folder ${user.home}/.m2/repositories if it exists. This will slow down your first build, but will highlight any issues you may have with your maven configuration.

Building commons

Pre-requisites

  • You should have a file called registrar-test.jks in your ${user.home}/keystores folder. If you don't have that file, try using the attached registrar-test.jks.
  • You should have a file called sais-common-test.properties in your ${user.home} folder. If you don't have that file, try using the attached sais-common-test.properties. *You will need to change the properties mitsis.database.username = and mitsis.database.password to your oracle username and password. If you don't have an oracle username and password, contact db-help@mit.edu.

Check out the code.

  • cd to C:/Users/your-user-name/WORKSPACE (on Windows) or /home/your-user-name/WORKSPACE (on Linux)
  • If using windows, rename the folder C:/Users/your-user-name/WORKSPACE/sais-common to C:/Users/your-user-name/WORKSPACE/sais-common.backup (if that folder exists)
  • If using linux, rename /home/your-user-name/WORKSPACE/sais-common to /home/your-user-name/WORKSPACE/sais-common.backup (if that folder exists)
  • type svn co svn+ssh://svn.mit.edu/sais-sis-common/sais-common/trunk sais-common
  • cd into the sais-common folder which was just created
  • type mvn clean install

You should see the message BUILD SUCCESSFUL in the log.

Building commons workflow

Pre-requisites

  • You should have a file called sais-common-workflow-test.properties in your ${user.home} folder. If you don't have that file, try using the attached sais-common-workflow-test.properties.

Check out the code

  • cd to C:/Users/your-user-name/WORKSPACE (on Windows) or /home/your-user-name/WORKSPACE (on Linux)
  • If using windows, rename the folder C:/Users/your-user-name/WORKSPACE/sais-common-workflow to C:/Users/your-user-name/WORKSPACE/sais-common-workflow.backup (if that folder exists)
  • If using linux, rename /home/your-user-name/WORKSPACE/sais-common-workflow to /home/your-user-name/WORKSPACE/sais-common-workflow.backup (if that folder exists)
  • type svn co svn+ssh://eotoole@svn.mit.edu/sais-sis-common/sais-common-workflow/trunk sais-common-workflow
  • cd into the sais-common-workflow folder which was just created
  • type mvn clean install

You should see the message BUILD SUCCESSFUL in the log.

Building Moves

Pre-requisites

  • You should have a file called sais-common-workflow-test.properties in your ${user.home} folder. If you don't have that file, try using the attached sais-common-workflow-test.properties.

Check out the code

  • cd to C:/Users/your-user-name/WORKSPACE (on Windows) or /home/your-user-name/WORKSPACE (on Linux)
  • If using windows, rename the folder C:/Users/your-user-name/WORKSPACE/sais-moves-web to C:/Users/your-user-name/WORKSPACE/sais-moves-web.backup (if that folder exists)
  • If using linux, rename /home/your-user-name/WORKSPACE/sais-moves-web to /home/your-user-name/WORKSPACE/sais-moves-web.backup (if that folder exists)
  • type svn co svn+ssh://svn.mit.edu/sais-sis-common/sais-moves-web/trunk sais-moves-web
  • cd into the sais-moves-web folder which was just created
  • type mvn clean install -DskipTests

(Currently moves does not run the unit tests, but this will be corrected).

You should see the message BUILD SUCCESSFUL in the log.

Deploying moves

Moves can be deployed to any oc4j container, either remote or local. This is accomplished by using the maven-exec-plugin. If you know maven you can look at the pom.xml file to see what's going on. If you don't know maven, you shouldn't be modifying moves... but I will include an overview of how a deployment works.

oc4j properties in moves pom.xml
<properties>
    ...
    <oc4j.j2eeHome>${user.home}/servers/oc4j/10.1.3.5/j2ee/home</oc4j.j2eeHome>
    <!-- this should not need to be changed -->
    <oc4j.adminJar>admin_client.jar</oc4j.adminJar>
    <!-- this will only need to be changed if you have changed the default admin name in your oc4j install -->
    <oc4j.username>oc4jadmin</oc4j.username>
    <!-- this will usually need to be changed (I believe the default is oc4jadmin) -->
    <oc4j.password>oc4jadmin</oc4j.password>
    <!-- this will work for most local installs -->
    <oc4j.connectionUri>deployer:oc4j:localhost</oc4j.connectionUri>
    <!-- context root is always '/moves' for moves-->
    <oc4j.contextRoot>/moves</oc4j.contextRoot>
    <oc4j.deploymentName>moves</oc4j.deploymentName>
    <oc4j.siteXml>default-web-site</oc4j.siteXml>
</properties>

The above is the default properties for deploying an app. We have configured the maven-exec-plugin such that when you type mvn exec:exec maven will execute the following command

java -jar ${oc4j.j2eeHome}/${oc4j.adminJar} deployer:oc4j:localhost ${oc4j.username} ${oc4j.password} -deploy -file ${the war file previously built by maven} -deploymentName ${oc4j.deploymentName} -bindAllWebApps ${oc4j.siteXml} -contextRoot ${oc4j.contextRoot}

So by default calling mvn exec:exec will execute (on my machine)

java -jar C:/Users/eotoole/servers/oc4j/10.1.3.5/j2ee/home\admin_client.jar deployer:oc4j:localhost oc4jadmin oc4jadmin -deploy -file C:/Users/eotoole/WORKSPACE/sais-moves-web/target/sais-moves-web-2.0.2-SNAPSHOT.war -deploymentName moves -bindAllWebApps default-web-site -contextRoot /moves

If you have installed oc4j into a different folder, or if you have a different oc4j administrative username/password you can specify overrides on the command line. For example, if you type mvn exec:exec -Doc4j.j2eeHome=C:/product/oc4j/j2ee/home -Doc4j.password=changeit then maven will execute

java -jar C:/product/oc4j/j2ee/home\admin_client.jar deployer:oc4j:localhost oc4jadmin changeit -deploy -file C:/Users/eotoole/WORKSPACE/sais-moves-web/taret/sais-moves-web-2.0.2-SNAPSHOT.war -deploymentName moves -bindAllWebApps default-web-site -contextRoot /moves

If you need to add overrides, consider saving them in a batch file (for example oc4jDeploy.bat in your path). For example, I use:

C:/Users/eotoole/bin/oc4jDeploy.bat

mvn exec:exec -Doc4j.j2eeHome=C:\product\oc4j_extended_101350\j2ee\home -Doc4j.password=admin

If you successfully deployed moves, you should be able to navigate to
http://localhost:8888/moves/admin/index.htm

  • No labels