Skip to content
This repository was archived by the owner on Apr 19, 2022. It is now read-only.

Getting Started Guide

parikhkc edited this page Oct 8, 2012 · 17 revisions
# Prerequisite Software The following software is required to build or run the NanoTrader application. ### To Build * Git 1.7.10 or later * Groovy 1.8.1 or later * Java 1.6 or later

To deploy

  • Java 1.6 or later
  • Erlang R14B (required by RabbitMQ)
  • vFabric tc Server 2.7 or later
  • vFabric RabbitMQ Server 2.8 or later
  • vFabric SQLFire 1.0.x

Optional Software

  • vFabric RabbitMQ Management Plug-in (to view channel/queue stats)
  • vFabric EM4J Console Plug-in (to monitor JVMs running in VMs from the vSphere Web Client)
# Software Installation and Configuration ## Linux (CentOS/RHEL 5/6) Add vFabric Suite Yum Repo for installing vFabric products using rpm package format. Following command will add appropriate repo on your linux system.

CentOS/RHEL 5

sudo rpm -ivhf http://repo.vmware.com/pub/rhel5/vfabric/5.1/vfabric-5.1-repo-5.1-1.noarch.rpm

CentOS/RHEL 6

sudo rpm -ivhf http://repo.vmware.com/pub/rhel6/vfabric/5.1/vfabric-5.1-repo-5.1-1.noarch.rpm

Once the repo is set you can use yum search vfabric to list all vFabric products. Next we will use yum to install vFabric products required to run NanoTrader.

### Install tc Server More details about tc Server installation and configuration are available here. ``` sudo yum install vfabric-tc-server-standard ``` More details about tc Server installation and configuration are available here. ### Install SQLFire ``` sudo yum install vfabric-sqlfire ``` More details about SQLFire installation and configuration are available here. ### Install Erlang RabbitMQ depends on Erlang. Erlang must be installed before RabbitMQ.

CentOS/RHEL 5

sudo rpm -uvh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
wget -O /etc/yum.repos.d/epel-erlang.repo http://repos.fedorapeople.org/repos/peter/erlang/epel-erlang.repo
yum install erlang

CentOS/RHEL 6

sudo rpm -uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm
yum install erlang

More details about installing Erlang are available here

### Install RabbitMQ ``` yum install vfabric-rabbitmq-server ``` More details about RabbitMQ installation and configuration are available here. ### Host Configuration Add a definition of "nanodbserver" to your /etc/hosts file. We use this in jdbc url. ``` 127.0.0.1 localhost nanodbserver ```

Define the JAVA_HOME environment variable and add java to your path. This is required by tc Server.

# Use appropriate path on your system
export JAVA_HOME=/usr/java/jdk1.6.0_X
export PATH=$PATH:/usr/java/jdk1.6.0_X/bin

Now that we have all required vFabric Products installed, lets start them.

### Start RabbitMQ Server RabbitMQ rpm added service scripts for root user. We will use that to start it. ``` sudo service rabbitmq-server start ``` ### Start SQLFire ``` cd /opt/vmware/vfabric-sqlfire/vFabric_SQLFire_103 mkdir locator1 server1 sqlf locator start -peer-discovery-address=127.0.0.1 -peer-discovery-port=3241 -dir=locator1 -client-port=1527 -client-bind-address=127.0.0.1 sqlf server start -dir=server1 -client-bind-address=127.0.0.1 -client-port=1528 -locators=127.0.0.1[3241] ``` ### Build NanoTrader Application #### Clone nanotrader repo

Clone NanoTrader github repo under your home directory. It should create ~/nanotrader folder.

git clone [email protected]:SpringSource/nanotrader.git

Build nanotrader

export GRADLE_OPTS='-Xmx1024m -Xms256m -XX:MaxPermSize=512m'

If you are behind proxy, add proxy to GRADLE_OPTS

export GRADLE_OPTS=$GRADLE_OPTS" -Dhttp.proxyHost=http://proxy.vmware.com -Dhttp.proxyPort=3128"

Run gradle build

cd ~/nanotrader
./gradlew clean build release

This should generate following files under dist folder

ls dist
spring-nanotrader-asynch-services-0.0.1.BUILD-SNAPSHOT.war
spring-nanotrader-services-0.0.1.BUILD-SNAPSHOT.war
spring-nanotrader-web-0.0.1.BUILD-SNAPSHOT.war
spring-nanotrader-web-0.0.1.BUILD-SNAPSHOT.tgz
DataGenerator.zip

Unzip dist/DataGenerator.zip and load NanoTrader schema

cd ~/nanotrader/dist
unzip DataGenerator.zip
./createSqlfSchema
cd ..
### Deploy NanoTrader in tc Server

Add nanotrader template under tc Server. We will apply this template when creating tc Server instance next. The template contains jdbc driver for SQLFire as well as resource configuration and default properties to connect tc Server to SQLFire.

cp -r ~/nanotrader/templates/nanotrader /opt/vmware/vfabric-tc-server-standard/templates

Create a tc Server instance (with instance name = nanotrader). Following will create an instance named nanotrader.

cd /opt/vmware/vfabric-tc-server-standard # This is default tc Server home directory
./tcruntime-instance.sh create nanotrader -t nanotrader -f templates/nanotrader/sqlfire.properties

Copy Nanotrader war files to the instance we just created.

