Skip to content

Update README.md #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ jobs:

- name: Test AdService
run: |
cd src/adservice
cd service/ad
go vet ./...
go test -v ./...


- name: Test CartService
run: |
cd src/cartservice
cd service/cart
go vet ./...
go test -v ./...

Expand All @@ -40,4 +40,4 @@ jobs:
channel-id: 'github-actions'
slack-message: "Dashboard tests: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
8 changes: 4 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ on:
tags: ["*"]

env:
IMAGE_NAME: xpunch/go-micro-demo-adservice
IMAGE_NAME: xpunch/go-micro-demo-ad

jobs:
adservice:
ad:
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -25,7 +25,7 @@ jobs:
id: meta
uses: docker/metadata-action@v3
with:
images: xpunch/go-micro-demo-adservice
images: xpunch/go-micro-demo-ad

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
Expand All @@ -41,7 +41,7 @@ jobs:
id: build-and-push
uses: docker/build-push-action@v3
with:
context: "{{defaultContext}}:src/adservice"
context: "{{defaultContext}}:service/ad"
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down
63 changes: 15 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,24 @@
# Go Micro Demo [![License](https://img.shields.io/:license-apache-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![GoDoc](https://godoc.org/github.com/go-micro/demo?status.svg)](https://godoc.org/github.com/go-micro/demo) [![Unit Tests](https://github.com/go-micro/demo/actions/workflows/ci.yml/badge.svg)](https://github.com/go-micro/demo/actions/workflows/ci.yml) [![Docker](https://github.com/go-micro/demo/actions/workflows/docker.yml/badge.svg)](https://github.com/go-micro/demo/actions/workflows/docker.yml) [![Go Report Card](https://goreportcard.com/badge/github.com/go-micro/demo)](https://goreportcard.com/report/github.com/go-micro/demo) [![Vistors](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fxpunch%2Fgo-micro-demo&count_bg=%2379C83D&title_bg=%23555555&icon=github.svg&icon_color=%23E7E7E7&title=Vistors&edge_flat=false)](https://hits.seeyoufarm.com)
# Go Micro Demo [![License](https://img.shields.io/:license-apache-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![GoDoc](https://godoc.org/github.com/go-micro/demo?status.svg)](https://godoc.org/github.com/go-micro/demo)

<p align="center">
<img src="src/frontend/static/icons/Hipster_HeroLogoCyan.svg" width="300" alt="Online Boutique" />
<img src="service/frontend/static/icons/Hipster_HeroLogoCyan.svg" width="300" alt="Online Boutique" />
</p>

