README formatting (#158)

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
This commit is contained in:
Ahmet Alp Balkan 2019-02-20 14:34:12 -08:00 committed by GitHub
parent bae651f7ea
commit 5f41e12b2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,13 +12,13 @@ Kubernetes Engine. Its **easy to deploy with little to no configuration**.
If youre using this demo, please **★Star** this repository to show your interest!
> 👓**Note to Googlers:** Please fill out the form at
[go/microservices-demo](http://go/microservices-demo) if you are using this
application.
> [go/microservices-demo](http://go/microservices-demo) if you are using this
> application.
## Screenshots
| Home Page | Checkout Screen |
|-----------|-----------------|
| ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| [![Screenshot of store homepage](./docs/img/hipster-shop-frontend-1.png)](./docs/img/hipster-shop-frontend-1.png) | [![Screenshot of checkout screen](./docs/img/hipster-shop-frontend-2.png)](./docs/img/hipster-shop-frontend-2.png) |
## Service Architecture
@ -32,7 +32,7 @@ microservices](./docs/img/architecture-diagram.png)](./docs/img/architecture-dia
Find **Protocol Buffers Descriptions** at the [`./pb` directory](./pb).
| 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) | C# | Stores the items in the user's shipping 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. |
@ -45,7 +45,6 @@ Find **Protocol Buffers Descriptions** at the [`./pb` directory](./pb).
| [adservice](./src/adservice) | Java | Provides text ads based on given context words. |
| [loadgenerator](./src/loadgenerator) | Python/Locust | Continuously sends requests imitating realistic user shopping flows to the frontend. |
## Features
- **[Kubernetes](https://kubernetes.io)/[GKE](https://cloud.google.com/kubernetes-engine/):**
@ -84,7 +83,6 @@ We offer three installation methods:
option, you will use pre-built container images that are available publicly,
instead of building them yourself, which takes a long time).
### Option 1: Running locally with “Docker for Desktop”
> 💡 Recommended if you're planning to develop the application or giving it a
@ -99,16 +97,17 @@ We offer three installation methods:
(ensure version ≥v0.20)
1. Launch “Docker for Desktop”. Go to Preferences:
- choose “Enable Kubernetes”,
- set CPUs to at least 3, and Memory to at least 6.0 GiB
3. Run `kubectl get nodes` to verify you're connected to “Kubernetes on Docker”.
1. Run `kubectl get nodes` to verify you're connected to “Kubernetes on Docker”.
4. Run `skaffold run` (first time will be slow, it can take ~20 minutes).
1. 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.
5. Run `kubectl get pods` to verify the Pods are ready and running. The
1. Run `kubectl get pods` to verify the Pods are ready and running. The
application frontend should be available at http://localhost:80 on your
machine.
@ -122,19 +121,29 @@ We offer three installation methods:
1. Create a Google Kubernetes Engine cluster and make sure `kubectl` is pointing
to the cluster.
```sh
gcloud services enable container.googleapis.com
```
```sh
gcloud container clusters create demo --enable-autoupgrade \
--enable-autoscaling --min-nodes=3 --max-nodes=10 --num-nodes=5 --zone=us-central1-a
```
```
kubectl get nodes
```
1. Enable Google Container Registry (GCR) on your GCP project and configure the
`docker` CLI to authenticate to GCR:
```sh
gcloud services enable containerregistry.googleapis.com
```
```sh
gcloud auth configure-docker -q
```
1. In the root of this repository, run `skaffold run --default-repo=gcr.io/[PROJECT_ID]`,
where [PROJECT_ID] is your GCP project ID.
@ -182,8 +191,9 @@ by deploying the [release manifest](./release) directly to an existing cluster.
1. Find the IP address of your application, then visit the application on your
browser to confirm installation.
```sh
kubectl get service/frontend-external
```
### (Optional) Deploying on a Istio-installed GKE cluster
@ -192,13 +202,15 @@ by deploying the [release manifest](./release) directly to an existing cluster.
1. Create a GKE cluster (described in "Option 2").
2. Use [Istio on GKE add-on](https://cloud.google.com/istio/docs/istio-on-gke/installing)
1. Use [Istio on GKE add-on](https://cloud.google.com/istio/docs/istio-on-gke/installing)
to install Istio to your existing GKE cluster.
```sh
gcloud beta container clusters update demo \
--zone=us-central1-a \
--update-addons=Istio=ENABLED \
--istio-config=auth=MTLS_PERMISSIVE
```
> NOTE: If you need to enable `MTLS_STRICT` mode, you will need to update
> several manifest files:
@ -207,32 +219,39 @@ by deploying the [release manifest](./release) directly to an existing cluster.
> "readinessProbe" fields.
> - `kubernetes-manifests/loadgenerator.yaml`: delete "initContainers" field.
3. (Optional) Enable Stackdriver Tracing/Logging with Istio Stackdriver Adapter
1. (Optional) Enable Stackdriver Tracing/Logging with Istio Stackdriver Adapter
by [following this guide](https://cloud.google.com/istio/docs/istio-on-gke/installing#enabling_tracing_and_logging).
4. Install the automatic sidecar injection (annotate the `default` namespace
1. Install the automatic sidecar injection (annotate the `default` namespace
with the label):
```sh
kubectl label namespace default istio-injection=enabled
```
5. Apply the manifests in [`./istio-manifests`](./istio-manifests) directory.
1. Apply the manifests in [`./istio-manifests`](./istio-manifests) directory.
(This is required only once.)
```sh
kubectl apply -f ./istio-manifests
```
This is required only once.
1. Deploy the application with `skaffold run --default-repo=gcr.io/[PROJECT_ID]`.
6. Deploy the application with `skaffold run --default-repo=gcr.io/[PROJECT_ID]`.
1. Run `kubectl get pods` to see pods are in a healthy and ready state.
7. Run `kubectl get pods` to see pods are in a healthy and ready state.
8. Find the IP address of your istio gateway Ingress or Service, and visit the
1. Find the IP address of your Istio gateway Ingress or Service, and visit the
application.
INGRESS_HOST="$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}')"
```sh
INGRESS_HOST="$(kubectl -n istio-system get service istio-ingressgateway \
-o jsonpath='{.status.loadBalancer.ingress[0].ip}')"
echo "$INGRESS_HOST"
```
```sh
curl -v "http://$INGRESS_HOST"
```
## Conferences featuring Hipster Shop