Skip to content

An example of building .NET Core microservices with Dapr and Tye

Notifications You must be signed in to change notification settings

kimcuhoang/dapr-tye-simple-microservices

Repository files navigation

simple-microservices

An example of building .NET Core microservices with Dapr and Tye

ci

Overview

  • There are 3 services in this repo products-api, inventories-api, graphql-api run as Dapr clients which can be started by dapr run or tye run.
  • Observability
    • Distributed tracing: zipkin
    • Distributed logging: seq

Dapr Building Block

  1. Services Communication

    • Pub/Sub : Redis
      • Create a product at products-api then publish an event to inventories-api to create a product as well.
    • Service Invocation (aka Service Discovery)
      • Listing products at products-api within inventories information from inventories-api
  2. Observability

  3. Ingress

Prerequisites

  1. .NET Core 3.1
  2. Docker for desktop
  3. Install Dapr 0.9
  4. Install Tye 0.4

Running Locally

There are 2 options to start services

  1. 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.
  2. Starts Services with Darp

    • 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.

Why do we need an option to start services with Dapr while Tye can start with only one command?

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

  1. How Dapr works
  2. 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
  3. 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

Deploy to Kubernetes

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

Resources

Give a Star! ⭐

If you liked this project or if it helped you, please give a star ⭐ for this repository. Thank you!!!