From 70e4170d0cf08b1569147e7b516da8cd93fc8ee2 Mon Sep 17 00:00:00 2001 From: ahmedmohsen5 Date: Sat, 6 Sep 2025 20:47:24 +0300 Subject: [PATCH] push dockerfile --- .github/master-cluster/README.md | 3 - .github/master-cluster/frontend-ingress.yaml | 11 - .github/master-cluster/frontend-nodeport.yaml | 12 -- .github/master-cluster/managed-cert.yaml | 7 - .github/pull_request_template.md | 7 - .github/workflows/README.md | 65 ------ .github/workflows/ci-master.yaml | 108 ---------- .github/workflows/ci-pr.yaml | 141 ------------ .github/workflows/cleanup.yaml | 42 ---- .github/workflows/install-dependencies.sh | 71 ------ .github/workflows/push-deploy.yaml | 37 ---- CODEOWNERS | 3 - CONTRIBUTING.md | 34 --- LICENSE | 202 ------------------ README.md | 192 ----------------- cloudbuild.yaml | 39 ---- hack/make-docker-images.sh | 20 -- skaffold.yaml | 67 ------ 18 files changed, 1061 deletions(-) delete mode 100644 .github/master-cluster/README.md delete mode 100644 .github/master-cluster/frontend-ingress.yaml delete mode 100644 .github/master-cluster/frontend-nodeport.yaml delete mode 100644 .github/master-cluster/managed-cert.yaml delete mode 100644 .github/pull_request_template.md delete mode 100644 .github/workflows/README.md delete mode 100644 .github/workflows/ci-master.yaml delete mode 100644 .github/workflows/ci-pr.yaml delete mode 100644 .github/workflows/cleanup.yaml delete mode 100644 .github/workflows/install-dependencies.sh delete mode 100644 .github/workflows/push-deploy.yaml delete mode 100644 CODEOWNERS delete mode 100644 CONTRIBUTING.md delete mode 100644 LICENSE delete mode 100644 README.md delete mode 100644 cloudbuild.yaml delete mode 100644 skaffold.yaml diff --git a/.github/master-cluster/README.md b/.github/master-cluster/README.md deleted file mode 100644 index 2d0e989da27..00000000000 --- a/.github/master-cluster/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# onlineboutique.dev manifests - -This directory contains extra deploy manifests for configuring a domain name/static IP to point to an Online Boutique deployment running in GKE. \ No newline at end of file diff --git a/.github/master-cluster/frontend-ingress.yaml b/.github/master-cluster/frontend-ingress.yaml deleted file mode 100644 index b18ddea7b41..00000000000 --- a/.github/master-cluster/frontend-ingress.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: networking.k8s.io/v1beta1 -kind: Ingress -metadata: - name: frontend-ingress - annotations: - kubernetes.io/ingress.global-static-ip-name: ob-global-ip - networking.gke.io/managed-certificates: ob-cert -spec: - backend: - serviceName: frontend-nodeport - servicePort: 80 diff --git a/.github/master-cluster/frontend-nodeport.yaml b/.github/master-cluster/frontend-nodeport.yaml deleted file mode 100644 index f11b81e1f04..00000000000 --- a/.github/master-cluster/frontend-nodeport.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: frontend-nodeport -spec: - selector: - app: frontend - type: NodePort - ports: - - protocol: TCP - port: 80 - targetPort: 8080 diff --git a/.github/master-cluster/managed-cert.yaml b/.github/master-cluster/managed-cert.yaml deleted file mode 100644 index fa2c9fa10ff..00000000000 --- a/.github/master-cluster/managed-cert.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: networking.gke.io/v1beta2 -kind: ManagedCertificate -metadata: - name: ob-cert -spec: - domains: - - onlineboutique.dev diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index 5106534eb63..00000000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,7 +0,0 @@ -Fixes # . - -Change summary: -- - - -Remaining issues / concerns: diff --git a/.github/workflows/README.md b/.github/workflows/README.md deleted file mode 100644 index 46cf86e2e9b..00000000000 --- a/.github/workflows/README.md +++ /dev/null @@ -1,65 +0,0 @@ -# GitHub Actions Workflows - -This page describes the CI/CD workflows for the Online Boutique app, which run in [Github Actions](https://github.com/GoogleCloudPlatform/microservices-demo/actions). - -## Infrastructure - -The CI/CD pipelines for Online Boutique run in Github Actions, using a pool of two [self-hosted runners]((https://help.github.com/en/actions/automating-your-workflow-with-github-actions/about-self-hosted-runners)). These runners are GCE instances (virtual machines) that, for every open Pull Request in the repo, run the code test pipeline, deploy test pipeline, and (on master) deploy the latest version of the app to [onlineboutique.dev](https://onlineboutique.dev) - -We also host a test GKE cluster, which is where the deploy tests run. Every PR has its own namespace in the cluster. - -## Workflows - -**Note**: In order for the current CI/CD setup to work on your pull request, you must branch directly off the repo (no forks). This is because the Github secrets necessary for these tests aren't copied over when you fork. - -### Code Tests - [ci-pr.yaml](ci-pr.yaml) - -These tests run on every commit for every open PR, as well as any commit to master / any release branch. Currently, this workflow runs only Go unit tests. - - -### Deploy Tests- [ci-pr.yaml](ci-pr.yaml) - -These tests run on every commit for every open PR, as well as any commit to master / any release branch. This workflow: - -1. Creates a dedicated GKE namespace for that PR, if it doesn't already exist, in the PR GKE cluster. -2. Uses `skaffold run` to build and push the images specific to that PR commit. Then skaffold deploys those images, via `kubernetes-manifests`, to the PR namespace in the test cluster. -3. Tests to make sure all the pods start up and become ready. -4. Gets the LoadBalancer IP for the frontend service. -5. Comments that IP in the pull request, for staging. - -### Push and Deploy Latest - [push-deploy](push-deploy.yml) - -This is the Continuous Deployment workflow, and it runs on every commit to the master branch. This workflow: - -1. Builds the contaner images for every service, tagging as `latest`. -2. Pushes those images to Google Container Registry. - -Note that this workflow does not update the image tags used in `release/kubernetes-manifests.yaml` - these release manifests are tied to a stable `v0.x.x` release. - -### Cleanup - [cleanup.yaml](cleanup.yaml) - -This workflow runs when a PR closes, regardless of whether it was merged into master. This workflow deletes the PR-specific GKE namespace in the test cluster. - -## Appendix - Creating a new Actions runner - -Should one of the two self-hosted Github Actions runners (GCE instances) fail, or you want to add more runner capacity, this is how to provision a new runner. Note that you need IAM access to the admin Online Boutique GCP project in order to do this. - -1. Create a GCE instance. - - VM should be at least n1-standard-4 with 50GB persistent disk - - VM should use custom service account with permissions to: access a GKE cluster, create GCS storage buckets, and push to GCR. -2. SSH into new VM through the Google Cloud Console. -3. Install project-specific dependencies, including go, docker, skaffold, and kubectl: - -``` -wget -O - https://raw.githubusercontent.com/GoogleCloudPlatform/microservices-demo/master/.github/workflows/install-dependencies.sh | bash -``` - -The instance will restart when the script completes in order to finish the Docker install. - -4. SSH back into the VM. - -5. Follow the instructions to add a new runner on the [Actions Settings page](https://github.com/GoogleCloudPlatform/microservices-demo/settings/actions) to authenticate the new runner -6. Start GitHub Actions as a background service: -``` -sudo ~/actions-runner/svc.sh install ; sudo ~/actions-runner/svc.sh start -``` diff --git a/.github/workflows/ci-master.yaml b/.github/workflows/ci-master.yaml deleted file mode 100644 index aaf6a9a7735..00000000000 --- a/.github/workflows/ci-master.yaml +++ /dev/null @@ -1,108 +0,0 @@ -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -name: "Continuous Integration - Master/Release" -on: - push: - # run on pushes to master or release/* - branches: - - master - - release/* -jobs: - code-tests: - runs-on: self-hosted - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-dotnet@v1 - with: - dotnet-version: '5.0.201' - - name: Go Unit Tests - timeout-minutes: 10 - run: | - for SERVICE in "shippingservice" "productcatalogservice"; do - echo "testing $SERVICE..." - pushd src/$SERVICE - go test - popd - done - - name: C# Unit Tests - timeout-minutes: 10 - run: | - dotnet test src/cartservice/ - deployment-tests: - runs-on: self-hosted - needs: code-tests - strategy: - matrix: - profile: ["local-code"] - fail-fast: true - steps: - - uses: actions/checkout@v2 - - name: Build + Deploy PR images to GKE - timeout-minutes: 20 - run: | - PR_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }') - NAMESPACE="pr${PR_NUMBER}" - echo "::set-env name=NAMESPACE::$NAMESPACE" - echo "::set-env name=PR_NUMBER::$PR_NUMBER" - - gcloud container clusters get-credentials $PR_CLUSTER --zone $ZONE --project $PROJECT_ID - cat < microsoft.asc.gpg -sudo mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/ -wget https://packages.microsoft.com/config/debian/9/prod.list -sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list -sudo chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg -sudo chown root:root /etc/apt/sources.list.d/microsoft-prod.list - -sudo apt-get install -y apt-transport-https && \ -sudo apt-get update && \ -sudo apt-get install -y dotnet-sdk-5.0 -echo "✅ dotnet installed" - -# install kubectl -sudo apt-get install -yqq kubectl git -echo "✅ kubectl installed" - -# install go -wget https://golang.org/dl/go1.15.3.linux-amd64.tar.gz -sudo tar -C /usr/local -xzf go1.15.3.linux-amd64.tar.gz -echo 'export GOPATH=$HOME/go' >> ~/.profile -echo 'export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin' >> ~/.profile -source ~/.profile -echo "✅ golang installed" - -# install build-essential (gcc, used for go test) -sudo apt install -y build-essential - -# install addlicense -go get -u github.com/google/addlicense -sudo ln -s $HOME/go/bin/addlicense /bin - -# install skaffold -curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64 && \ -chmod +x skaffold && \ -sudo mv skaffold /usr/local/bin -echo "✅ skaffold installed" - -# install docker -sudo apt install -yqq apt-transport-https ca-certificates curl gnupg2 software-properties-common && \ -curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add - && \ -sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" && \ -sudo apt-get update && \ -sudo apt-get install -yqq docker-ce && \ -sudo usermod -aG docker ${USER} -echo "✅ docker installed, rebooting..." - -# reboot for docker setup -sudo reboot diff --git a/.github/workflows/push-deploy.yaml b/.github/workflows/push-deploy.yaml deleted file mode 100644 index 6017df6029c..00000000000 --- a/.github/workflows/push-deploy.yaml +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -name: "Push and Deploy" -on: - push: - # run on pushes to master - branches: - - master -jobs: - push-deploy: - runs-on: self-hosted - steps: - - uses: actions/checkout@v2 - - name: Push latest images to GCR - timeout-minutes: 20 - run: | - skaffold config set --global local-cluster false - # tag with git hash - skaffold build --default-repo=gcr.io/$PROJECT_ID \ - --tag=$GITHUB_SHA - # tag as latest - skaffold build --default-repo=gcr.io/$PROJECT_ID \ - --tag=latest - env: - PROJECT_ID: ${{ secrets.PROJECT_ID }} \ No newline at end of file diff --git a/CODEOWNERS b/CODEOWNERS deleted file mode 100644 index 5362b730869..00000000000 --- a/CODEOWNERS +++ /dev/null @@ -1,3 +0,0 @@ -# Repo owners - Anthos DPE -* @anthos-dpe - diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 1dce6116d1f..00000000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,34 +0,0 @@ -# How to Contribute - -We'd love to accept your patches and contributions to this project. There are -just a few small guidelines you need to follow. - -## Development Principles (for Googlers) - -There are a few principles for developing or refactoring the service -implementations. Read the [Development Principles -Guide](./docs/development-principles.md). - -## Contributor License Agreement - -Contributions to this project must be accompanied by a Contributor License -Agreement. You (or your employer) retain the copyright to your contribution; -this simply gives us permission to use and redistribute your contributions as -part of the project. Head over to to see -your current agreements on file or to sign a new one. - -You generally only need to submit a CLA once, so if you've already submitted one -(even if it was for a different project), you probably don't need to do it -again. - -## Code reviews - -All submissions, including submissions by project members, require review. We -use GitHub pull requests for this purpose. Consult -[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more -information on using pull requests. - -## Community Guidelines - -This project follows [Google's Open Source Community -Guidelines](https://opensource.google.com/conduct/). diff --git a/LICENSE b/LICENSE deleted file mode 100644 index d6456956733..00000000000 --- a/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/README.md b/README.md deleted file mode 100644 index 8a3b32a3c8b..00000000000 --- a/README.md +++ /dev/null @@ -1,192 +0,0 @@ -

