diff --git a/CODEOWNERS b/.github/CODEOWNERS similarity index 100% rename from CODEOWNERS rename to .github/CODEOWNERS diff --git a/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md similarity index 100% rename from CODE_OF_CONDUCT.md rename to .github/CODE_OF_CONDUCT.md diff --git a/CONTRIBUTING.md b/.github/CONTRIBUTING.md similarity index 100% rename from CONTRIBUTING.md rename to .github/CONTRIBUTING.md diff --git a/SECURITY.md b/.github/SECURITY.md similarity index 100% rename from SECURITY.md rename to .github/SECURITY.md diff --git a/.github/release-cluster/README.md b/.github/release-cluster/README.md index 923ac05f080..90772da21b9 100644 --- a/.github/release-cluster/README.md +++ b/.github/release-cluster/README.md @@ -2,7 +2,7 @@ This directory contains extra deploy manifests for configuring Online Boutique solution on GKE for onlineboutique.dev. -_Note: before moving forward, the OnlineBoutique apps should already be deployed [on the online-boutique-release GKE cluster](../../hack#10-deploy-releasekubernetes-manifestsyaml-to-our-online-boutique-release-gke-cluster)._ +_Note: before moving forward, the Online Boutique apps should already be deployed [on the online-boutique-release GKE cluster](/docs/releasing#10-deploy-releasekubernetes-manifestsyaml-to-our-online-boutique-release-gke-cluster)._ ## Public static IP address diff --git a/renovate.json b/.github/renovate.json similarity index 100% rename from renovate.json rename to .github/renovate.json diff --git a/README.md b/README.md index 0851ac8897d..891af5056aa 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@

-Online Boutique +Online Boutique

- ![Continuous Integration](https://github.com/GoogleCloudPlatform/microservices-demo/workflows/Continuous%20Integration%20-%20Main/Release/badge.svg) **Online Boutique** is a cloud-first microservices demo application. @@ -10,117 +9,108 @@ Online Boutique consists of an 11-tier microservices application. The applicatio 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, and gRPC**. This application -works on any Kubernetes cluster, as well as Google -Kubernetes Engine. It’s **easy to deploy with little to no configuration**. +Google uses this application to demonstrate the use of technologies like +Kubernetes, GKE, Istio, Stackdriver, and gRPC. This application +works on any Kubernetes cluster, like Google +Kubernetes Engine (GKE). It’s **easy to deploy with little to no configuration**. If you’re using this demo, please **★Star** this repository to show your interest! -> 👓**Note to Googlers (Google employees):** Please fill out the form at -> [go/microservices-demo](http://go/microservices-demo) if you are using this -> application. +**Note to Googlers (Google employees):** Please fill out the form at [go/microservices-demo](http://go/microservices-demo). ## 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) | +| [![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) | -## Quickstart (GKE) +## Interactive quickstart (GKE) [![Open in Cloud Shell](https://gstatic.com/cloudssh/images/open-btn.svg)](https://ssh.cloud.google.com/cloudshell/editor?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2FGoogleCloudPlatform%2Fmicroservices-demo&shellonly=true&cloudshell_image=gcr.io/ds-artifacts-cloudshell/deploystack_custom_image) -1. **[Create a Google Cloud Platform project](https://cloud.google.com/resource-manager/docs/creating-managing-projects#creating_a_project)** or use an existing project. Set the `PROJECT_ID` environment variable and ensure the Google Kubernetes Engine and Cloud Operations APIs are enabled. +## Quickstart (GKE) -``` -PROJECT_ID="" -gcloud services enable container.googleapis.com --project ${PROJECT_ID} -``` +1. Ensure you have the following requirements: + - [Google Cloud project](https://cloud.google.com/resource-manager/docs/creating-managing-projects#creating_a_project). + - Shell environment with `gcloud`, `git`, and `kubectl`. -2. **Clone this repository.** +2. Clone the repository. -``` -git clone https://github.com/GoogleCloudPlatform/microservices-demo.git -cd microservices-demo -``` + ```sh + git clone https://github.com/GoogleCloudPlatform/microservices-demo + cd microservices-demo/ + ``` -3. **Create a GKE cluster.** +3. Set the Google Cloud project and region and ensure the Google Kubernetes Engine API is enabled. -- GKE autopilot mode (see [Autopilot -overview](https://cloud.google.com/kubernetes-engine/docs/concepts/autopilot-overview) -to learn more): + ```sh + export PROJECT_ID= + export REGION=us-central1 + gcloud services enable container.googleapis.com \ + --project=${PROJECT_ID} + ``` -``` -REGION=us-central1 -gcloud container clusters create-auto onlineboutique \ - --project=${PROJECT_ID} --region=${REGION} -``` + Substitute `` with the ID of your Google Cloud project. -- GKE Standard mode: +4. Create a GKE cluster and get the credentials for it. -``` -ZONE=us-central1-b -gcloud container clusters create onlineboutique \ - --project=${PROJECT_ID} --zone=${ZONE} \ - --machine-type=e2-standard-2 --num-nodes=4 -``` + ```sh + gcloud container clusters create-auto online-boutique \ + --project=${PROJECT_ID} --region=${REGION} + ``` -4. **Deploy the sample app to the cluster.** + Creating the cluster may take a few minutes. -``` -kubectl apply -f ./release/kubernetes-manifests.yaml -``` +5. Deploy Online Boutique to the cluster. -5. **Wait for the Pods to be ready.** + ```sh + kubectl apply -f ./release/kubernetes-manifests.yaml + ``` -``` -kubectl get pods -``` +6. Wait for the pods to be ready. -After a few minutes, you should see: + ```sh + kubectl get pods + ``` -``` -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 -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 -redis-cart-5f59546cdd-5jnqf 1/1 Running 0 2m58s -shippingservice-6ccc89f8fd-v686r 1/1 Running 0 2m58s -``` + After a few minutes, you should see the Pods in a `Running` state: -7. **Access the web frontend in a browser** using the frontend's `EXTERNAL_IP`. + ``` + 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 + 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 + redis-cart-5f59546cdd-5jnqf 1/1 Running 0 2m58s + shippingservice-6ccc89f8fd-v686r 1/1 Running 0 2m58s + ``` -``` -kubectl get service frontend-external | awk '{print $4}' -``` +7. Access the web frontend in a browser using the frontend's external IP. -*Example output - do not copy* + ```sh + kubectl get service frontend-external | awk '{print $4}' + ``` -``` -EXTERNAL-IP - -``` + Visit `http://EXTERNAL_IP` in a web browser to access your instance of Online Boutique. -**Note**- you may see `` while GCP provisions the load balancer. If this happens, wait a few minutes and re-run the command. +8. Once you are done with it, delete the GKE cluster. -8. [Optional] **Clean up**: + ```sh + gcloud container clusters delete online-boutique \ + --project=${PROJECT_ID} --region=${REGION} + ``` -``` -gcloud container clusters delete onlineboutique \ - --project=${PROJECT_ID} --zone=${ZONE} -``` + Deleting the cluster may take a few minutes. ## Use Terraform to provision a GKE cluster and deploy Online Boutique -The [`/terraform` folder](terraform) contains instructions for using [Terraform](https://www.terraform.io/intro) to replicate the steps from [**Quickstart (GKE)**](#quickstart-gke) above. +The [`/terraform` folder](/terraform) contains instructions for using [Terraform](https://www.terraform.io/intro) to replicate the steps from [**Quickstart (GKE)**](#quickstart-gke) above. ## Other deployment variations @@ -129,9 +119,9 @@ The [`/terraform` folder](terraform) contains instructions for using [Terraform] ## Deploy Online Boutique variations with Kustomize -The [`/kustomize` folder](kustomize) contains instructions for customizing the deployment of Online Boutique with different variations such as: -* integrating with [Google Cloud Operations](kustomize/components/google-cloud-operations/) -* replacing the in-cluster Redis cache with [Google Cloud Memorystore (Redis)](kustomize/components/memorystore), [AlloyDB](kustomize/components/alloydb) or [Google Cloud Spanner](kustomize/components/spanner) +The [`/kustomize` folder](/kustomize) contains instructions for customizing the deployment of Online Boutique with different variations such as: +* integrating with [Google Cloud Operations](/kustomize/components/google-cloud-operations/) +* replacing the in-cluster Redis cache with [Google Cloud Memorystore (Redis)](/kustomize/components/memorystore), [AlloyDB](/kustomize/components/alloydb) or [Google Cloud Spanner](/kustomize/components/spanner) * etc. ## Architecture @@ -140,23 +130,23 @@ The [`/kustomize` folder](kustomize) contains instructions for customizing the d languages that talk to each other over gRPC. [![Architecture of -microservices](./docs/img/architecture-diagram.png)](./docs/img/architecture-diagram.png) +microservices](/docs/img/architecture-diagram.png)](/docs/img/architecture-diagram.png) -Find **Protocol Buffers Descriptions** at the [`./pb` directory](./pb). +Find **Protocol Buffers Descriptions** at the [`./protos` directory](/protos). | 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 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) | Node.js | Converts one money amount to another currency. Uses real values fetched from European Central Bank. It's the highest QPS service. | -| [paymentservice](./src/paymentservice) | Node.js | 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) | Python | 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) | Python | Recommends other products based on what's given in the cart. | -| [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. | +| [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 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) | Node.js | Converts one money amount to another currency. Uses real values fetched from European Central Bank. It's the highest QPS service. | +| [paymentservice](/src/paymentservice) | Node.js | 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) | Python | 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) | Python | Recommends other products based on what's given in the cart. | +| [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 @@ -177,9 +167,9 @@ Find **Protocol Buffers Descriptions** at the [`./pb` directory](./pb). job that creates realistic usage patterns on the website using [Locust](https://locust.io/) load generator. -## Local Development +## 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. +See the [Development guide](/docs/development-guide.md) to learn how to run and develop this app locally. ## Demos featuring Online Boutique diff --git a/docs/cloudshell-tutorial.md b/docs/cloudshell-tutorial.md index 0dab58a4213..d639a08b1c0 100644 --- a/docs/cloudshell-tutorial.md +++ b/docs/cloudshell-tutorial.md @@ -4,7 +4,7 @@ This tutorial shows you how to deploy **[Online Boutique](https://github.com/Goo You'll be able to run Online Boutique on: - a local **[minikube](https://minikube.sigs.k8s.io/docs/)** cluster, which comes built in to the Cloud Shell instance -- a **[Google Kubernetes Engine](https://cloud.google.com/kubernetes-engine)** cluster using a new or existing [Google Cloud Platform project](https://cloud.google.com/resource-manager/docs/creating-managing-projects#creating_a_project) +- a **[Google Kubernetes Engine](https://cloud.google.com/kubernetes-engine)** cluster using a new or existing [Google Cloud project](https://cloud.google.com/resource-manager/docs/creating-managing-projects#creating_a_project) Let's get started! @@ -29,7 +29,7 @@ Once minikube has started, you're ready to move on to the next step. ### GKE instructions -In order to create a GKE cluster, you'll need to **[create a Google Cloud Platform project](https://cloud.google.com/resource-manager/docs/creating-managing-projects#creating_a_project)** or use an existing project. +In order to create a GKE cluster, you'll need to **[create a Google Cloud project](https://cloud.google.com/resource-manager/docs/creating-managing-projects#creating_a_project)** or use an existing project. 1. Access the command palette by going to **View > Find Command**. @@ -83,7 +83,7 @@ You can start, stop, and debug apps from the Debug view. ### Clean up -If you've deployed your app to a GKE cluster in your Google Cloud Platform project, you'll want to delete the cluster to avoid incurring charges. +If you've deployed your app to a GKE cluster in your Google Cloud project, you'll want to delete the cluster to avoid incurring charges. 1. Navigate to the Cloud Code - Kubernetes view in the Activity bar. diff --git a/docs/development-guide.md b/docs/development-guide.md index ee00fdcbaa1..4e07bd7a62a 100644 --- a/docs/development-guide.md +++ b/docs/development-guide.md @@ -1,13 +1,13 @@ # Development Guide -This doc explains how to build and run the OnlineBoutique source code locally using the `skaffold` command-line tool. +This doc explains how to build and run the Online Boutique source code locally using the `skaffold` command-line tool. ## Prerequisites - [Docker for Desktop](https://www.docker.com/products/docker-desktop). - kubectl (can be installed via `gcloud components install kubectl`) - [skaffold **2.0.2+**](https://skaffold.dev/docs/install/) (latest version recommended), a tool that builds and deploys Docker images in bulk. -- A Google Cloud Project with Google Container Registry enabled. +- A Google Cloud project with Google Container Registry enabled. - Enable GCP APIs for Cloud Monitoring, Tracing, Profiler: ``` gcloud services enable monitoring.googleapis.com \ @@ -19,7 +19,7 @@ gcloud services enable monitoring.googleapis.com \ ## Option 1: Google Kubernetes Engine (GKE) -> 💡 Recommended if you're using Google Cloud Platform and want to try it on +> 💡 Recommended if you're using Google Cloud and want to try it on > a realistic cluster. **Note**: If your cluster has Workload Identity enabled, > [see these instructions](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity#enable) diff --git a/docs/releasing/README.md b/docs/releasing/README.md new file mode 100755 index 00000000000..126936a071d --- /dev/null +++ b/docs/releasing/README.md @@ -0,0 +1,65 @@ +# Releasing Online Boutique + +This document walks through the process of creating a new release of Online Boutique. + +## Creating a new release + +1. Decide on the next release version number using [semantic versioning](https://semver.org/), based on the [commits since the previous release](https://github.com/GoogleCloudPlatform/microservices-demo/commits/main). + +2. Open a new terminal. + +3. Make sure you have `gsed` installed. If not, `brew install gnu-sed`. + +4. Set the following environment variables: + + - `TAG` - This is the new version (e.g., `v0.3.5`). + - `REPO_PREFIX` - This is the Docker repository. + + **Example:** + + ``` + export TAG=v0.3.5 + export REPO_PREFIX=gcr.io/google-samples/microservices-demo + ``` + +5. Run `./docs/releasing/make-release.sh`. + + - Make sure you run `./docs/releasing/make-release.sh` from this project's root directory — **not** from inside the `docs/releasing/` directory. + - This script: + 1. uses `make-docker-images.sh` to build and push a Docker image for each microservice to the previously specified repository. + 1. uses `make-release-artifacts.sh` to regenerates (and update the image $TAGS) YAML file at `./release/kubernetes-manifests.yaml` and `./kustomize/base/`. + 1. runs `git tag` and pushes a new branch (e.g., `release/v0.3.5`) with the changes to `./release/kubernetes-manifests.yaml`. + +6. Make sure the new Docker images were created and pushed. + + - Go through [our Container Registry repository](https://pantheon.corp.google.com/gcr/images/google-samples/global/microservices-demo?project=google-samples). + - Make sure a Docker image was created for each microservice (with the new version tag). + +7. [Draft a new release on GitHub](https://github.com/GoogleCloudPlatform/microservices-demo/releases). + + - Summarize the [commits since the previous release](https://github.com/GoogleCloudPlatform/microservices-demo/commits/main). + - See previous releases for inspiration on release notes. + +8. Create a new pull-request. + + - When you ran `make-release.sh`, it created a new branch (e.g., `release/v0.3.5`). + - Include the new release draft in the pull-request description for reviewers to see. + +9. Once your pull-request is approved, merge it. + +10. Connect to our [online-boutique-release GKE cluster](https://pantheon.corp.google.com/kubernetes/clusters/details/us-central1-c/online-boutique-release/details?project=online-boutique-ci). + + ``` + gcloud container clusters get-credentials online-boutique-release \ + --zone us-central1-c --project online-boutique-ci + ``` + +11. Deploy `release/kubernetes-manifests.yaml` to our [online-boutique-release GKE cluster](https://pantheon.corp.google.com/kubernetes/clusters/details/us-central1-c/online-boutique-release/details?project=online-boutique-ci). + + ``` + kubectl apply -f ./release/kubernetes-manifests.yaml + ``` + +12. Make sure [onlineboutique.dev](https://onlineboutique.dev) works. + +13. [Publish your draft release on GitHub](https://github.com/GoogleCloudPlatform/microservices-demo/releases). diff --git a/hack/license_header.txt b/docs/releasing/license_header.txt similarity index 100% rename from hack/license_header.txt rename to docs/releasing/license_header.txt diff --git a/hack/make-docker-images.sh b/docs/releasing/make-docker-images.sh similarity index 91% rename from hack/make-docker-images.sh rename to docs/releasing/make-docker-images.sh index 5aa38334136..75ca413cff8 100755 --- a/hack/make-docker-images.sh +++ b/docs/releasing/make-docker-images.sh @@ -17,7 +17,8 @@ # Builds and pushes docker image for each demo microservice. set -euo pipefail -SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +REPO_ROOT=$SCRIPT_DIR/../.. log() { echo "$1" >&2; } @@ -50,6 +51,6 @@ while IFS= read -d $'\0' -r dir; do docker push "${image}-native-grpc-probes" fi ) -done < <(find "${SCRIPTDIR}/../src" -mindepth 1 -maxdepth 1 -type d -print0) +done < <(find "${REPO_ROOT}/src" -mindepth 1 -maxdepth 1 -type d -print0) log "Successfully built and pushed all images." diff --git a/hack/make-helm-chart.sh b/docs/releasing/make-helm-chart.sh similarity index 90% rename from hack/make-helm-chart.sh rename to docs/releasing/make-helm-chart.sh index d08f13e70aa..97469e7b73c 100755 --- a/hack/make-helm-chart.sh +++ b/docs/releasing/make-helm-chart.sh @@ -17,14 +17,15 @@ # Packages and pushes Online Boutique's Helm chart in public Artifact Registry. set -euo pipefail -SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +REPO_ROOT=$SCRIPT_DIR/../.. log() { echo "$1" >&2; } TAG="${TAG:?TAG env variable must be specified}" HELM_CHART_REPO="us-docker.pkg.dev/online-boutique-ci/charts" -cd helm-chart +cd ${REPO_ROOT}/helm-chart gsed -i "s/^appVersion:.*/appVersion: \"${TAG}\"/" Chart.yaml gsed -i "s/^version:.*/version: ${TAG:1}/" Chart.yaml helm package . diff --git a/hack/make-release-artifacts.sh b/docs/releasing/make-release-artifacts.sh similarity index 91% rename from hack/make-release-artifacts.sh rename to docs/releasing/make-release-artifacts.sh index cff95d36651..1a35c3af39f 100755 --- a/hack/make-release-artifacts.sh +++ b/docs/releasing/make-release-artifacts.sh @@ -18,17 +18,18 @@ # /release/... set -euo pipefail -SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +REPO_ROOT=$SCRIPT_DIR/../.. [[ -n "${DEBUG:-}" ]] && set -x log() { echo "$1" >&2; } TAG="${TAG:?TAG env variable must be specified}" REPO_PREFIX="${REPO_PREFIX:?REPO_PREFIX env variable must be specified}" -OUT_DIR="${OUT_DIR:-${SCRIPTDIR}/../release}" +OUT_DIR="${OUT_DIR:-${REPO_ROOT}/release}" print_license_header() { - cat "${SCRIPTDIR}/license_header.txt" + cat "${SCRIPT_DIR}/license_header.txt" echo } @@ -61,7 +62,7 @@ read_manifests_except_kustomization() { } mk_kubernetes_manifests() { - out_manifest="$(read_manifests_except_kustomization "${SCRIPTDIR}/../kubernetes-manifests")" + out_manifest="$(read_manifests_except_kustomization "${REPO_ROOT}/kubernetes-manifests")" # replace "image" repo, tag for each service for dir in ./src/*/ @@ -88,7 +89,7 @@ mk_istio_manifests() { # This just copies the yaml from the component (excluding kustomization.yaml) # since there is no easy way to render individual kustomize component resources - read_manifests_except_kustomization "${SCRIPTDIR}/../kustomize/components/service-mesh-istio/" + read_manifests_except_kustomization "${REPO_ROOT}/kustomize/components/service-mesh-istio/" echo '# [END servicemesh_release_istio_manifests_microservices_demo]' } diff --git a/hack/make-release.sh b/docs/releasing/make-release.sh similarity index 84% rename from hack/make-release.sh rename to docs/releasing/make-release.sh index 2a6ff668aae..6110ad4f138 100755 --- a/hack/make-release.sh +++ b/docs/releasing/make-release.sh @@ -21,7 +21,8 @@ # - 4. pushing the tag/commit to main. set -euo pipefail -SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +REPO_ROOT=$SCRIPT_DIR/../.. [[ -n "${DEBUG:-}" ]] && set -x log() { echo "$1" >&2; } @@ -45,19 +46,19 @@ git checkout main git pull # build and push images -"${SCRIPTDIR}"/make-docker-images.sh +"${SCRIPT_DIR}"/make-docker-images.sh # update yaml -"${SCRIPTDIR}"/make-release-artifacts.sh +"${SCRIPT_DIR}"/make-release-artifacts.sh # build and push images -"${SCRIPTDIR}"/make-helm-chart.sh +"${SCRIPT_DIR}"/make-helm-chart.sh # create git release / push to new branch git checkout -b "release/${TAG}" -git add "${SCRIPTDIR}/../release/" -git add "${SCRIPTDIR}/../kustomize/base/" -git add "${SCRIPTDIR}/../helm-chart/" +git add "${REPO_ROOT}/release/" +git add "${REPO_ROOT}/kustomize/base/" +git add "${REPO_ROOT}/helm-chart/" git commit --allow-empty -m "Release $TAG" log "Pushing k8s manifests to release/${TAG}..." git tag "$TAG" diff --git a/hack/README.md b/hack/README.md deleted file mode 100755 index e64378825a9..00000000000 --- a/hack/README.md +++ /dev/null @@ -1,67 +0,0 @@ -## `hack/` - -This directory contains the scripts for creating a new `microservices-demo` release. - -### Create a New Release - -#### 1. Decide on the next release version number using [semantic versioning](https://semver.org/). -- Look at the [commits since the previous release](https://github.com/GoogleCloudPlatform/microservices-demo/commits/main). - -#### 2. Open a new terminal. - -#### 3. Make sure you have `gsed` installed. If not, `brew install gnu-sed`. - -#### 4. Set the following environment variables: - -- `TAG` - This is the new version (e.g., `v0.3.5`). -- `REPO_PREFIX` - This is the Docker repository. -##### Example: -``` -export TAG=v0.3.5 -export REPO_PREFIX=gcr.io/google-samples/microservices-demo -``` - -#### 5. Run `./hack/make-release.sh`. - -- Make sure you run `./hack/make-release.sh` from this project's root folder — **not** from inside the `hack/` folder. -- This script: - 1. uses `make-docker-images.sh` to build and push a Docker image for each microservice to the previously specified repository. - 1. uses `make-release-artifacts.sh` to regenerates (and update the image $TAGS) YAML file at `./release/kubernetes-manifests.yaml` and `./kustomize/base/`. - 1. runs `git tag` and pushes a new branch (e.g., `release/v0.3.5`) with the changes to `release/kubernetes-manifests.yaml`. - -#### 6. Make sure the new Docker images were created and pushed. - -- Go through [our Container Registry repository](https://pantheon.corp.google.com/gcr/images/google-samples/global/microservices-demo?project=google-samples). -- Make sure a Docker image was created for each microservice (with the new version tag). - - -#### 8. [Draft a new release on GitHub](https://github.com/GoogleCloudPlatform/microservices-demo/releases). - -- Summarize the [commits since the previous release](https://github.com/GoogleCloudPlatform/microservices-demo/commits/main). -- See previous releases for inspiration on release notes. - -#### 7. Create a new pull-request. - -- When you ran `make-release.sh`, it created a new branch (e.g., `release/v0.3.5`). -- Include the new release draft in the pull-request description for reviewers to see. - -#### 8. Once your pull-request is approved, merge it. - -#### 9. Connect to our [online-boutique-release GKE cluster](https://pantheon.corp.google.com/kubernetes/clusters/details/us-central1-c/online-boutique-release/details?project=online-boutique-ci) - -- To do this, you can use: -``` -gcloud container clusters get-credentials online-boutique-release \ - --zone us-central1-c --project online-boutique-ci -``` - -#### 10. Deploy `release/kubernetes-manifests.yaml` to our [online-boutique-release GKE cluster](https://pantheon.corp.google.com/kubernetes/clusters/details/us-central1-c/online-boutique-release/details?project=online-boutique-ci). - - -``` -kubectl apply -f ./release/kubernetes-manifests.yaml -``` - -#### 11. Make sure [onlineboutique.dev](https://onlineboutique.dev) works. - -#### 12. [Publish your draft release on GitHub](https://github.com/GoogleCloudPlatform/microservices-demo/releases)! diff --git a/kustomize/components/service-mesh-istio/README.md b/kustomize/components/service-mesh-istio/README.md index d2ef5e3ab88..1ff0897b7eb 100644 --- a/kustomize/components/service-mesh-istio/README.md +++ b/kustomize/components/service-mesh-istio/README.md @@ -198,7 +198,7 @@ INGRESS_HOST="$(kubectl get gateway istio-gateway \ curl -v "http://$INGRESS_HOST" ``` -# Additional service mesh demos using OnlineBoutique +# Additional service mesh demos using Online Boutique - [Canary deployment](https://github.com/GoogleCloudPlatform/istio-samples/tree/master/istio-canary-gke) - [Security (mTLS, JWT, Authorization)](https://github.com/GoogleCloudPlatform/istio-samples/tree/master/security-intro) diff --git a/pb/demo.proto b/protos/demo.proto similarity index 100% rename from pb/demo.proto rename to protos/demo.proto diff --git a/pb/grpc/health/v1/health.proto b/protos/grpc/health/v1/health.proto similarity index 100% rename from pb/grpc/health/v1/health.proto rename to protos/grpc/health/v1/health.proto diff --git a/src/adservice/genproto.sh b/src/adservice/genproto.sh index c80b5ea931b..09bf1d16596 100755 --- a/src/adservice/genproto.sh +++ b/src/adservice/genproto.sh @@ -18,6 +18,6 @@ # protos are needed in adservice folder for compiling during Docker build. mkdir -p proto && \ -cp ../../pb/demo.proto src/main/proto +cp ../../protos/demo.proto src/main/proto # [END gke_adservice_genproto] \ No newline at end of file diff --git a/src/checkoutservice/genproto.sh b/src/checkoutservice/genproto.sh index b8062a2ecde..96deb33bc82 100755 --- a/src/checkoutservice/genproto.sh +++ b/src/checkoutservice/genproto.sh @@ -17,7 +17,7 @@ # [START gke_checkoutservice_genproto] PATH=$PATH:$GOPATH/bin -protodir=../../pb +protodir=../../protos protoc --go_out=plugins=grpc:genproto -I $protodir $protodir/demo.proto diff --git a/src/currencyservice/genproto.sh b/src/currencyservice/genproto.sh index 9d28adaffaf..34c0fb677ac 100755 --- a/src/currencyservice/genproto.sh +++ b/src/currencyservice/genproto.sh @@ -18,6 +18,6 @@ # protos are loaded dynamically for node, simply copies over the proto. mkdir -p proto -cp -r ../../pb/* ./proto +cp -r ../../protos/* ./proto # [END gke_currencyservice_genproto] \ No newline at end of file diff --git a/src/emailservice/genproto.sh b/src/emailservice/genproto.sh index f35887b7afe..f67056a3cee 100755 --- a/src/emailservice/genproto.sh +++ b/src/emailservice/genproto.sh @@ -16,6 +16,6 @@ # [START gke_emailservice_genproto] -python -m grpc_tools.protoc -I../../pb --python_out=. --grpc_python_out=. ../../pb/demo.proto +python -m grpc_tools.protoc -I../../protos --python_out=. --grpc_python_out=. ../../protos/demo.proto # [END gke_emailservice_genproto] \ No newline at end of file diff --git a/src/frontend/genproto.sh b/src/frontend/genproto.sh index 4e5619a61db..6e532fd098a 100755 --- a/src/frontend/genproto.sh +++ b/src/frontend/genproto.sh @@ -17,7 +17,7 @@ # [START gke_frontend_genproto] PATH=$PATH:$GOPATH/bin -protodir=../../pb +protodir=../../protos protoc --go_out=plugins=grpc:genproto -I $protodir $protodir/demo.proto diff --git a/src/paymentservice/genproto.sh b/src/paymentservice/genproto.sh index a980703ab0e..aab28e2b840 100755 --- a/src/paymentservice/genproto.sh +++ b/src/paymentservice/genproto.sh @@ -18,6 +18,6 @@ # protos are loaded dynamically for node, simply copies over the proto. mkdir -p proto -cp -r ../../pb/* ./proto +cp -r ../../protos/* ./proto # [END gke_paymentservice_genproto] \ No newline at end of file diff --git a/src/productcatalogservice/genproto.sh b/src/productcatalogservice/genproto.sh index 4ba0d36caf2..fa18890acde 100755 --- a/src/productcatalogservice/genproto.sh +++ b/src/productcatalogservice/genproto.sh @@ -17,7 +17,7 @@ # [START gke_productcatalogservice_genproto] PATH=$PATH:$GOPATH/bin -protodir=../../pb +protodir=../../protos protoc --go_out=plugins=grpc:genproto -I $protodir $protodir/demo.proto diff --git a/src/recommendationservice/genproto.sh b/src/recommendationservice/genproto.sh index fc9660c6c91..695d984f167 100755 --- a/src/recommendationservice/genproto.sh +++ b/src/recommendationservice/genproto.sh @@ -21,6 +21,6 @@ # requires gRPC tools: # pip install -r requirements.txt -python -m grpc_tools.protoc -I../../pb --python_out=. --grpc_python_out=. ../../pb/demo.proto +python -m grpc_tools.protoc -I../../protos --python_out=. --grpc_python_out=. ../../protos/demo.proto # [END gke_recommendationservice_genproto] \ No newline at end of file diff --git a/src/shippingservice/genproto.sh b/src/shippingservice/genproto.sh index d94a80f82c7..1871bb891ea 100755 --- a/src/shippingservice/genproto.sh +++ b/src/shippingservice/genproto.sh @@ -17,7 +17,7 @@ # [START gke_shippingservice_genproto] PATH=$PATH:$GOPATH/bin -protodir=../../pb +protodir=../../protos protoc --go_out=plugins=grpc:genproto -I $protodir $protodir/demo.proto diff --git a/terraform/README.md b/terraform/README.md index f4752f838e6..a4c70d1b212 100644 --- a/terraform/README.md +++ b/terraform/README.md @@ -18,7 +18,7 @@ This page walks you through the steps required to deploy the [Online Boutique](h ## Prerequisites -1. [Create a new project or use an existing project](https://cloud.google.com/resource-manager/docs/creating-managing-projects#console) on Google Cloud Platform (GCP), and ensure [billing is enabled](https://cloud.google.com/billing/docs/how-to/verify-billing-enabled) on the project. +1. [Create a new project or use an existing project](https://cloud.google.com/resource-manager/docs/creating-managing-projects#console) on Google Cloud, and ensure [billing is enabled](https://cloud.google.com/billing/docs/how-to/verify-billing-enabled) on the project. ## Deploy the sample application