cp ~/nanotrader/dist/spring-nanotrader-asynch-services-0.0.1.BUILD-SNAPSHOT.war /opt/vmware/vfabric-tc-server-standard/nanotrader/webapp/spring-nanotrader-asynch-services.war
cp ~/nanotrader/dist/spring-nanotrader-services-0.0.1.BUILD-SNAPSHOT.war /opt/vmware/vfabric-tc-server-standard/nanotrader/webapp/spring-nanotrader-services.war
cp ~/nanotrader/dist/spring-nanotrader-web-0.0.1.BUILD-SNAPSHOT.war /opt/vmware/vfabric-tc-server-standard/nanotrader/webapp/spring-nanotrader-web.war

Start nanotrader tc Server instance

./tcruntime-ctl.sh nanotrader start

Generate Sample Data

After the "nanotrader" tc Server instance is running, you can optionally load sample data into the database.

cd ~/nanotrader/dist
./generateData

With your Web browser, navigate to the following URL to view the NanoTrader login page: http://localhost:8080/spring-nanotrader-web

## MAC ### Install required sofware on mac. Use brew to install **groovy** and **RabbitMQ**. Download and install tc Server and SQLFire evaluation versions manually. ``` brew install groovy brew install rabbitmq ``` * Install tc Server Developer Edition under your home directory (https://www.vmware.com/tryvmware/p/survey.php?p=tcserver-dev&lp=1) * Install SQLFire Evaluation Version under your home directory (https://my.vmware.com/web/vmware/info/slug/application_platform/vmware_vfabric_sqlfire/1_0) ### Host Configuration Add a definition of "nanodbserver" to your /etc/hosts file. We use this in jdbc url. ``` 127.0.0.1 localhost nanodbserver ``` _Warning: On a MAC (seen on Lion and Snow Leopard), the /etc/hosts file can be reset by VPN connection software. [See here](http://superuser.com/questions/354902/etc-hosts-getting-reset-in-lion)_

Define the JAVA_HOME environment variable and add java to your path. JAVA_HOME is required by tc Server.

export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
### RabbitMQ Startup ``` rabbitmq-server & ``` ### Start SQLFire Assuming you installed SQLFire version 1.0.3 under your home directory run following to create and start a SQLFire Locator and SQLFire Server.
export PATH=$PATH:~/vFabric_SQLFire_103/bin # Add SQLFire to path to run sqlf command
cd ~/vFabric_SQLFire_103
mkdir locator1 server1
sqlf locator start -peer-discovery-address=127.0.0.1 -peer-discovery-port=3241 -dir=locator1 -client-port=1527 -client-bind-address=127.0.0.1
sqlf server start -dir=server1 -client-bind-address=127.0.0.1 -client-port=1528 -locators=127.0.0.1[3241]
### Clone nanotrader repo

Clone NanoTrader github repo under your home directory. It should create ~/nanotrader folder.

git clone [email protected]:SpringSource/nanotrader.git
### Build nanotrader ``` export GRADLE_OPTS='-Xmx1024m -Xms256m -XX:MaxPermSize=512m' ``` If you are behind proxy, add proxy to GRADLE_OPTS ``` export GRADLE_OPTS=$GRADLE_OPTS" -Dhttp.proxyHost=http://proxy.vmware.com -Dhttp.proxyPort=3128" ```

Run gradle build

cd ~/nanotrader
./gradlew clean build release

This should generate following files under dist folder

ls dist
spring-nanotrader-asynch-services-0.0.1.BUILD-SNAPSHOT.war
spring-nanotrader-services-0.0.1.BUILD-SNAPSHOT.war
spring-nanotrader-web-0.0.1.BUILD-SNAPSHOT.war
spring-nanotrader-web-0.0.1.BUILD-SNAPSHOT.tgz
DataGenerator.zip

Unzip dist/DataGenerator.zip and load NanoTrader schema

cd ~/nanotrader/dist
unzip DataGenerator.zip
./createSqlfSchema
cd ..
### Deploy NanoTrader in tc Server

Add nanotrader template under tc Server. We will apply this template when creating tc Server instance next. The template contains jdbc driver for SQLFire as well as resource configuration and default properties to connect tc Server to SQLFire. Assuming you installed tc Server 2.7.1 RELEASE version under you home directory run following.

cp -r ~/nanotrader/templates/nanotrader ~/vfabric-tc-server-developer-2.7.1.RELEASE/templates

Create a tc Server instance (with instance name = nanotrader). Following will create an instance named nanotrader.

cd ~/vfabric-tc-server-developer-2.7.1.RELEASE
./tcruntime-instance.sh create nanotrader -t nanotrader -f templates/nanotrader/sqlfire.properties

Copy Nanotrader war files to the instance we just created.

cp ~/nanotrader/dist/spring-nanotrader-asynch-services-0.0.1.BUILD-SNAPSHOT.war ~/vfabric-tc-server-developer-2.7.1.RELEASE/nanotrader/webapp/spring-nanotrader-asynch-services.war
cp ~/nanotrader/dist/spring-nanotrader-services-0.0.1.BUILD-SNAPSHOT.war ~/vfabric-tc-server-developer-2.7.1.RELEASE/nanotrader/webapp/spring-nanotrader-services.war
cp ~/nanotrader/dist/spring-nanotrader-web-0.0.1.BUILD-SNAPSHOT.war ~/vfabric-tc-server-developer-2.7.1.RELEASE/nanotrader/webapp/spring-nanotrader-web.war

Start nanotrader tc Server instance

./tcruntime-ctl.sh nanotrader start

Generate Sample Data

After the "nanotrader" tc Server instance is running, you can optionally load sample data into the database.

cd ~/nanotrader/dist
./generateData

With your Web browser, navigate to the following URL to view the NanoTrader login page: http://localhost:8080/spring-nanotrader-web

Clone this wiki locally