Skip to content

Commit

Permalink
Adding Google online boutique demo as sample application
Browse files Browse the repository at this point in the history
  • Loading branch information
Anne McCormick committed Nov 21, 2022
1 parent 9b8f7f5 commit bb47d44
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 106 deletions.
142 changes: 38 additions & 104 deletions 02.application-deployment.md
Original file line number Diff line number Diff line change
@@ -1,129 +1,63 @@
# 02. Application deployment

Follow these few steps to install the Bookinfo use application on your kubernetes cluster.
Follow these few steps to install the Google microservices online boutique demo application on your Kubernetes cluster.

## Task 1. Create a labeled/protected namespace
## Task 1. Label namespace for side-car injection

APIClarity will use istio to monitor application traffic.
APIClarity will use Istio to monitor application traffic.

Create a dedicated namespace for the user application.
Add an istio-injection label so that istio automatically inserts envoy proxy to the user application.
The boutique demo microservices run in the default namespace.
Add an Istio-injection label so that Istio automatically inserts an envoy proxy to each microservice application.

```bash
kubectl create namespace bookinfo
kubectl label namespace bookinfo istio-injection=enabled --overwrite
kubectl label namespace default istio-injection=enabled --overwrite
```

## Task 2. Deploy Bookinfo application
## Task 2. Deploy online boutique application

The Bookinfo application displays information about a book, similar to a single catalog entry of an online book store. Displayed on the page is a description of the book, book details (ISBN, number of pages, and so on), and a few book reviews.

The Bookinfo application is broken into four separate microservices:

* productpage. The productpage microservice calls the details and reviews microservices to populate the page.
* details. The details microservice contains book information.
* reviews. The reviews microservice contains book reviews. It also calls the ratings microservice.
* ratings. The ratings microservice contains book ranking information that accompanies a book review.

There are 3 versions of the reviews microservice:

* Version v1 doesn’t call the ratings service.
* Version v2 calls the ratings service, and displays each rating as 1 to 5 black stars.
* Version v3 calls the ratings service, and displays each rating as 1 to 5 red stars.
The boutique demo deploys 11 microservices to simulate an e-commerce application. More information can be found here: https://github.com/GoogleCloudPlatform/microservices-demo

The end-to-end architecture of the application is shown below.

![](images/booinfo-istio.svg)
![](images/architecture-diagram.png)

As the application architecture is based on micro-services which use REST APIs for inter communication,
As the application architecture is based on microservices which use REST APIs for inter-communication,
APIClarity can analyse it.

Run the following command to install the BookInfo application:
Run the following commands to install the Boutique demo application:

```bash
kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.15/samples/bookinfo/platform/kube/bookinfo.yaml --namespace=bookinfo
git clone https://github.com/GoogleCloudPlatform/microservices-demo.git
kubectl apply -f microservices-demo/release/kubernetes-manifests.yaml
```

You should have a similar output:

```console
service/details created
serviceaccount/bookinfo-details created
deployment.apps/details-v1 created
service/ratings created
serviceaccount/bookinfo-ratings created
deployment.apps/ratings-v1 created
service/reviews created
serviceaccount/bookinfo-reviews created
deployment.apps/reviews-v1 created
deployment.apps/reviews-v2 created
deployment.apps/reviews-v3 created
service/productpage created
serviceaccount/bookinfo-productpage created
deployment.apps/productpage-v1 created
deployment.apps/emailservice created
service/emailservice created
deployment.apps/checkoutservice created
service/checkoutservice created
deployment.apps/recommendationservice created
service/recommendationservice created
deployment.apps/frontend created
service/frontend created
service/frontend-external created
deployment.apps/paymentservice created
service/paymentservice created
deployment.apps/productcatalogservice created
service/productcatalogservice created
deployment.apps/cartservice created
service/cartservice created
deployment.apps/loadgenerator created
deployment.apps/currencyservice created
service/currencyservice created
deployment.apps/shippingservice created
service/shippingservice created
deployment.apps/redis-cart created
service/redis-cart created
deployment.apps/adservice created
service/adservice created
```

## Task 3. Generate traffic

[Locust](https://docs.locust.io/en/stable/#) is deployed next to simulate periodic user requests.

Run the following command:

```bash
cat > locust.yaml << EOF
apiVersion: v1
kind: ConfigMap
metadata:
name: reviews-inject-config
data:
locustfile.py: |
from locust import HttpUser, task
class HelloWorldUser(HttpUser):
@task
def hello_world(self):
self.client.get("/productpage?u=normal")
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: reviews-inject-v1
labels:
app: reviews-inject
version: v1
spec:
replicas: 1
selector:
matchLabels:
app: reviews-inject
version: v1
template:
metadata:
labels:
app: reviews-inject
version: v1
annotations:
sidecar.istio.io/inject: "false"
spec:
volumes:
- name: config-volume
configMap:
name: reviews-inject-config
containers:
- name: reviews-inject
image: locustio/locust
volumeMounts:
- name: config-volume
mountPath: /bookinfo/locustfile.py
subPath: locustfile.py
command:
- /bin/bash
- -c
- "locust -f /bookinfo/locustfile.py --headless -u 1 -r 1 --host http://productpage.bookinfo.svc.cluster.local:9080"
EOF
```

Then apply the locust configuration

```bash
kubectl apply -f locust.yaml
```
The boutique demo comes with a load generator that automatically runs in the background to simulate REST API requests to the other services.
4 changes: 2 additions & 2 deletions 03.apiclarity-setup.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 03. APIClarity setup

Follow these few steps to install APIClarity on your kubernetes cluster.
Follow these few steps to install APIClarity on your Kubernetes cluster.

## Task 1. Install APIClarity

Expand All @@ -14,7 +14,7 @@ Don't forget to specify which namespaces are monitored by APIClarity.
```bash
helm install \
--set trafficSource.envoyWasm.enabled=true \
--set trafficSource.envoyWasm.namespaces=bookinfo \
--set trafficSource.envoyWasm.namespaces=default \
--create-namespace \
--namespace apiclarity \
apiclarity \
Expand Down
Binary file added images/architecture-diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bb47d44

Please sign in to comment.