Project: YugabyteDB (App Definition and Development / Database)
File: explore-sample-apps.md

title: Install Yugastore headerTitle: Install Yugastore linkTitle: Install Yugastore description: Install the Yugastore sample application. headcontent: Run the Yugastore sample application menu: v2.18: identifier: explore-sample-apps parent: ecommerce-app weight: 125 type: docs After , follow the instructions on this page to run the Yugastore application. 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. {{< tabpane text=true >}} {{% tab header="Environment" disabled=true /%}} {{% tab header="macOS" lang="macos" %}} Clone the repository. ```sh $ git clone https://github.com/YugabyteDB-Samples/yugastore-java.git ``` ```sh $ cd yugastore-java ``` Create the app binaries. ```sh $ mvn -DskipTests package ``` Create the app's schema in YugabyteDB. ```sh $ cd resources ``` ```sh $ $YUGABYTE_HOME/bin/ysqlsh -f schema.sql ``` ```sh $ $YUGABYTE_HOME/bin/ycqlsh -f schema.cql ``` Load the initial data. ```sh $ ./dataload.sh ``` {{% /tab %}} {{% tab header="Linux" lang="linux" %}} Clone the repository. ```sh $ git clone https://github.com/YugabyteDB-Samples/yugastore-java.git ``` ```sh $ cd yugastore-java ``` Create the app binaries. ```sh $ mvn -DskipTests package ``` Create the app's schema in YugabyteDB. ```sh $ cd resources ``` ```sh $ $YUGABYTE_HOME/bin/ysqlsh -f schema.sql ``` ```sh $ $YUGABYTE_HOME/bin/ycqlsh -f schema.cql ``` Load the initial data. ```sh $ ./dataload.sh ``` {{% /tab %}} {{% tab header="Kubernetes" lang="k8s" %}} Run the following command: ```sh $ kubectl run yugastore --image=yugabytedb/yugastore:latest --port=3001 --command -- /usr/local/yugastore/bin/start-for-kubernetes.sh ``` Verify the deployment. ```sh $ kubectl get deployments ``` ```output NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE yugastore 1 1 1 1 13m ``` Check all the pods. ```sh $ kubectl get pods ``` ```output 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 ``` {{% /tab %}} {{% tab header="Docker" lang="docker" %}} Run the following command: ```sh $ docker run -p 3001:3001 -d --network yb-net --name yugastore yugabytedb/yugastore ``` {{% /tab %}} {{< /tabpane >}} {{< tabpane text=true >}} {{% tab header="Environment" disabled=true /%}} {{% tab header="macOS" lang="macos" %}} Start the Eureka discovery service. After starting, verify that the service is running at `http://localhost:8761/`. ```sh $ cd eureka-server-local/ && mvn spring-boot:run ``` Start the API gateway microservice. ```sh $ cd api-gateway-microservice/ && mvn spring-boot:run ``` Start the products microservice. ```sh $ cd products-microservice/ && mvn spring-boot:run ``` Start the checkout

```sh $ cd checkout-microservice/ && mvn spring-boot:run ``` Start the UI service. After starting, browse the app at <http://localhost:8080/>. ```sh $ cd react-ui/ && mvn spring-boot:run ``` {{% /tab %}} {{% tab header="Linux" lang="linux" %}} Start the Eureka discovery service. After starting, verify that the service is running at `http://localhost:8761/`. ```sh $ cd eureka-server-local/ && mvn spring-boot:run ``` Start the API gateway microservice. ```sh $ cd api-gateway-microservice/ && mvn spring-boot:run ``` Start the products microservice. ```sh $ cd products-microservice/ && mvn spring-boot:run ``` Start the checkout microservice. ```sh $ cd checkout-microservice/ && mvn spring-boot:run ``` Start the UI service. After starting, browse the app at <http://localhost:8080/>. ```sh $ cd react-ui/ && mvn spring-boot:run ``` {{% /tab %}} {{% tab header="Kubernetes" lang="k8s" %}} Redirect the yugastore pod's port 3001 to the local host. The pod ID (`yugastore-55d7...`) is the last line of the output in the previous step. ```sh $ kubectl port-forward yugastore-55d7c6965-ql95t 3001 ``` Open the Yugastore app in your browser at <http://localhost:3001>. {{% /tab %}} {{% tab header="Docker" lang="docker" %}} The Yugastore app is already running. Open it in your browser at <http://localhost:3001>. {{% /tab %}} {{< /tabpane >}} Add two items to the cart. Verify that your cart is now stored inside the YSQL `shopping_cart` table. From your YugabyteDB local cluster home, run the following: ```sh $ ./bin/ysqlsh ``` ```sql yugabyte=# select * from shopping_cart; ``` ```output cartkey | userid | 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) ``` Complete the checkout and observe the order number generated. Verify that this order number is now in the YCQL `orders` table. ```sh $ ./bin/ycqlsh localhost ``` ```sh ycqlsh> select * from cronos.orders; ``` ```output orderid | userid | orderdetails | ordertime | 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 &amp; 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. ```sh yugabyte=# select * from shopping_cart; ``` ```output cartkey | userid | asin | time_added | quantity -++++- (0 rows) ``` After running Yugastore, try the application. IoT Fleet Management 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.