Code Monkey home page Code Monkey logo

cdoru / coolstore-microservices Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vietnam-devs/coolstore-microservices

0.0 2.0 0.0 20.76 MB

:ferris_wheel: :sailboat: :ship: A containerized polyglot microservices consisting of services based on .NET Core, NodeJS and more running on service mesh (istio).

License: MIT License

Smarty 0.76% Dockerfile 1.90% Shell 3.05% PowerShell 0.47% Batchfile 0.22% C# 56.13% TypeScript 7.51% JavaScript 16.79% CSS 2.13% Vue 10.56% HTML 0.48%

coolstore-microservices's Introduction

Cool Store: Cloud-Native Microservices Application on Service Mesh

Price Travis (.org)

This project is inspired from CoolStore project by JBoss Demo Central & Red Hat Demo Central

The structure of README is inspired from GoogleCloudPlatform Demo. Thank you @ahmetb

CoolStore is a containerised polyglot microservices application consisting of services based on .NET Core, NodeJS and more running on Service Mesh.

It demonstrates how to wire up small microservices into a larger application using microservice architectural principals.

Presentation

Our team uses this demo application to demonstrate Kubernetes, AKS, Istio and similar cloud-native technologies in events as following

Table of contents

Prerequisites

  • Windows 10: The OS for developing and building this demo application .
  • Windows Subsystem Linux - Ubuntu OS: The subsystem that helps to run easily the bash shell on Windows OS.
  • Docker for Desktop (Kubernetes enabled): The easiest tool to run Docker, Docker Swarm and Kubernetes on Mac and Windows.
  • Kubernetes/AKS: The app is designed to run on Kubernetes (both locally on "Docker for Desktop", as well as on the cloud with AKS).
  • Istio: Application works on Istio service mesh.
  • helm: The best package manager to find, share, and use software built for Kubernetes.
  • NetCoreKit: Set of Cloud-native tools and utilities for .NET Core.

Overall Architecture of µServices

Architecture Screenshot

µServices

There are several individual µservices and infrastructure components that make up this app:

No. Service Description Language Database Endpoints
1 Catalog Serves products and prices for retail products Node.js Mongo http://localhost:5002 or http://api.coolstore.local/catalog
2 Cart Manages shopping cart for each customer .NET Core MySQL http://localhost:5003 or http://api.coolstore.local/cart
3 Inventory Serves inventory and availability data for retail products .NET Core MySQL http://localhost:5004 or http://api.coolstore.local/inventory
4 Pricing Handles a business rules application for product pricing .NET Core MySQL http://localhost:5005 or http://api.coolstore.local/pricing
5 Review Runs for writing and displaying reviews for products .NET Core MySQL http://localhost:5006 or http://api.coolstore.local/review
6 Rating Runs for rating products Node.js Mongo http://localhost:5007 or http://api.coolstore.local/rating
7 IdP Uses IdentityServer4 to authentication with OAuth 2.0 and OpenID Connect for the whole stack .NET Core In Memory http://localhost:5001 or http://id.coolstore.local
8 Web UI (PWA) Frontend based on vuejs and Node.js Vuejs + Node.js N/A http://localhost:8080 or http://coolstore.local

Installation

Development environment: Up and Running locally with "Docker for Desktop"
  1. Make sure we have Docker for Desktop running with Kubernetes option enabled. We need to install kubectl, helm and istioctl on the build machine as well.

  2. From current console, type bash to enter Linux Subsystem (Ubuntu)

  3. Then cd into your root of project

> ./deploys/scripts/build-all-images.sh

It should run and package all docker images.

  1. Download and install istio-1.0.0 on the box, and unzip it into somewhere, then initialize it with following commands
> cd <istio-1.0.0 path>
> kubectl create -f install/kubernetes/helm/helm-service-account.yaml
> helm init --service-account tiller --upgrade
  1. Get istio-ingressgateway IP address
> kubectl get services istio-ingressgateway -n istio-system -o=jsonpath={.spec.clusterIP}
> 10.96.34.68 <== for example, we get the IP as the left-hand side
  1. Create values.dev.local.yaml file in deploys/charts/coolstore, and put content like
gateway:
  ip: 10.96.34.68
  1. Apply istioctl command to coolstore chart
> helm template deploys/charts/coolstore -f deploys/charts/coolstore/values.dev.yaml -f deploys/charts/coolstore/values.dev.local.yaml > deploys/k8s/dev-all-in-one.yaml
> istioctl kube-inject -f deploys/k8s/dev-all-in-one.yaml | kubectl apply -f -
  1. Add hosts file with following content
127.0.0.1 api.coolstore.local
127.0.0.1 id.coolstore.local
127.0.0.1 coolstore.local

Waiting for the container provision completed

  1. Install coolstore-istio chart
> helm install deploys\charts\coolstore-istio --name coolstore-istio
  1. Access to following URLs
> curl -I http://coolstore.local # website
> curl -I http://api.coolstore.local # api gateway
> curl -I http://id.coolstore.local # identity provider
  1. Clean up coolstore chart as
> kubectl delete -f deployment/istio/dev-all-in-one.yaml
> helm delete coolstore-istio --purge
> helm delete istio --purge

Notes:

  1. Global path

Set PATH for docker, kubectl, helm, and istioctl.

  1. Run with Nginx (not recommendation)

If you want to run just only Kubernetes + nginx-ingress go to deploys/charts/coolstore/values.yaml, and modify as following

nginx:
   enabled: true

Then run the helm command as

helm install --name cs-nginx stable/nginx-ingress
Staging and Production environments: Up and Running on Azure Kubernetes Service (AKS)

5 steps to bring CoolStore’s Service Mesh to Azure Kubernetes Service

µService Development

Guidance for developing µService can be found at Clean Domain-Driven Design in 10 minutes

µService Screenshot

Open API

OpenAPI Screenshot

CI/CD

Lift and Shift

Service Mesh

Istio provide a wealth of benefits for the organizations that use them. There’s no denying, however, that adopting the cloud can put strains on DevOps teams. Developers must use microservices to architect for portability, meanwhile operators are managing extremely large hybrid and multi-cloud deployments. Istio lets you connect, secure, control, and observe services.

Distributed Tracing

DAG chart

Trace chart

Metrics

Metrics chart

Screenshots

Home page

home-page

Cart page

cart-page

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :p

Contributors

Thang Chung Thinh Nguyen
thangchung thinhnguyen

Licence

Code released under the MIT license.

coolstore-microservices's People

Contributors

thangchung avatar thinhnotes avatar thinhnguyenh avatar stuartleeks avatar

Watchers

Doru Cioclea avatar James Cloos 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.