GitHub - vietnam-devs/coolstore-microservices: A containerized polyglot microser...
source link: https://github.com/vietnam-devs/coolstore-microservices
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
README.md
Cool Store: Cloud-Native Microservices Application on Service Mesh
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 application to demonstrate Kubernetes, AKS, Istio and similar cloud-native technologies in events as following
- From Microservices to Service Mesh - DevCafe Event - July 2018
- Service Mesh for Microservices- Vietnam Mobile Day Event - June 2018
Table of contents
- Prerequisites
- Installation
- µService Development
- Open API
- CI/CD
- Service Mesh
- Contributing
- Contributors
- Licence
Prerequisites
- Windows 10
- Windows Subsystem Linux (WSL - Ubuntu OS)
- Docker for Desktop (Kubernetes enabled)
- kubectl
- helm
- istioctl
µ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 Mongohttp://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
Architecture of µServices
Features
- 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.
- NetCoreKit: Set of Cloud Native tools and utilities for .NET Core.
Installation
Development environment: Up and Running locally with "Docker for Desktop"
-
Make sure we have
Docker for Desktop
running withKubernetes
option enabled. We need to installkubectl
,helm
andistioctl
on the build machine as well. -
From current console, type
bash
to enterLinux Subsystem (Ubuntu)
-
Then
cd
into your root of project
> ./deploys/cs-build.sh
It should run and package all docker images.
- 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
- Get
istio-ingressgateway
IP address
> kubectl get services istio-ingressgateway -n istio-system -o=jsonpath={.spec.clusterIP}
> 10.96.34.68 <== example IP
- Create
values.dev.local.yaml
file indeploys/charts/coolstore
, and put content like
gateway:
ip: 10.96.34.68
- Apply
istioctl
command tocoolstore
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 -
- 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
> curl -I http://coolstore.local # website
> curl -I http://api.coolstore.local # api gateway
> curl -I http://id.coolstore.local # identity provider
- Clean up
coolstore
chart as
> kubectl delete -f deployment/istio/dev-all-in-one.yaml
> helm delete istio --purge
Notes:
- Global path
Set
PATH
fordocker
,kubectl
,helm
, andistioctl
.
- Run with Nginx (not recommendation)
If you want to run just only
Kubernetes
+nginx-ingress
go todeploys/charts/coolstore/values.yaml
, and modify as followingnginx: enabled: true
Then run the
helm
command ashelm 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
Open API
CI/CD
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.
At a high level, Istio helps reduce the complexity of these deployments, and eases the strain on your development teams. It is a completely open source service mesh that layers transparently onto existing distributed applications. It is also a platform, including APIs that let it integrate into any logging platform, or telemetry or policy system. Istio’s diverse feature set lets you successfully, and efficiently, run a distributed microservice architecture, and provides a uniform way to secure, connect, and monitor microservices.
Distributed Tracing
Metrics
Screenshots
- Home page
- Cart page
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :p
Contributors
Thang Chung Thinh NguyenLicence
Code released under the MIT license.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK