IBMStockTrader / trade-history

Microservice that keeps a detailed history of all stock trades
Apache License 2.0
1 stars 19 forks source link

trade-history

Microservice that keeps a detailed history of all stock trades

Configuration

If you wish to build locally, setup up your environment variables in your server.env file.

TOPIC="..."
BOOTSTRAP_SERVER="..."
CONSUMER_API_KEY="..."

MONGO_PASSWORD=...
MONGO_USER=...
MONGO_AUTH_DB=...
MONGO_IP=...
MONGO_PORT=...
MONGO_DATABASE=...

If you plan to deploy your application to a cloud environment, you can configure the same properties using Kubernetes Secrets. The bindings.yml links the secrets to the environment variables in the docker container.

Build and run

Run this from the project directory root:

mvn clean install

To run the project from the target directory:

mvn liberty:run-server

The application should be accessible from http://localhost:9080

Docker

Build the docker container from the root directory:

docker build -t trade-history .

To run the docker containter locally:

docker run -p 9080:9080 trade-history

The application should be accessible from http://localhost:9080

ICP Setup and Deployment

Prerequisites:

  1. Install Cloudctl ClI
  2. Install Kubectl ClI

Steps:

  1. Login to your ICP instance using cloudctl from the machine you wish to deploy from.
  2. Configure your client and set your Kubectl context by copying and pasting the configure client
  3. Follow the Kubernetes General Deployment Instructions to deploy the application.

Kubernetes General Deployment

After building the docker container locally, use the helm chart from the charts directory to deploy:

helm package chart/tradehistory/ --debug
helm install tradehistory-1.0.0.tgz --name tradehistory-release