Skip to content

Installation Guide

matt edited this page Aug 5, 2019 · 34 revisions

Requirements:

  • Oracle Java 8 or higher
  • Apache Maven
  • Oracle JDBC Driver (ojdbc8)
  • Oracle Database 12c or higher
  • Apache Tomcat 7 or higher
  • Node.js
  • Angular CLI 6.0 or higher

0. Setup Development Environment

The following environment variables must be present on your system. For more information on how to set environment variables, visit the following guides.***

***if using Spring Tools Suite you need only to set these environment variables as part of your run configurations for tomcat.

STS specific run configuration setup

  1. Right click project name
  2. Run As...
  3. Run Configurations...
  4. (Apache Tomcat should be pre-selected) Click on Environment tab
  5. Enter environment key value pairs

Environment Variables

  • TRACKFORCE_DB_URL
  • TRACKFORCE_DB_USERNAME
  • HBM_PW_ENV
  • TrackForce_URL
  • NGTrackForce_URL

Mac, Linux: run this script in the terminal, replacing the necessary values inside the angle brackets (<>) beforehand

echo 'export TRACKFORCE_DB_URL="<ENVIRONMENT-VARIABLE-VALUE>"' >> ~/.profile
echo 'export TRACKFORCE_DB_USERNAME="<ENVIRONMENT-VARIABLE-VALUE>"' >> ~/.profile
echo 'export HBM_PW_ENV="<ENVIRONMENT-VARIABLE-VALUE>"' >> ~/.profile
echo 'export TrackForce_URL="<ENVIRONMENT-VARIABLE-VALUE>"' >> ~/.profile
echo 'export NGTrackForce_URL="<ENVIRONMENT-VARIABLE-VALUE>"' >> ~/.profile
. ~/.profile

1. Install JDBC

Due to Oracle's policies, the JDBC drivers are not directly included in the global Maven repository. The JDBC drivers must be downloaded from Oracle's website and installed in the local maven repository manually for each developer and deployment location. This can be done with the following command, filling in the <> with the appropriate information:
mvn install:install-file -Dfile=<path-to-jdbc-jar> -DgroupId=com.oracle.jdbc -DartifactId=<driver name> -Dversion=<driver-version> -Dpackaging=jar

The current version of the jdbc is listed in your maven POM file.

2. Configure Connection Pool

Running the project requires an Apache Tomcat server to host the files and Apache Maven to build the project dependencies. As noted earlier, the JDBC drivers must be installed in the local Maven repository. In addition there is a configurable properties file for establishing a Tomcat-JDBC Datasource and Connection Pool.

Please note: the EC2 can only handle up to 50 connections at any one time, so adjust the connection pooling parameters accordingly. Additionally, you cannot alter sessions while logged in as an admin on the database, so management of connections is crucial.

Too many DB connections will result in "-1" error codes in your server applications. To solve this, have a pipeline person follow these instructions:

Login to the medium EC2. Run “ps aux | grep tomcat” to look through processes. Find the application process with a command like “/usr/java/jdk1.8.0_161/bin/java -Djava.util.logging.config.file=/home/ec2-user/tomcat/ap” “sudo kill “ its process id. You’ll then need to navigate to tomcat, sudo rm -r the deployed application folder, and then trigger another Jenkins build.

3. Webdriver Updates

Download latest version for Firefox or Chrome here

Install driver to Trackforce/src/main/resources

4. Install Angular

The front-end of the application is served using an Angular server defaulted to http://localhost:4200. This configuration then sends requests to the back-end Java side via REST using port 8085. To run the front end in developer mode you need node_modules on your local machine. Simply download Node.js and run npm install in your NGTrackforce folder, then npm start to deploy it locally.

For Mac and Linux users: you may need higher permissions to run this operation. try adding the sudo command before installing.

Now that your project is built simply run npm start to begin serving the Angular application on 4200. It's worth being aware of ng build --base-href /NGTrackForce/ --prod --aot true to check for potential build errors before you send the code up.

For running headless browser tests locally install the launcher then run the tests
npm install --save-dev karma-phantomjs-launcher
ng test --single-run --browsers PhantomJS

5. Database Configuration

To configure hibernate, we used the standard 'hibernate.cfg.xml', with the sensitive information obscured by directly accessing system variables (for more information, look at step 0). The 'hibernate.properties' is for configuring C3P0, our connection pool management dependency.

Clone this wiki locally