Giter Site home page Giter Site logo

rajibmitra / coolretailer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kbhattac/coolretailer

0.0 1.0 0.0 2.11 MB

Microservices with Istio, gRPC, Redis, BigQuery, Spring Boot, Spring Cloud and Stackdriver

License: Apache License 2.0

Shell 28.39% HTML 10.25% Dockerfile 1.33% Java 51.44% Python 3.80% CSS 3.38% JavaScript 1.41%

coolretailer's Introduction

Coverage Status Build Status License

CoolRetailer

Microservices application with Istio, gRPC, Redis, BigQuery, Spring Boot, Spring Cloud and Stackdriver

  • Smart product finder with autocomplete feature
  • Distributed Stackdriver Tracing with Log correlation across gRPC calls
  • Istio based Stackdriver Service Monitoring
  • Automatic synthetic load generation with Locust
  • Complete CI/CD to GKE with Google Cloud Build
  • Redis in Master/Slave replication mode (image from Bitnami)
  • Autocomplete logic based on ZRANGEBYLEX Redis command
  • Tunable cache size
  • Dataset from BestBuy (converted to ndjson using JsonProcessor)
  • Developed completely with VSCode
  • Inspired by Next '18 Microservices Demo
  • Covering slides on Slideshare

Architecture:

Architecture

Automatic Installation:

Open in Cloud Shell

Guided one click installation from Google Cloud Shell. Complete stack (incl. all dashboards shown below + Istio fault simulation). No client tooling required.

Manual Installation:

  • Get the Best Buy products dataset and save it to a GCS bucket:
  • BQ requires the JSON to be new line delimited. Use the provided utility JSON processor for this:
java -jar src/queryservice/target/queryservice-1.0.0.jar \
    --spring.profiles.active=JSON \
    --input.json="$PWD"/products.json --exit
  • Load it to BQ as dataset coolretailer.products from GCS
  • Create a GCP service account with the following roles:

BigQuery Data Viewer, BigQuery Job User, Stackdriver Debugger Agent, Cloud Trace Agent, Context Graph Asserter, Error Reporting Admin, Logs Writer, Monitoring Metric Writer

and install the private key as app-gac.json as kubernetes secret app-gac.

  • apply Istio manifests in: setup/istio-manifests
  • set PROJECT_ID, TAG_NAME, REDIS_HOST in setup/kubernetes-manifests/ and apply them

Notes:

  • Spring Cloud Sleuth Stackdriver Trace and Logging enabled.
  • Complete CI/CD pipeline with Google Cloud Build.
  • Test locally using:
$mvn spring-boot:run \
    -DGOOGLE_APPLICATION_CREDENTIALS=path-to-key-file \
    -DPROJECT_ID=coolretailer \
    -DGOOGLE_CLOUD_PROJECT=coolretailer \
    -Dspring-boot.run.arguments=--spring.redis.host=localhost
  • Using docker from Cloud Shell:

(If tunneling to the redis service is required)

gcloud container clusters get-credentials coolretailer2 --zone europe-west4-a --project coolretailer \
 && kubectl port-forward $(kubectl get pod --selector="app=redis-master,role=master,tier=backend" --output jsonpath='{.items[0].metadata.name}') 6379:6379

gcloud auth configure-docker -q &&\
docker run \
    --network=host \
    -v /home/kbhattacharya:/etc/app-gac \
    -e GOOGLE_CLOUD_PROJECT=coolretailer \
    -e PROJECT_ID=coolretailer \
    -e GOOGLE_APPLICATION_CREDENTIALS=/etc/app-gac/app-gac.json \
    -e --spring.sleuth.sampler.probability=1.0 \
    -e --spring.application.name=ux-local \
    -e --spring.cloud.gcp.trace.enabled=true \
    -e --spring.cloud.gcp.logging.enabled=true \
    -e --spring.cloud.gcp.project-id=coolretailer \
    -it gcr.io/coolretailer/queryservice
  • Use Cloud Memorystore instead of the Redis deployments (src/setup/kubernetes-manifests/archive/redis):
  • Istio TLS setup
  • See setup/istio-manifests/secure for simple TLS configuration
  • The static content is recommended to be served from a GCS bucket with Cloud CDN. Just drop off the content of src/ui/static/ui.* and src/ui/static/lib in a GCS bucket and provide allUsers READER access.

Screenshots:

Application

CoolRetailer

Cloud Trace with Log correlation

Trace

Istio fault injection

Mesh

Grafana

Grafana

Istio Service monitoring

Istio

Kubernetes CPU telemetry

CPU

Disclaimer:

This is not an official Google product

coolretailer's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.