This project is inspired from CoolStore project by JBoss Demo Central & Red Hat Demo Central
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.
- From Microservices to Service Mesh - DevCafe Event - July 2018
- Service Mesh for Microservices- Vietnam Mobile Day Event - June 2018
- Prerequisites
- Services
- Up and Running
- µService Development
- Open API
- CI/CD
- Contributing
- Contributors
- Licence
- Windows 10
- Windows Subsystem Linux (WSL - Ubuntu OS)
- Docker for Windows (Kubernetes enabled)
- kubectl
- helm
- istioctl
There are several individual microservices and infrastructure components that make up this app:
- Catalog Service: NodeJS service and MongoDB, serves products and prices for retail products
- Cart Service: .NET Core service which manages shopping cart for each customer
- Inventory Service: .NET Core service and SQL Server, serves inventory and availability data for retail products
- Pricing Service: .NET Core service which is a business rules application for product pricing
- Review Service: .NET Core service and SQL Server running for writing and displaying reviews for products
- Rating Service: NodeJS service running for rating products
- IdP: Identity Provider using IdentityServer4 to authentication with OAuth 2.0 and OpenID Connect for the whole stack
-
Make sure we have
Docker for Windows
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
- 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
Thang Chung | Thinh Nguyen |
---|---|
Code released under the MIT license.