-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathREADME.md
141 lines (104 loc) · 7.68 KB
/
README.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<p align="center">
<img src="src/frontend/static/icons/Hipster_HeroLogoCyan.svg" width="300" alt="Online Boutique" />
</p>
**[Online Boutique](https://microservices.honeydemo.io)** is a cloud-native
microservices demo application. Online Boutique consists of a 10-tier
microservices application, written in 5 different languages: Go, Java, .NET,
Node, and Python. The application is a web-based e-commerce platform where users
can browse items, add them to a cart, and purchase them.
**[Signadot](https://signadot.com)** uses this application to demonstrate the
use of technologies like Kubernetes, gRPC, and OpenTelemetry. This application
works on any Kubernetes cluster. It’s **easy to deploy with little to no
configuration**.
## Screenshots
| Home Page | Checkout Screen |
|-------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------|
| [](./docs/img/online-boutique-frontend-1.png) | [](./docs/img/online-boutique-frontend-2.png) |
## OpenTelemetry
Online Boutique is instrumented using the
[OpenTelemetry](https://opentelemetry.io) framework. There are simple and
advanced instrumentation techniques offered by OpenTelemetry that are leveraged
in the application. Each service in the [src](./src) folder explains how
OpenTelemetry was used with specific code examples.
## Development
### Prerequisites
- [Docker for Desktop](https://www.docker.com/products/docker-desktop)
- [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl), a CLI to interact
with Kubernetes
- [skaffold]( https://skaffold.dev/docs/install/), a tool that builds and
deploys Docker images in bulk
- [Helm](https://helm.sh), a package manager for Kubernetes
### Install
1. Launch a local Kubernetes cluster with one of the following options:
- To launch **Minikube** (tested with Ubuntu Linux). Please, ensure that the
local Kubernetes cluster has at least:
- 4 CPUs
- 4.0 GiB memory
- 32 GB disk space
```shell
minikube start --cpus=4 --memory 4096 --disk-size 32g
```
- To launch **Docker for Desktop** (tested with Mac/Windows). Go to Preferences:
- choose “Enable Kubernetes”,
- set CPUs to at least 3, and Memory to at least 6.0 GiB
- on the "Disk" tab, set at least 32 GB disk space
2. Run `kubectl get nodes` to verify you're connected to the respective control
plane.
3. Run `skaffold run` (first time will be slow, it can take ~20 minutes). This
will build and deploy the application. If you need to rebuild the images
automatically as you refactor the code, run `skaffold dev` command.
4. Run `kubectl get pods` to verify the Pods are ready and running.
5. Access the web frontend through your browser
- **Minikube** requires you to run a command to access the frontend service:
```shell
minikube service frontend-external
```
- **Docker For Desktop** should automatically provide the frontend at
http://localhost:80
### Cleanup
If you've deployed the application with `skaffold run` command, you can run
`skaffold delete` to clean up the deployed resources.
## Architecture
**Online Boutique** is composed of 10 microservices (plus a load generator)
written in 5 different languages that communicate with each other over gRPC.
[](./docs/img/architecture-diagram.png)
Find **Protocol Buffers Descriptions** at the [`./pb` directory](./pb).
| Service | Language | Description |
|------------------------------------------------------|---------------|-----------------------------------------------------------------------------------------------------------------------------------|
| [adservice](./src/adservice) | Java | Provides text ads based on given context words. |
| [cartservice](./src/cartservice) | C# | Stores the items in the user's shopping cart in Redis and retrieves it. |
| [checkoutservice](./src/checkoutservice) | Go | Retrieves user cart, prepares order and orchestrates the payment, shipping and the email notification. |
| [currencyservice](./src/currencyservice) | Node.js | Converts one money amount to another currency. Uses real values fetched from European Central Bank. It's the highest QPS service. |
| [emailservice](./src/emailservice) | Python | Sends users an order confirmation email (mock). |
| [frontend](./src/frontend) | Go | Exposes an HTTP server to serve the website. Does not require signup/login and generates session IDs for all users automatically. |
| [loadgenerator](./src/loadgenerator) | Python/Locust | Continuously sends requests imitating realistic user shopping flows to the frontend. |
| [paymentservice](./src/paymentservice) | Node.js | Charges the given credit card info (mock) with the given amount and returns a transaction ID. |
| [productcatalogservice](./src/productcatalogservice) | Go | Provides the list of products from a JSON file and ability to search products and get individual products. |
| [recommendationservice](./src/recommendationservice) | Python | Recommends other products based on what's given in the cart. |
| [shippingservice](./src/shippingservice) | Go | Gives shipping cost estimates based on the shopping cart. Ships items to the given address (mock) |
## Features
- **[Kubernetes](https://kubernetes.io):** The app is designed to run on
Kubernetes
- **[gRPC](https://grpc.io):** Microservices use a high volume of gRPC calls to
communicate to each other.
- **[OpenTelemetry](https://opentelemetry.io/) Tracing:** Most services are
instrumented using OpenTelemetry trace providers for gRPC/HTTP.
- **[Skaffold](https://skaffold.dev):** Application is deployed to Kubernetes
with a single command using Skaffold.
- **Synthetic Load Generation:** The application demo comes with a background
job that creates realistic usage patterns on the website using
[Locust](https://locust.io/) load generator.
## History
This project originated from Honeycomb's [Microservices
Demo](https://github.com/honeycombio/microservices-demo/), which itself was
derived from the excellent Google Cloud Platform [Microservices
Demo](https://github.com/GoogleCloudPlatform/microservices-demo). It was forked
in 2022.
## Application demo
This application will exhibit usage of Sandbox environments using the
[Signadot](https://signadot.com) platform. See [feature testing
guide](https://github.com/signadot/microservices-demo/blob/main/docs/feature-testing.md)
for more details.
---
This is not an official Signadot or Google project.