Upgrade to Pro — share decks privately, control downloads, hide ads and more …

.NET Aspire - .NET Conf IL - Tamir Dresher

.NET Aspire - .NET Conf IL - Tamir Dresher

.NET Aspire is an opinionated, cloud ready stack for building observable, production ready,
distributed applications.

Tamir Dresher

January 31, 2024
Tweet

More Decks by Tamir Dresher

Other Decks in Programming

Transcript

  1. eShop as an example • Running multiple interconnected services •

    Expressing the system structure • Configuring service discovery • Multiple instances • Making it production grade: reliability, health checks, logging, telemetry etc. • Local experience for observability and debuggability https://github.com/dotnet/eshop
  2. .NET Aspire Opinionated, cloud ready stack for building observable, production

    ready, distributed applications. .NET .NET Aspire Composition & Orchestration Components Tools • Modeling language for defining the system resources and their dependencies • A runtime to for running and connecting multi-project applications and their dependencies • Dashboard • Distributed App VS support • Service Defaults • Publishing utils • Packages of commonly used services, such as Redis or Postgres, with standardized interfaces and capabilities
  3. .NET Aspire Opinionated, cloud ready stack for building observable, production

    ready, distributed applications. .NET .NET Aspire Composition & Orchestration Components Tools • Modeling language for defining the system resources and their dependencies • A runtime to for running and connecting multi-project applications and their dependencies • Dashboard • Distributed App VS support • Service Defaults • Publishing utils • Packages of commonly used services, such as Redis or Postgres, with standardized interfaces and capabilities Orchestration Components Tools Behind the scenes
  4. Q: Where is the link between ‘webfrontend’ and ‘cache’? A:

    Aspire set the env callback to set env-var with the url Orchestration Components Tools Behind the scenes
  5. A few interesting examples Resource specific declarative config Multiple instances

    External JS app Orchestration Components Tools Behind the scenes
  6. .NET Aspire Opinionated, cloud ready stack for building observable, production

    ready, distributed applications. .NET .NET Aspire Composition & Orchestration Components Tools • Modeling language for defining the system resources and their dependencies • A runtime to for running and connecting multi-project applications and their dependencies • Dashboard • Distributed App VS support • Service Defaults • Publishing utils • Packages of commonly used services, such as Redis or Postgres, with standardized interfaces and capabilities Orchestration Components Tools Behind the scenes
  7. Standardizing how we use the system resources • Each system

    resource our app depends on should be consumed by standardized client • The client should provide – Observability and telemetry > Logs > Trace > Metrics – Health checks – Resiliency - the ability of your system to react to failure and still remain functional > Retries > Timeouts > Circuit breakers • All the above should conform to the same conventions (configuration, API surface etc) stated in https://github.com/dotnet/aspire/blob/main/src/Components/README.md Orchestration Components Tools Behind the scenes
  8. Standardizing how we use the system resources • Each system

    resource our app depends on should be consumed by standardized client • The client should provide – Observability and telemetry > Logs > Trace > Metrics – Health checks – Resiliency - the ability of your system to react to failure and still remain functional > Retries > Timeouts > Circuit breakers • All the above should conform to the same conventions (configuration, API surface etc) stated in https://github.com/dotnet/aspire/blob/main/src/Components/README.md Orchestration Components Tools Behind the scenes
  9. Standardizing how we use the system resources • Each system

    resource our app depends on should be consumed by standardized client • The client should provide – Observability and telemetry > Logs > Trace > Metrics – Health checks – Resiliency - the ability of your system to react to failure and still remain functional > Retries > Timeouts > Circuit breakers • All the above should conform to the same conventions (configuration, API surface etc) stated in https://github.com/dotnet/aspire/blob/main/src/Components/README.md Orchestration Components Tools Behind the scenes
  10. Kafka as an example dotnet add package Aspire.Confluent.Kafka builder.AddKafkaProducer<string, string>(“purchase-events");

    { "ConnectionStrings": { "purchase-events": “..." }, "Aspire": { "Confluent": { "Kafka": { "Producer": { "HealthChecks": true, "Config": { "Acks": "All" } } } } } } appsettings.json Orchestration Components Tools Behind the scenes
  11. .NET Aspire Opinionated, cloud ready stack for building observable, production

    ready, distributed applications. .NET .NET Aspire Composition & Orchestration Components Tools • Modeling language for defining the system resources and their dependencies • A runtime to for running and connecting multi-project applications and their dependencies • Dashboard • Distributed App VS support • Service Defaults • Publishing utils • Packages of commonly used services, such as Redis or Postgres, with standardized interfaces and capabilities Orchestration Components Tools Behind the scenes
  12. Aspire Manifest • Aspire project can generate a manifest that

    can later be used by other tools to deploy into an environment – Think of it as the IL for a distributed .NET app dotnet run --project AspireApp.AppHost.csproj ` --publisher manifest --output-path aspire-manifest.json AspireHost manifest.json deploy tool (azd/Aspir8) provision deploy Orchestration Components Tools Behind the scenes
  13. Aspire Manifest • Aspire project can generate a manifest that

    can later be used by other tools to deploy into an environment – Think of it as the IL for a distributed .NET app dotnet run --project AspireApp.AppHost.csproj ` --publisher manifest --output-path aspire-manifest.json Orchestration Components Tools Behind the scenes
  14. Orchestration Components Tools Behind the scenes Deploy the manifest to

    K8s or Compose with Aspir8 • https://github.com/prom3theu5/aspirational-manifests dotnet tool install -g aspirate --prerelease aspirate generate aspirate generate --output-format compose Kustomize: Compose:
  15. Service Defaults - Standardizing services behavior • Every service enlisted

    with Aspire will get automatic reference and call to – AddServiceDefaults() – MapDefaultEndpoints() – if a web project • Out of the box services gets these capabilities – OpenTelemetry – Default HealthChecks – Service Discovery – Standard Resiliency configuration for HttpClient Orchestration Components Tools Behind the scenes
  16. AspireHost Visual Studio DCP (Developer Control Plane) Start process with

    kubeconfig location Runs apiserver Orchestration Components Tools Behind the scenes
  17. AspireHost Visual Studio DCP (Developer Control Plane) Start process with

    kubeconfig location Runs apiserver Orchestration Components Tools Behind the scenes
  18. AspireHost Visual Studio DCP (Developer Control Plane) Start process with

    kubeconfig location Runs apiserver Orchestration Components Tools Behind the scenes
  19. AspireHost Visual Studio DCP (Developer Control Plane) Start process with

    kubeconfig location Runs apiserver Orchestration Components Tools Behind the scenes
  20. AspireHost Visual Studio DCP (Developer Control Plane) Start process with

    kubeconfig location Runs apiserver Orchestration Components Tools Behind the scenes
  21. AspireHost Visual Studio DCP (Developer Control Plane) Start process with

    kubeconfig location Runs apiserver Orchestration Components Tools Behind the scenes
  22. AspireHost Visual Studio DCP (Developer Control Plane) Start process with

    kubeconfig location Runs apiserver Orchestration Components Tools Behind the scenes
  23. AspireHost Visual Studio DCP (Developer Control Plane) Read projects info

    + launchProfiles Orchestration Components Tools Behind the scenes
  24. AspireHost Visual Studio DCP (Developer Control Plane) Read projects info

    + launchProfiles Orchestration Components Tools Behind the scenes
  25. AspireHost Visual Studio DCP (Developer Control Plane) Start process with

    kubeconfig location Runs apiserver Orchestration Components Tools Behind the scenes
  26. Orchestration Components Tools Behind the scenes AspireHost Visual Studio DCP

    (Developer Control Plane) Create resource %TEMP%\usvc-servicecontroller-serviceconfig\]resource[.yaml
  27. Orchestration Components Tools Behind the scenes Resource Proxy (traefik) AspireHost

    Visual Studio DCP (Developer Control Plane) Resource Proxy (traefik) Create resource %TEMP%\usvc-servicecontroller-serviceconfig\]resource[.yaml
  28. AspireHost Visual Studio DCP (Developer Control Plane) Resource Proxy (traefik)

    Create resource Orchestration Components Tools Behind the scenes %TEMP%\usvc-servicecontroller-serviceconfig\resource.yaml
  29. Orchestration Components Tools Behind the scenes AspireHost Visual Studio DCP

    (Developer Control Plane) Resource Proxy (traefik) Create resource %TEMP%\usvc-servicecontroller-serviceconfig\resource.yaml
  30. Orchestration Components Tools Behind the scenes AspireHost Visual Studio DCP

    (Developer Control Plane) Resource Proxy (traefik) Create resource %TEMP%\usvc-servicecontroller-serviceconfig\resource.yaml
  31. Orchestration Components Tools Behind the scenes AspireHost Visual Studio DCP

    (Developer Control Plane) Resource Proxy (traefik) Create resource %TEMP%\usvc-servicecontroller-serviceconfig\resource.yaml
  32. Resource Proxy (traefik) Resource Proxy (traefik) AspireHost Visual Studio DCP

    (Developer Control Plane) Resource Proxy (traefik) exe Run and attach docker run Set envvars Set binding: Services ConnectionStr Orchestration Components Tools Behind the scenes
  33. Resource Proxy (traefik) Resource Proxy (traefik) AspireHost Visual Studio DCP

    (Developer Control Plane) Resource Proxy (traefik) exe route requests route requests Orchestration Components Tools Behind the scenes
  34. .NET Aspire - Summary Opinionated, cloud ready stack for building

    observable, production ready, distributed applications. .NET .NET Aspire Composition & Orchestration Components Tools • Modeling language for defining the system resources and their dependencies • A runtime to for running and connecting multi-project applications and their dependencies • Dashboard • Distributed App VS support • Service Defaults • Publishing utils • Packages of commonly used services, such as Redis or Postgres, with standardized interfaces and capabilities