Skip to content

Latest commit

 

History

History
195 lines (138 loc) · 4.32 KB

README.adoc

File metadata and controls

195 lines (138 loc) · 4.32 KB

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}')"