**This application was forked from [microservices-demo](https://github.com/GoogleCloudPlatform/microservices-demo), used to demonstrate how to build micro servics with [go-micro](https://github.com/go-micro/go-micro).**

## Overview

**Online Boutique** is a cloud-native microservices demo application.
Online Boutique consists of a 11-tier microservices application. The application is a
web-based e-commerce app where users can browse items,
add them to the cart, and purchase them.

**Google uses this application to demonstrate use of technologies like
Kubernetes/GKE, Istio, Stackdriver, gRPC and OpenTelemetry**. This application
works on any Kubernetes cluster, as well as Google
Kubernetes Engine. It’s **easy to deploy with little to no configuration**.


If you’re using this demo, please **★Star** this repository to show your interest!

## Screenshots

| Home Page | Checkout Screen |
| ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| [![Screenshot of store homepage](./docs/img/online-boutique-frontend-1.png)](./docs/img/online-boutique-frontend-1.png) | [![Screenshot of checkout screen](./docs/img/online-boutique-frontend-2.png)](./docs/img/online-boutique-frontend-2.png) |

## Other Deployment Options

- **Workload Identity**: [See these instructions.](docs/workload-identity.md)
- **Istio**: [See these instructions.](docs/service-mesh.md)
- **Anthos Service Mesh**: ASM requires Workload Identity to be enabled in your GKE cluster. [See the workload identity instructions](docs/workload-identity.md) to configure and deploy the app. Then, use the [service mesh guide](/docs/service-mesh.md).
- **non-GKE clusters (Minikube, Kind)**: see the [Development Guide](/docs/development-guide.md)
- **Memorystore**: [See these instructions](/docs/memorystore.md) to replace the in-cluster `redis` database with hosted Google Cloud Memorystore (redis).
- **Cymbal Shops Branding**: [See these instructions](/docs/cymbal-shops.md)
- **NetworkPolicies**: [See these instructions](/docs/network-policies/README.md)
- **Jaeger**: [See these instructions](/docs/jaeger.md)


## Architecture

**Online Boutique** is composed of 11 microservices written in different
Expand All @@ -47,17 +29,17 @@ microservices](./docs/img/architecture-diagram.png)](./docs/img/architecture-dia

| Service | Language | Description |
| ---------------------------------------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| [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. |
| [cartservice](./src/cartservice) | Go | Stores the items in the user's shopping cart in Redis and retrieves it. |
| [productcatalogservice](./src/productcatalogservice) | Go | Provides the list of products from a JSON file and ability to search products and get individual products. |
| [currencyservice](./src/currencyservice) | Go | Converts one money amount to another currency. Uses real values fetched from European Central Bank. It's the highest QPS service. |
| [paymentservice](./src/paymentservice) | Go | Charges the given credit card info (mock) with the given amount and returns a transaction ID. |
| [shippingservice](./src/shippingservice) | Go | Gives shipping cost estimates based on the shopping cart. Ships items to the given address (mock) |
| [emailservice](./src/emailservice) | Go | Sends users an order confirmation email (mock). |
| [checkoutservice](./src/checkoutservice) | Go | Retrieves user cart, prepares order and orchestrates the payment, shipping and the email notification. |
| [recommendationservice](./src/recommendationservice) | Go | Recommends other products based on what's given in the cart. |
| [adservice](./src/adservice) | Go | Provides text ads based on given context words. |
| [loadgenerator](./src/loadgenerator) | Python+Locust | Continuously sends requests imitating realistic user shopping flows to the frontend. |
| [frontend](./service/frontend) | Go | Exposes an HTTP server to serve the website. Does not require signup/login and generates session IDs for all users automatically. |
| [cart](./service/cart) | Go | Stores the items in the user's shopping cart in Redis and retrieves it. |
| [productcatalog](./service/productcatalog) | Go | Provides the list of products from a JSON file and ability to search products and get individual products. |
| [currency](./service/currency) | Go | Converts one money amount to another currency. Uses real values fetched from European Central Bank. It's the highest QPS service. |
| [payment](./service/payment) | Go | Charges the given credit card info (mock) with the given amount and returns a transaction ID. |
| [shipping](./service/shipping) | Go | Gives shipping cost estimates based on the shopping cart. Ships items to the given address (mock) |
| [email](./service/email) | Go | Sends users an order confirmation email (mock). |
| [checkout](./service/checkout) | Go | Retrieves user cart, prepares order and orchestrates the payment, shipping and the email notification. |
| [recommendation](./service/recommendation) | Go | Recommends other products based on what's given in the cart. |
| [ad](./service/ad) | Go | Provides text ads based on given context words. |
| [loadgenerator](./service/loadgenerator) | Python+Locust | Continuously sends requests imitating realistic user shopping flows to the frontend. |

## Features

Expand All @@ -82,18 +64,3 @@ microservices](./docs/img/architecture-diagram.png)](./docs/img/architecture-dia
## Local Development

If you would like to contribute features or fixes to this app, see the [Development Guide](/docs/development-guide.md) on how to build this demo locally.

## Demos featuring Online Boutique

- [From edge to mesh: Exposing service mesh applications through GKE Ingress](https://cloud.google.com/architecture/exposing-service-mesh-apps-through-gke-ingress)
- [Take the first step toward SRE with Cloud Operations Sandbox](https://cloud.google.com/blog/products/operations/on-the-road-to-sre-with-cloud-operations-sandbox)
- [Deploying the Online Boutique sample application on Anthos Service Mesh](https://cloud.google.com/service-mesh/docs/onlineboutique-install-kpt)
- [Anthos Service Mesh Workshop: Lab Guide](https://codelabs.developers.google.com/codelabs/anthos-service-mesh-workshop)
- [KubeCon EU 2019 - Reinventing Networking: A Deep Dive into Istio's Multicluster Gateways - Steve Dake, Independent](https://youtu.be/-t2BfT59zJA?t=982)
- Google Cloud Next'18 SF
- [Day 1 Keynote](https://youtu.be/vJ9OaAqfxo4?t=2416) showing GKE On-Prem
- [Day 3 Keynote](https://youtu.be/JQPOPV_VH5w?t=815) showing Stackdriver
APM (Tracing, Code Search, Profiler, Google Cloud Build)
- [Introduction to Service Management with Istio](https://www.youtube.com/watch?v=wCJrdKdD6UM&feature=youtu.be&t=586)
- [Google Cloud Next'18 London – Keynote](https://youtu.be/nIq2pkNcfEI?t=3071)
showing Stackdriver Incident Response Management
20 changes: 10 additions & 10 deletions docs/memorystore.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Memorystore (redis) + OnlineBoutique

This guide contains instructions for overriding the default in-cluster `redis` database for `cartservice` with Memorystore (redis).
This guide contains instructions for overriding the default in-cluster `redis` database for `cart` with Memorystore (redis).

Important notes:
- You can connect to a Memorystore (redis) instance from GKE clusters that are in the same region and use the same network as your instance.
Expand Down Expand Up @@ -68,17 +68,17 @@ After a few minutes, you should see:

```
NAME READY STATUS RESTARTS AGE
adservice-76bdd69666-ckc5j 1/1 Running 0 2m58s
cartservice-66d497c6b7-dp5jr 1/1 Running 0 2m59s
checkoutservice-666c784bd6-4jd22 1/1 Running 0 3m1s
currencyservice-5d5d496984-4jmd7 1/1 Running 0 2m59s
emailservice-667457d9d6-75jcq 1/1 Running 0 3m2s
ad-76bdd69666-ckc5j 1/1 Running 0 2m58s
cart-66d497c6b7-dp5jr 1/1 Running 0 2m59s
checkout-666c784bd6-4jd22 1/1 Running 0 3m1s
currency-5d5d496984-4jmd7 1/1 Running 0 2m59s
email-667457d9d6-75jcq 1/1 Running 0 3m2s
frontend-6b8d69b9fb-wjqdg 1/1 Running 0 3m1s
loadgenerator-665b5cd444-gwqdq 1/1 Running 0 3m
paymentservice-68596d6dd6-bf6bv 1/1 Running 0 3m
productcatalogservice-557d474574-888kr 1/1 Running 0 3m
recommendationservice-69c56b74d4-7z8r5 1/1 Running 0 3m1s
shippingservice-6ccc89f8fd-v686r 1/1 Running 0 2m58s
payment-68596d6dd6-bf6bv 1/1 Running 0 3m
productcatalog-557d474574-888kr 1/1 Running 0 3m
recommendation-69c56b74d4-7z8r5 1/1 Running 0 3m1s
shipping-6ccc89f8fd-v686r 1/1 Running 0 2m58s
```

7. **Access the web frontend in a browser** using the frontend's `EXTERNAL_IP`.
Expand Down
18 changes: 9 additions & 9 deletions docs/network-policies/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ kubectl get networkpolicy
You should see:
```
NAME POD-SELECTOR AGE
adservice app=adservice 2m58s
cartservice app=cartservice 2m58s
checkoutservice app=checkoutservice 2m58s
currencyservice app=currencyservice 2m58s
ad app=ad 2m58s
cart app=cart 2m58s
checkout app=checkout 2m58s
currency app=currency 2m58s
deny-all <none> 2m58s
emailservice app=emailservice 2m58s
email app=email 2m58s
frontend app=frontend 2m58s
loadgenerator app=loadgenerator 2m58s
paymentservice app=paymentservice 2m58s
productcatalogservice app=productcatalogservice 2m58s
recommendationservice app=recommendationservice 2m58s
shippingservice app=shippingservice 2m58s
payment app=payment 2m58s
productcatalog app=productcatalog 2m58s
recommendation app=recommendation 2m58s
shipping app=shipping 2m58s
```

_Note: `Egress` is wide open in these `NetworkPolicy` resources. In our case, we do this is on purpose because there are multiple egress destinations to take into consideration like the Kubernetes DNS, Istio control plane (`istiod`), Cloud Trace API, Cloud Profiler API, Cloud Debugger API, etc._
Expand Down
4 changes: 2 additions & 2 deletions docs/network-policies/network-policy-adservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: adservice
name: ad
spec:
podSelector:
matchLabels:
app: adservice
app: ad
policyTypes:
- Ingress
- Egress
Expand Down
6 changes: 3 additions & 3 deletions docs/network-policies/network-policy-cartservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: cartservice
name: cart
spec:
podSelector:
matchLabels:
app: cartservice
app: cart
policyTypes:
- Ingress
- Egress
Expand All @@ -30,7 +30,7 @@ spec:
app: frontend
- podSelector:
matchLabels:
app: checkoutservice
app: checkout
ports:
- port: 7070
protocol: TCP
Expand Down
4 changes: 2 additions & 2 deletions docs/network-policies/network-policy-checkoutservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: checkoutservice
name: checkout
spec:
podSelector:
matchLabels:
app: checkoutservice
app: checkout
policyTypes:
- Ingress
- Egress
Expand Down
6 changes: 3 additions & 3 deletions docs/network-policies/network-policy-currencyservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: currencyservice
name: currency
spec:
podSelector:
matchLabels:
app: currencyservice
app: currency
policyTypes:
- Ingress
- Egress
Expand All @@ -30,7 +30,7 @@ spec:
app: frontend
- podSelector:
matchLabels:
app: checkoutservice
app: checkout
ports:
- port: 7000
protocol: TCP
Expand Down
6 changes: 3 additions & 3 deletions docs/network-policies/network-policy-emailservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: emailservice
name: email
spec:
podSelector:
matchLabels:
app: emailservice
app: email
policyTypes:
- Ingress
- Egress
ingress:
- from:
- podSelector:
matchLabels:
app: checkoutservice
app: checkout
ports:
- port: 8080
protocol: TCP
Expand Down
6 changes: 3 additions & 3 deletions docs/network-policies/network-policy-paymentservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: paymentservice
name: payment
spec:
podSelector:
matchLabels:
app: paymentservice
app: payment
policyTypes:
- Ingress
- Egress
ingress:
- from:
- podSelector:
matchLabels:
app: checkoutservice
app: checkout
ports:
- port: 50051
protocol: TCP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: productcatalogservice
name: productcatalog
spec:
podSelector:
matchLabels:
app: productcatalogservice
app: productcatalog
policyTypes:
- Ingress
- Egress
Expand All @@ -30,10 +30,10 @@ spec:
app: frontend
- podSelector:
matchLabels:
app: checkoutservice
app: checkout
- podSelector:
matchLabels:
app: recommendationservice
app: recommendation
ports:
- port: 3550
protocol: TCP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: recommendationservice
name: recommendation
spec:
podSelector:
matchLabels:
app: recommendationservice
app: recommendation
policyTypes:
- Ingress
- Egress
Expand Down
2 changes: 1 addition & 1 deletion docs/network-policies/network-policy-redis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ spec:
- from:
- podSelector:
matchLabels:
app: cartservice
app: cart
ports:
- port: 6379
protocol: TCP
Expand Down
Loading
Loading