-Online Boutique -

- - -![Continuous Integration](https://github.com/GoogleCloudPlatform/microservices-demo/workflows/Continuous%20Integration%20-%20Master/Release/badge.svg) - - -**Online Boutique** is a cloud-native microservices demo application. -Online Boutique consists of a 10-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 OpenCensus**. 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! - -> 👓**Note to Googlers:** Please fill out the form at -> [go/microservices-demo](http://go/microservices-demo) if you are using this -> application. - -Looking for the old Hipster Shop frontend interface? Use the [manifests](https://github.com/GoogleCloudPlatform/microservices-demo/tree/v0.1.5/kubernetes-manifests) in release [v0.1.5](https://github.com/GoogleCloudPlatform/microservices-demo/releases/v0.1.5). - -## 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) | - - -## 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://github.com/GoogleCloudPlatform/microservices-demo&cloudshell_tutorial=README.md) - -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. - -``` -PROJECT_ID="" -gcloud services enable container.googleapis.com --project ${PROJECT_ID} -gcloud services enable monitoring.googleapis.com \ - cloudtrace.googleapis.com \ - clouddebugger.googleapis.com \ - cloudprofiler.googleapis.com \ - --project ${PROJECT_ID} -``` - -2. **Clone this repository.** - -``` -git clone https://github.com/GoogleCloudPlatform/microservices-demo.git -cd microservices-demo -``` - -3. **Create a GKE cluster.** - -``` -ZONE=us-central1-b -gcloud container clusters create onlineboutique \ - --project=${PROJECT_ID} --zone=${ZONE} \ - --machine-type=e2-standard-2 --num-nodes=4 -``` - -4. **Deploy the sample app to the cluster.** - -``` -kubectl apply -f ./release/kubernetes-manifests.yaml -``` - -5. **Wait for the Pods to be ready.** - -``` -kubectl get pods -``` - -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 -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 -``` - -7. **Access the web frontend in a browser** using the frontend's `EXTERNAL_IP`. - -``` -kubectl get service frontend-external | awk '{print $4}' -``` - -*Example output - do not copy* - -``` -EXTERNAL-IP - -``` - -**Note**- you may see `` while GCP provisions the load balancer. If this happens, wait a few minutes and re-run the command. - -8. [Optional] **Clean up**: - -``` -gcloud container clusters delete onlineboutique \ - --project=${PROJECT_ID} --zone=${ZONE} -``` - -## 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). - - -## Architecture - -**Online Boutique** is composed of 11 microservices written in different -languages that talk to each other over gRPC. See the [Development Principles](/docs/development-principles.md) doc for more information. - -[![Architecture of -microservices](./docs/img/architecture-diagram.png)](./docs/img/architecture-diagram.png) - -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 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 - -- **[Kubernetes](https://kubernetes.io)/[GKE](https://cloud.google.com/kubernetes-engine/):** - The app is designed to run on Kubernetes (both locally on "Docker for - Desktop", as well as on the cloud with GKE). -- **[gRPC](https://grpc.io):** Microservices use a high volume of gRPC calls to - communicate to each other. -- **[Istio](https://istio.io):** Application works on Istio service mesh. -- **[OpenCensus](https://opencensus.io/) Tracing:** Most services are - instrumented using OpenCensus trace interceptors for gRPC/HTTP. -- **[Cloud Operations (Stackdriver)](https://cloud.google.com/products/operations):** Many services - are instrumented with **Profiling**, **Tracing** and **Debugging**. In - addition to these, using Istio enables features like Request/Response - **Metrics** and **Context Graph** out of the box. When it is running out of - Google Cloud, this code path remains inactive. -- **[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. - -## 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 - -- [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 - ---- - -This is not an official Google project. \ No newline at end of file diff --git a/cloudbuild.yaml b/cloudbuild.yaml deleted file mode 100644 index 793f452b630..00000000000 --- a/cloudbuild.yaml +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This configuration file is used to build and deploy the app into a -# GKE cluster using Google Cloud Build. -# -# PREREQUISITES: -# - Cloud Build service account must have role: "Kubernetes Engine Developer" - -# USAGE: -# GCP zone and GKE target cluster must be specified as substitutions -# Example invocation: -# `gcloud builds submit --config=cloudbuild.yaml --substitutions=_ZONE=us-central1-b,_CLUSTER=demo-app-staging .` - -steps: -- id: 'Deploy application to cluster' - name: 'gcr.io/k8s-skaffold/skaffold:v0.20.0' - entrypoint: 'bash' - args: - - '-c' - - > - gcloud container clusters get-credentials --zone=$_ZONE $_CLUSTER; - skaffold run -f=skaffold.yaml --default-repo=gcr.io/$PROJECT_ID; - -# Add more power, and more time, for heavy Skaffold build -timeout: '3600s' -options: - machineType: 'N1_HIGHCPU_8' \ No newline at end of file diff --git a/hack/make-docker-images.sh b/hack/make-docker-images.sh index 9cff93701a4..82b4ae63206 100755 --- a/hack/make-docker-images.sh +++ b/hack/make-docker-images.sh @@ -1,29 +1,9 @@ #!/usr/bin/env bash - -# Copyright 2019 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Builds and pushes docker image for each demo microservice. - set -euo pipefail SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - log() { echo "$1" >&2; } - TAG="${TAG:?TAG env variable must be specified}" REPO_PREFIX="${REPO_PREFIX:?REPO_PREFIX env variable must be specified}" - while IFS= read -d $'\0' -r dir; do # build image svcname="$(basename "${dir}")" diff --git a/skaffold.yaml b/skaffold.yaml deleted file mode 100644 index 7ff75ce4683..00000000000 --- a/skaffold.yaml +++ /dev/null @@ -1,67 +0,0 @@ -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: skaffold/v1beta2 -kind: Config -build: - artifacts: - # image tags are relative; to specify an image repo (e.g. GCR), you - # must provide a "default repo" using one of the methods described - # here: - # https://skaffold.dev/docs/concepts/#image-repository-handling - - image: emailservice - context: src/emailservice - - image: productcatalogservice - context: src/productcatalogservice - - image: recommendationservice - context: src/recommendationservice - - image: shippingservice - context: src/shippingservice - - image: checkoutservice - context: src/checkoutservice - - image: paymentservice - context: src/paymentservice - - image: currencyservice - context: src/currencyservice - - image: cartservice - context: src/cartservice/src - - image: frontend - context: src/frontend - - image: loadgenerator - context: src/loadgenerator - - image: adservice - context: src/adservice - tagPolicy: - gitCommit: {} - local: - useBuildkit: false -deploy: - kubectl: - manifests: - - ./kubernetes-manifests/**.yaml -profiles: -# "gcb" profile allows building and pushing the images -# on Google Container Builder without requiring docker -# installed on the developer machine. However, note that -# since GCB does not cache the builds, each build will -# start from scratch and therefore take a long time. -# -# This is not used by default. To use it, run: -# skaffold run -p gcb -- name: gcb - build: - googleCloudBuild: - diskSizeGb: 300 - machineType: N1_HIGHCPU_32 - timeout: 4000s