An example of building .NET Core microservices with Dapr and Tye
- There are 3 services in this repo
products-api
,inventories-api
,graphql-api
run as Dapr clients which can be started bydapr run
ortye run
. - Observability
-
Services Communication
- Pub/Sub : Redis
- Create a product at
products-api
then publish an event toinventories-api
to create a product as well.
- Create a product at
- Service Invocation (aka Service Discovery)
- Listing products at
products-api
within inventories information frominventories-api
- Listing products at
- Pub/Sub : Redis
-
Observability
- .NET Core 3.1
- Docker for desktop
- Install Dapr 0.9
- Install Tye 0.4
There are 2 options to start services
-
Starts Services with Tye which is default mode
- In this mode, all of services has been started by Tye. Also, we utilize the extensions which are supported out-of-the-box.
-
- By running this mode, we use Tye as docker-compose to start the infrastructure, i.e. seq and sqlserver. Then, all services will be started manually with
dapr run
command.
- By running this mode, we use Tye as docker-compose to start the infrastructure, i.e. seq and sqlserver. Then, all services will be started manually with
Perhaps, this question maybe rise up when every one touch this repository. It just because this repo aims to apply purely Dapr before apply Tye in order to understand
- How Dapr works
- Without Tye
- We have to plug serilog and its extension for seq to implement Distributed Logging
- The services need to be predefined with specific port number
- If we apply Tye, we do not need to do the above stuffs, because it simplify microservices development by making it easy to:
- Run many services with one command
- Use dependencies in containers
- Discover addresses of other services using simple conventions
After experience on locally and see how Tye is useful, then we may want to step up by deploy to Kubernetes, of course with Tye as well. This guide is step-by-step of:
- Install infrastructure via Helm: SqlServer, Redis, Seq, Zipkin and even Dapr
- Using
tye deploy
to deploy our micro-services to Kubernetes - Using NGINX Ingress Controller to avoid
kubectl port-forward
- Monitoring with Grafana and Prometheus
- HttpClientFactory .NET Core 2.1
- Issue: Globalization Invariant Mode is not supported while using EntityFramework Core with dotnet core alpine images
- Github Actions Documentation
- Dapr
- Serilog Best Practices
- 5 ways to set the URLs for an ASP.NET Core app
- Introduction Project Tye
- MediatR Pipeline Behaviour in ASP.NET Core – Logging and Validation
If you liked this project or if it helped you, please give a star ⭐ for this repository. Thank you!!!