Skip to content

1. Getting Started

Gary edited this page May 1, 2020 · 14 revisions

OPP (Open Performance Platform)

Open Performance Platform - Trending and performance analysis for both server-side and client-side testing

Deploying

Deploying the platform with docker is very easy.

docker-compose up -d

NOTE: Create your docker API image before running this.

 cd opp-service
 ./gradlew clean build buildDocker

To use the default domain in the docker-compose.yml file, add this entry to your host file.

 sudo vim /etc/hosts
 127.0.0.1 opp-svc.mydomain.com opp-ui.mydomain.com

Then Generate Test Data to play around.

Simple Setup

Modify the docker-compose.yml file and set the environment variables for the UI and database, and change placeholder passwords.

    ...
services:
  	...
  ui:
	...
	environment:
	  - SSL_CERT_INFO="C=US/ST=MA/L=Boston/O=MyOrg/OU=Performance Team/[email protected]"
	  - SSL_DH_SIZE=512 #Diffie-Hellman size (increase value for higher security - slow to generate)
	  - NGINX_HOST_UI=opp-ui.mydomain.com
	  - NGINX_HOST_SVC=opp-svc.mydomain.com
	  - NGINX_PORT=443
  mysql:
	...
	environment:
	  - MYSQL_ROOT_PASSWORD=ROOT-PASSWORD
	  - MYSQL_DATABASE=perfweb
	  - MYSQL_USER=oppuser
	  - MYSQL_PASSWORD=USER-PASSWORD
	...

The most important things here are setting the NGINX_HOST_UI and NGINX_HOST_SVC variables. That is where you application will live. If you are running locally, just modify your hosts file and add the following entry:

127.0.0.1 opp-ui.mydomain.com opp-svc.mydomain.com

Deploying to a separate DB server

Ok, so you are fancy and want separate DB server. I understand. We do the same here 👍

  1. Remove all references of mysql from the docker-compose.yml
  2. Open the OPP SVC application config opp-service/src/main/resources/application.yml file
  3. Modify spring -> datasource property to point to your server
  4. Save and rebuild docker image
  5. Run the schema file from opp-service/db/mysql/schema on your database
  6. Remember to config your DB user to match the users you set in the application.yml
  7. Redeploy your environment with the changes: docker-compose up --build

Developing

Developing with the platform is easy as well.

APIs

The APIs are written in Java (Spring boot) and uses gradle as the build tool.

NOTE: By default the below commands will fail if you aren't running docker-compose or haven't changed the development profile in the application.yml file. It will try to execute tests against a database that isn't setup. Add -x test to the end of the command to skip tests.

First, cd into the services directory cd opp-service

To build the application: ./gradlew clean build

To run the application: ./gradlew clean bootRun

To create a new docker image: ./gradlew build buildDocker

To run integration tests: ./gradlew build -Dtest-groups=integration-tests

NOTE: Make sure the entire environment is setup in the development profile in the application.yml file. Its really easy to just run docker-compose up and then run the integration tests. If your development profile is setup correctly, the integration tests should run against the docker environment.

You will need to create the new docker image before you can see your changes when you run docker-compose.

UI

The UI is in EXTJS. This has its benefits as its all code an no actual UI design. It was a good fit for building this reporting system without much UI effort and I'm missing the part of the brain that has style :-) So to not make this look like a bad reporting site from 1998, EXTJS worked very well.

Getting starting with EXTJS.

You will need to install their Sencha CMD which can be found on their website. This is basically their CLI that creates

https://www.sencha.com/products/extjs/cmd-download/

This is tested working on sencha cmd version 6.5.x

Next, go to opp-ui/ui to see the app code.

From that directory, run sencha app build

If for some reason its not working (very likely with EXTJS as it can be a pain) try the opp-ui/scripts/fixExtProject.sh script. It will essentially rebuild a new project from scratch and copy the important files over.

To build a production ready version (packaged JS and css) run sencha app build -c production

For more details about EXTJS and sencha build process just google sencha cmd docs

See your dev changes instantly

For your convenience, there is also a docker-compose file to develop the UI without having to constantly update the docker container. Its essentially just mounts the ui directory to the image so you can make changes on the fly and instantly see the results. To do this: run docker-compose -f Dockerfile-compose-dev --build

Generating Test Data

OPP comes with a data generation API.

To quickly get started playing with the UI, you can use our data generator API to quickly get up and running with test data. Its also incredibly helpful for writing integration tests.

You can use swagger (http://opp-svc.roving.com/swagger-ui.html) or use cURL

curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{
  "aggregateData": true,
  "loadTestObjOverrides": {},
  "maxRawDataPerLoadTest": 100,
  "maxTransactionsPerLoadTest": 5,
  "minRawDataPerLoadTest": 100,
  "minTransactionsPerLoadTest": 5,
  "numOfLoadTests": 5,
  "testNameSuffix": "-generated"
}' 'http://opp-svc.mydomain.com/loadsvc/v1/datagen'