- Explore sample apps
- 1. Create cluster
- 2. Install Yugastore
- 3. Start the app
- 4. Add items to the cart
- 5. Verify the completed order
- 6. Run IoT Fleet Management app
- 1. Create cluster
- 2. Install Yugastore
- 3. Start the app
- 4. Add items to the cart
- 5. Verify the completed order
- 6. Run IoT Fleet Management app
- 1. Create a cluster
- 2. Install Yugastore
- 3. Run a load tester
- 4. Observe effects of load on YugabyteDB Admin UI
- 5. Review Yugastore architecture and code
- 6. Run IoT Fleet Management app
- 1. Create a cluster
- 2. Install Yugastore
- 3. Run a load tester
- 4. Observe effects of load on YugabyteDB Admin UI
- 5. Review Yugastore architecture and code
- 6. Run IoT Fleet Management app
Explore sample apps
After creating a local cluster, follow the instructions below to run the Yugastore application.
After running Yugastore, we recommend running the IoT Fleet Management application. This app is built on top of YugabyteDB as the database (using the YCQL API), Confluent Kafka as the message broker, KSQL or Apache Spark Streaming for real-time analytics and Spring Boot as the application framework.
Yugastore-java app is an end-to-end ecommerce application built using a microservices design pattern. React UI, Spring Boot app framework and YugabyteDB (both YSQL and YCQL) are used as the underlying technology stack.
1. Create cluster
Create a cluster.
$ ./bin/yb-ctl create
Clients can now connect to the YSQL API at localhost:5433
and YCQL API at localhost:9042
.
2. Install Yugastore
Clone the repo.
$ git clone https://github.com/yugabyte/yugastore-java.git
$ cd yugastore-java
Create the app binaries.
$ mvn -DskipTests package
Create the app’s schema in YugabyteDB.
$ cd resources
$ $YUGABYTE_HOME/bin/ysqlsh -f schema.sql
$ $YUGABYTE_HOME/bin/cqlsh -f schema.cql
Load the initial data.
$ ./dataload.sh
3. Start the app
Start the Eureka discovery service. After starting, verify that the service is running at http://localhost:8761/.
$ cd eureka-server-local/ && mvn spring-boot:run
Start the API gateway microservice.
$ cd api-gateway-microservice/ && mvn spring-boot:run
Start the products microservice.
$ cd products-microservice/ && mvn spring-boot:run
Start the checkout microservice.
$ cd checkout-microservice/ && mvn spring-boot:run
Start the UI service. After starting, browse the app at http://localhost:8080/.
$ cd react-ui/ && mvn spring-boot:run
4. Add items to the cart
Add two items to the cart as shown below.
Verify that your cart is now stored inside the YSQL shopping_cart
table. From your YugabyteDB local cluster home, run the following.
$ ./bin/ysqlsh
yugabyte=# select * from shopping_cart;
cart_key | user_id | asin | time_added | quantity
------------------+---------+------------+-------------------------+----------
u1001-0001048236 | u1001 | 0001048236 | 2019-05-29T13:46:54.046 | 1
u1001-0001048775 | u1001 | 0001048775 | 2019-05-29T13:46:56.055 | 1
(2 rows)
5. Verify the completed order
Now complete the checkout and observe the order number generated.
Verify that this order number is now in the YCQL orders
table.
$ ./bin/cqlsh localhost
cqlsh> select * from cronos.orders;
order_id | user_id | order_details | order_time | order_total
--------------------------------------+---------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------+-------------
119b96dc-7d1a-4f2f-a1dd-36def25348e0 | 1 | Customer bought these Items: Product: The Sherlock Holmes Audio Collection, Quantity: 1; Product: Measure for Measure: Complete & Unabridged, Quantity: 1; Order Total is : 741.95 | 2019-05-29T13:54:04.093 | 741.95
Verify that there are no active shopping carts in YSQL at this point.
yugabyte=# select * from shopping_cart;
cart_key | user_id | asin | time_added | quantity
----------+---------+------+------------+----------
(0 rows)
6. Run IoT Fleet Management app
After running Yugastore, we recommend running the IoT Fleet Management app. This app is built on top of YugabyteDB as the database (using the YCQL API), Confluent Kafka as the message broker, KSQL or Apache Spark Streaming for real-time analytics and Spring Boot as the application framework.
Yugastore-java app is an end-to-end ecommerce application built using a microservices design pattern. React UI, Spring Boot app framework and YugabyteDB (both YSQL and YCQL) are used as the underlying technology stack.
1. Create cluster
Create a cluster.
$ ./bin/yb-ctl create
Clients can now connect to the YSQL API at localhost:5433
and YCQL API at localhost:9042
.
2. Install Yugastore
Clone the repo.
$ git clone https://github.com/yugabyte/yugastore-java.git
$ cd yugastore-java
Create the app binaries.
$ mvn -DskipTests package
Create the app’s schema in YugabyteDB.
$ cd resources
$ $YUGABYTE_HOME/bin/ysqlsh -f schema.sql
$ $YUGABYTE_HOME/bin/cqlsh -f schema.cql
Load the initial data.
$ ./dataload.sh
3. Start the app
Start the Eureka discovery service. After starting, verify that the service is running at http://localhost:8761/.
$ cd eureka-server-local/ && mvn spring-boot:run
Start the API gateway microservice.
$ cd api-gateway-microservice/ && mvn spring-boot:run
Start the products microservice.
$ cd products-microservice/ && mvn spring-boot:run
Start the checkout microservice.
$ cd checkout-microservice/ && mvn spring-boot:run
Start the UI service. After starting, browse the app at http://localhost:8080/.
$ cd react-ui/ && mvn spring-boot:run
4. Add items to the cart
Add two items to the cart as shown below.
Verify that your cart is now stored inside the YSQL shopping_cart
table. From your YugabyteDB local cluster home, run the following.
$ ./bin/ysqlsh
yugabyte=# select * from shopping_cart;
cart_key | user_id | asin | time_added | quantity
------------------+---------+------------+-------------------------+----------
u1001-0001048236 | u1001 | 0001048236 | 2019-05-29T13:46:54.046 | 1
u1001-0001048775 | u1001 | 0001048775 | 2019-05-29T13:46:56.055 | 1
(2 rows)
5. Verify the completed order
Now complete the checkout and observe the order number generated.
Verify that this order number is now in the YCQL orders
table.
$ ./bin/cqlsh localhost
cqlsh> select * from cronos.orders;
order_id | user_id | order_details | order_time | order_total
--------------------------------------+---------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------+-------------
119b96dc-7d1a-4f2f-a1dd-36def25348e0 | 1 | Customer bought these Items: Product: The Sherlock Holmes Audio Collection, Quantity: 1; Product: Measure for Measure: Complete & Unabridged, Quantity: 1; Order Total is : 741.95 | 2019-05-29T13:54:04.093 | 741.95
Verify that there are no active shopping carts in YSQL at this point.
yugabyte=# select * from shopping_cart;
cart_key | user_id | asin | time_added | quantity
----------+---------+------+------------+----------
(0 rows)
6. Run IoT Fleet Management app
After running Yugastore, we recommend running the IoT Fleet Management app. This app is built on top of YugabyteDB as the database (using the YCQL API), Confluent Kafka as the message broker, KSQL or Apache Spark Streaming for real-time analytics and Spring Boot as the application framework.
Yugastore app is a sample ecommerce application built using a microservices design pattern. React UI, Node.js Express app framework and YugabyteDB (YCQL and YEDIS) are used as the underlying technology stack.
1. Create a cluster
Create a cluster. The YEDIS API is initialized along with cluster creation so nothing additional needs to be done.
$ ./yb-docker-ctl -rf 3 create
Clients can now connect to the YSQL API at localhost:5433
, YCQL API at localhost:9042
, and YEDIS API at localhost:6379
.
2. Install Yugastore
$ docker run -p 3001:3001 -d --network yb-net --name yugastore yugabytedb/yugastore
You can see the Yugastore app at http://localhost:3001.
3. Run a load tester
$ docker exec -it yugastore node /usr/local/yugastore/test/sample-user.js
4. Observe effects of load on YugabyteDB Admin UI
Now you can observe the effects of the read/write operations generated by the load tester by simply going to the YugabyteDB Admin UI at http://localhost:7000.
5. Review Yugastore architecture and code
Details of Yugastore architecture are documented here. Source code is available in the Yugastore GitHub repo.
6. Run IoT Fleet Management app
After running Yugastore, we recommend running the IoT Fleet Management app. This app is built on top of YugabyteDB as the database (using the YCQL API), Confluent Kafka as the message broker, KSQL or Apache Spark Streaming for real-time analytics and Spring Boot as the application framework.
Yugastore app is a sample ecommerce application built using a microservices design pattern. React UI, Node.js Express app framework and YugabyteDB (YCQL and YEDIS) are used as the underlying technology stack.
1. Create a cluster
Create a cluster.
$ kubectl apply -f yugabyte-statefulset.yaml
Initialize the YEDIS API.
$ kubectl exec -it yb-master-0 /home/yugabyte/bin/yb-admin -- --master_addresses yb-master-0.yb-masters.default.svc.cluster.local:7100,yb-master-1.yb-masters.default.svc.cluster.local:7100,yb-master-2.yb-masters.default.svc.cluster.local:7100 setup_redis_table
Clients can now connect to the YSQL, YCQL and YEDIS APIs of the cluster at 5433, 9042 and 6379 ports respectively.
2. Install Yugastore
$ kubectl run yugastore --image=yugabytedb/yugastore:latest --port=3001 --command -- /usr/local/yugastore/bin/start-for-kubernetes.sh
Verify the deployment.
$ kubectl get deployments
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
yugastore 1 1 1 1 13m
Check all the pods.
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
yb-master-0 1/1 Running 0 7h
yb-master-1 1/1 Running 0 7h
yb-master-2 1/1 Running 0 7h
yb-tserver-0 1/1 Running 0 7h
yb-tserver-1 1/1 Running 0 7h
yb-tserver-2 1/1 Running 0 7h
yugastore-55d7c6965-ql95t 1/1 Running 0 13m
Note the yugastore pod ID above so that you can redirect its 3001 port to the localhost’s 3001.
$ kubectl port-forward yugastore-55d7c6965-ql95t 3001
Now you can see the Yugastore app at http://localhost:3001.
3. Run a load tester
You can do this as shown below.
$ kubectl exec -it yugastore-55d7c6965-ql95t node /usr/local/yugastore/test/sample-user.js
4. Observe effects of load on YugabyteDB Admin UI
Now you can observe the effects of the read/write operations generated by the load tester by simply going to the YugabyteDB Admin UI. First we have to find the Admin UI URL using the command below.
$ minikube service yb-master-ui --url
http://192.168.99.100:31283
The above output is the Admin UI URL and visiting the Tablet Servers page there will show you the current state of the cluster.
5. Review Yugastore architecture and code
Details of Yugastore architecture are documented here. Source code is available in the Yugastore GitHub repo.
6. Run IoT Fleet Management app
After running Yugastore, we recommend running the IoT Fleet Management app. This app is built on top of YugabyteDB as the database (using the YCQL API), Confluent Kafka as the message broker, KSQL or Apache Spark Streaming for real-time analytics and Spring Boot as the application framework.