Skip to content

kameshsampath/sample.daytrader8

 
 

Repository files navigation

Day Trader

The heritage Stock trading application based on J2EE.

Prepare Cluster

Ensure the following operator is installed in cluster:

[NOTE]: In OpenShift the operators can be installed via Operator Hub integration from Administrator console.

Clone the sources

git clone -b sko-demo https://github.com/kameshsampath/sample.daytrader8

We will refer to the cloned project sources folder as $PROJECT_HOME.

cd $PROJECT_HOME

Deploy Databases

On clusters where heritage application sampledaytrader is deployed, deployed MySQL:

oc apply -k k8s/db/prod

Deploy Application

oc apply -k k8s/sampledaytrader8/prod
export DAYTRADER_ROUTE="https://$(oc get route daytrader -ojsonpath='{.spec.host}')"

Create and Populate the DB tables

Create the application DB tables,

Config buildTables

(OR)

curl -X GET "$DAYTRADER_ROUTE/io.openliberty.sample.daytrader8/config?action=buildDBTables"
oc scale --replicas=0 deploy/sampledaytrader8
oc scale --replicas=1 deploy/sampledaytrader8

Populate the tables with sample data,

Config populate Tables

(OR)

curl -X GET "$DAYTRADER_ROUTE/io.openliberty.sample.daytrader8/config?action=buildDB"

Deploy Kafka

oc apply -k k8s/kafka/prod

Deploy Debezium KafkaConnect and MySQL KafkaConnector

oc apply -k k8s/debezium/prod

NOTE: This will take few mins for the Connector to be activated

Wait for the KafkaConnect daytrader-debezium-connect pod to be running:

watch oc get pods -n daytrader -l=strimzi.io/name=daytrader-debezium-connect

A successful KafkaConnect should show "Ready" to be "True":

oc get KafkaConnect  -n daytrader daytrader-debezium -ojsonpath='{.status.conditions[?(@.type=="Ready")].status}'

NOTE: It will take few seconds for the KafkaConnector to be reconciled. Wait for few mins before you run the following commands to check the status.

Check the status of the mysql-daytrader-connector to be ready:

oc get KafkaConnector mysql-daytrader-connector -ojsonpath='{.status.conditions[?(@.type=="Ready")].status}'

List Kafka Topics

./scripts/kafka-list-topics daytrader

Will list the following topics:

__consumer_offsets
connect-cluster-configs
connect-cluster-offsets
connect-cluster-status
openshift
openshift.traderdb.accountejb
openshift.traderdb.accountprofileejb
openshift.traderdb.holdingejb
openshift.traderdb.keygenejb
openshift.traderdb.orderejb
openshift.traderdb.outboxevent
openshift.traderdb.quoteejb
schema-changes.traderdb
Note
If you don’t see all the topics as listed, try restarting the debezium connector pod
oc scale --replicas=0 deploy/daytrader-debezium-connect
oc scale --replicas=1 deploy/daytrader-debezium-connect

Access the Application

open $DAYTRADER_ROUTE/io.openliberty.sample.daytrader8/

Development

Building Debezium MySql Connector

cd k8s/debezium
docker build --no-cache <container-registry>/debezium-connect
docker push <container-registry>/debezium-connect

NOTE: Be sure to update the k8s/debezium/debezium-connect.yaml with an image from the build

Image Streams

oc create -f https://raw.githubusercontent.com/OpenLiberty/open-liberty-s2i/master/imagestreams/openliberty-ubi-min.json

Deploy Application

oc new-app openliberty:~https://github.com/kameshsampath/sample.daytrader8#sko-demo -n daytrader-dev
oc create route edge --service=sampledaytrader8 --port=9080 daytrader
export DAYTRADER_ROUTE="https://$(oc get route daytrader -ojsonpath='{.spec.host}')"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 77.2%
  • HTML 22.1%
  • Other 0.7%