Awesome
CoolStore Web Application - :ferris_wheel: Modern Application on Dapr and Tye :sailboat:
CoolStore Website is a containerised microservices application consisting of services based on .NET Core running on Dapr. It demonstrates how to wire up small microservices into a larger application using microservice architectural principals.
This repository based on some of the old libraries. So be careful if you use it in your production environment!!!
We are working on practical-clean-ddd for the new version of building the .NET apps with domain-driven design, clean architecture with Docker, Kubernetes, Tye, and Dapr in a practical way 👍
Read documentation for more information.
The business domain is inspired from CoolStore project by JBoss Demo Central and Red Hat Demo Central.
Check out my medium, or my dev.to or say hi on Twitter!
Table of contents
- Dapr Building Blocks
- Screenshots
- Try it!
- OS, SDK, library, tooling and prerequisites
- µService development
- Open API
- CI/CD
- Public presentation
- Contributing
- Contributors
- Licence
Dapr Building Blocks
<table> <thead> <th>Name</th> <th>Usecase</th> <th>Apps Participants</th> </thead> <tbody> <tr> <td><b>Service-to-service invocation</b></td> <td> - User clicks to the detail product<br> - Populate product information for shopping cart items<br> - Order gets detail information of buyer </td> <td>productcatalogapp, inventoryapp, shoppingcartapp, identityapp</td> </tr> <tr> <td><b>State management</b></td> <td>Items in the shopping cart</td> <td>shoppingcartapp</td> </tr> <tr> <td><b>Publish and subscribe</b></td> <td>User clicks checkout button, and the checkout process happens. It triggers the pub/sub flow in the system</td> <td>shoppingcartapp, saleapp, identityapp</td> </tr> <tr> <td><b>Resource bindings</b></td> <td>Every 30 seconds and 1 minutes the validation process happens. It will change the status of order from Received to Process and Complete via Cron binding</td> <td>productcatalogapp, inventoryapp</td> </tr> <tr> <td><b>Observability</b></td> <td>All apps in the application are injected by daprd so that it's tracked and observed by dapr </td> <td>identityapp, webapigatewayapp, inventoryapp, productcatalogapp, shoppingcartapp, saleapp, web</td> </tr> <tr> <td><b>Secrets</b></td> <td>Bind with local secret file to hide password of redis</td> <td>inventoryapp, productcatalogapp, shoppingcartapp, saleapp</td> </tr> <tr> <td><b>Actors</b></td> <td>N/A</td> <td>N/A</td> </tr> </tbody> </table>Screenshots
Home page
Shopping Cart page
Order page
Try it
Make sure you have dapr
and tye
installed on your machine!
Only wanna see wth is it?
$ tye run
Go to http://localhost:8000
, and you're able to access to several endpoints whenevever it's ready as below:
- Web App:
http://localhost:3000
- Web Api Gateway:
http://localhost:5000
- Identity Server:
http://localhost:5001
Wanna go deeply to see how can we built it!
- Start core components
$ tye run tye.slim.yaml
- Start dapr apps locally via dapr cli
$ dapr run --app-port 5001 --app-id identityapp dotnet run -- -p src\Services\Identity\IdentityService\IdentityService.csproj
$ dapr run --app-port 5002 --app-id inventoryapp dotnet run -- -p src\Services\Inventory\InventoryService.Api\InventoryService.Api.csproj
$ dapr run --app-port 5003 --app-id productcatalogapp dotnet run -- -p src\Services\ProductCatalog\ProductCatalogService.Api\ProductCatalogService.Api.csproj
$ dapr run --app-port 5004 --app-id shoppingcartapp dotnet run -- -p src\Services\ShoppingCart\ShoppingCartService.Api\ShoppingCartService.Api.csproj
Now, you can start to develop, debug or explore more about dapr
with tye
via Coolstore Apps.
Enable
vm.max_map_count
for ElasticSearch via runsysctl -w vm.max_map_count=262144
OS, SDK, library, tooling and prerequisites
Infrastructure
Windows 10
- The OS for developing and building this demo application.WSL2 - Ubuntu OS
- the subsystem that helps to run easily the bash shell on Windows OSDocker for desktop (Kubernetes enabled)
- The easiest tool to run Docker, Docker Swarm and Kubernetes on Mac and WindowsKubernetes
/AKS
- The app is designed to run on Kubernetes (both locally on "Docker for Desktop" as well as on the cloud with AKS)helm
- Best package manager to find, share, and use software built for Kubernetesdapr
- An event-driven, portable runtime for building microservices on cloud and edgetye
- A developer tool that makes developing, testing, and deploying microservices and distributed applications easier
Back-end
.NET Core 5
- .NET Framework and .NET Core, including ASP.NET and ASP.NET CoreIdentityServer4
- Identity and Access Control solution for .NET CoreYARP
- A toolkit for developing high-performance HTTP reverse proxy applicationsFluentValidation
- Popular .NET validation library for building strongly-typed validation rulesMediatR
- Simple, unambitious mediator implementation in .NETEF Core
- Modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrationsScrutor
- Assembly scanning and decoration extensions for Microsoft.Extensions.DependencyInjectionserilog
- Simple .NET logging with fully-structured eventsNEST
- Elasticsearch.Net & NEST
Front-end
nodejs 10.x
- JavaScript runtime built on Chrome's V8 JavaScript enginetypescript
- A typed superset of JavaScript that compiles to plain JavaScriptcreate-react-app
- A modern web app by running one command
µService development
Guidance for developing µService can be found at Clean Domain-Driven Design in 10 minutes
Open API
CI/CD
Debug and Tracing Apps
- Setup Kibana with
TraceId
,HandlerName
,RequestPath
,level
and filter withHandlerName
Then, you can find the exception happend in code via Kibana dashboard with settings above. Grab the TraceId
, then paste it to Zipkin
dashboard, then you can see the tracing of this request as the following picture
Public presentation
- Service Mesh on AKS, the future is now - Microsoft Build event in May 2019
- From Microservices to Service Mesh - DevCafe event in July 2018
- Service Mesh for Microservices- Vietnam Mobile Day event in June 2018
- Avoid SPOF in Cloud-native Apps - Vietnam Web Summit event in December 2018
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 ✨
Thanks goes to these wonderful people (emoji key)
<table> <tbody> <tr> <td align="center" valign="top"> <img width="150" height="150" src="https://github.com/thangchung.png?s=150"> <br> <a href="https://github.com/thangchung">Thang Chung</a> <p> <a href="https://github.com/vietnam-devs/coolstore-microservices/commits?author=thangchung" title="Developer">💻</a> <a href="#question" title="Answering Questions">💬</a> <a href="#docs" title="Documentation">📖</a> <a href="#review" title="Reviewed Pull Requests">👀</a> <a href="#infra" title="Infrastructure">🚇</a> <a href="#maintance" title="Maintenance">🚧</a> </p> </td> <td align="center" valign="top"> <img width="150" height="150" src="https://github.com/tungphuong.png?s=150"> <br> <a href="https://github.com/tungphuong">Phuong Le</a> <p> <a href="https://github.com/vietnam-devs/coolstore-microservices/commits?author=tungphuong" title="Developer">💻</a> <a href="#package" title="Packaging">📦</a> <a href="#infra" title="Infrastructure">🚇</a> </p> </td> <td align="center" valign="top"> <img width="150" height="150" src="https://github.com/trumhemcut.png?s=150"> <br> <a href="https://github.com/trumhemcut">Phi Huynh</a> <p> <a href="#idea" title="Ideas & Planning">🤔</a> <a href="https://github.com/vietnam-devs/coolstore-microservices/commits?author=trumhemcut" title="Infrastructure">🚇</a> </p> </td> <td align="center" valign="top"> <img width="150" height="150" src="https://github.com/thinhnotes.png?s=150"> <br> <a href="https://github.com/thinhnotes">Thinh Nguyen</a> <p> <a href="https://github.com/vietnam-devs/coolstore-microservices/commits?author=thinhnotes" title="Developer">💻</a> <a href="#maintance" title="Maintenance">🚧</a> </p> </td> <td align="center" valign="top"> <img width="150" height="150" src="https://github.com/stuartleeks.png?s=150"> <br> <a href="https://github.com/stuartleeks">Stuart Leeks</a> <p> <a href="#docs" title="Documentation">📖</a> </p> </td> </tr> </tbody> </table>Licence
Code released under the MIT license.