当前位置: 首页 > 软件库 > 云计算 > >

run-aspnetcore-microservices

授权协议 MIT License
开发语言 Java
所属分类 云计算
软件类型 开源软件
地区 不详
投 递 者 汤飞羽
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

UDEMY COURSE WITH DISCOUNTED - Step by Step Development of this Repository -> https://www.udemy.com/course/microservices-architecture-and-implementation-on-dotnet/?couponCode=OCTOBER2021

See the overall picture of implementations on microservices with .net tools on real-world e-commerce microservices project;

microservices_remastered

There is a couple of microservices which implemented e-commerce modules over Catalog, Basket, Discount and Ordering microservices with NoSQL (MongoDB, Redis) and Relational databases (PostgreSQL, Sql Server) with communicating over RabbitMQ Event Driven Communication and using Ocelot API Gateway.

Check Explanation of this Repository on Medium

Whats Including In This Repository

We have implemented below features over the run-aspnetcore-microservices repository.

Catalog microservice which includes;

  • ASP.NET Core Web API application
  • REST API principles, CRUD operations
  • MongoDB database connection and containerization
  • Repository Pattern Implementation
  • Swagger Open API implementation

Basket microservice which includes;

  • ASP.NET Web API application
  • REST API principles, CRUD operations
  • Redis database connection and containerization
  • Consume Discount Grpc Service for inter-service sync communication to calculate product final price
  • Publish BasketCheckout Queue with using MassTransit and RabbitMQ

Discount microservice which includes;

  • ASP.NET Grpc Server application
  • Build a Highly Performant inter-service gRPC Communication with Basket Microservice
  • Exposing Grpc Services with creating Protobuf messages
  • Using Dapper for micro-orm implementation to simplify data access and ensure high performance
  • PostgreSQL database connection and containerization

Microservices Communication

  • Sync inter-service gRPC Communication
  • Async Microservices Communication with RabbitMQ Message-Broker Service
  • Using RabbitMQ Publish/Subscribe Topic Exchange Model
  • Using MassTransit for abstraction over RabbitMQ Message-Broker system
  • Publishing BasketCheckout event queue from Basket microservices and Subscribing this event from Ordering microservices
  • Create RabbitMQ EventBus.Messages library and add references Microservices

Ordering Microservice

  • Implementing DDD, CQRS, and Clean Architecture with using Best Practices
  • Developing CQRS with using MediatR, FluentValidation and AutoMapper packages
  • Consuming RabbitMQ BasketCheckout event queue with using MassTransit-RabbitMQ Configuration
  • SqlServer database connection and containerization
  • Using Entity Framework Core ORM and auto migrate to SqlServer when application startup

API Gateway Ocelot Microservice

  • Implement API Gateways with Ocelot
  • Sample microservices/containers to reroute through the API Gateways
  • Run multiple different API Gateway/BFF container types
  • The Gateway aggregation pattern in Shopping.Aggregator

WebUI ShoppingApp Microservice

  • ASP.NET Core Web Application with Bootstrap 4 and Razor template
  • Call Ocelot APIs with HttpClientFactory and Polly

Microservices Cross-Cutting Implementations

  • Implementing Centralized Distributed Logging with Elastic Stack (ELK); Elasticsearch, Logstash, Kibana and SeriLog for Microservices
  • Use the HealthChecks feature in back-end ASP.NET microservices
  • Using Watchdog in separate service that can watch health and load across services, and report health about the microservices by querying with the HealthChecks

Microservices Resilience Implementations

  • Making Microservices more resilient Use IHttpClientFactory to implement resilient HTTP requests
  • Implement Retry and Circuit Breaker patterns with exponential backoff with IHttpClientFactory and Polly policies

Ancillary Containers

  • Use Portainer for Container lightweight management UI which allows you to easily manage your different Docker environments
  • pgAdmin PostgreSQL Tools feature rich Open Source administration and development platform for PostgreSQL

Docker Compose establishment with all microservices on docker;

  • Containerization of microservices
  • Containerization of databases
  • Override Environment variables

Run The Project

You will need the following tools:

Installing

Follow these steps to get your development environment set up: (Before Run Start the Docker Desktop)

  1. Clone the repository
  2. Once Docker for Windows is installed, go to the Settings > Advanced option, from the Docker icon in the system tray, to configure the minimum amount of memory and CPU like so:
  • Memory: 4 GB
  • CPU: 2
  1. At the root directory which include docker-compose.yml files, run below command:
docker-compose -f docker-compose.yml -f docker-compose.override.yml up -d

Note: If you get connection timeout error Docker for Mac please Turn Off Docker's "Experimental Features".

  1. Wait for docker compose all microservices. That’s it! (some microservices need extra time to work so please wait if not worked in first shut)

  2. You can launch microservices as below urls:

  1. Launch http://host.docker.internal:8007 in your browser to view the Web Status. Make sure that every microservices are healthy.
  2. Launch http://host.docker.internal:8006 in your browser to view the Web UI. You can use Web project in order to call microservices over API Gateway. When you checkout the basket you can follow queue record on RabbitMQ dashboard.

mainscreen2

Note: If you are running this application in macOS then use docker.for.mac.localhost as DNS name in .env file and the above URLs instead of host.docker.internal.

Authors

See also the list of contributors who participated in this project. Check also gihtub page of repository.

 相关资料
  • ASP.NET Core 2.1 & Angular 7(+) Advanced Starter - PWA & Server-side prerendering (for Angular SEO)! Made with ❤️ by Trilon.io Harness the power of Angular 7+, ASP.NET Core 2.1, now with SEO ! Angular

  • 我的中有以下操作。NET核心2控制器。它是一个API,应该存储作为应用程序/x-www-form-urlencoded发布的所有数据 所以斯瓦格UI允许使用UI尝试这个动作:斯瓦格UI 但是SwaggerUI生成带有正文的POST:formData=field 1=value e1&field 2=value e2 我希望它是:field1=value1 所以问题是,这是OpenAPI的限制,还是

  • 无论如何处理路径,当我尝试访问{server}/{virtualdirectory}/swagger时,在应用程序中得到的是/swagger/v1/swagger.json文件中的404。UI加载,但它不会加载json文件,因为它总是试图在服务器根查找它。 有人能给我指个正确的方向吗?

  • 问题内容: 我正在尝试运行多个这样的命令。 但这给我“没有这样的文件或目录”错误,因为它被解释为… 似乎需要一些ESCAPE字符,例如“”或()。 所以我也试过了 但是这些没有用。 我已经搜索了Docker Run Reference, 但没有找到有关ESCAPE字符的任何提示。 问题答案: 要在docker中运行多个命令,请使用和分号 如果仅在command1(cd)返回零(无错误)退出状态时需

  • 运行外部程序。与 Run 不同, RunWait 会等待程序结束才继续往后执行. Run, Target [, WorkingDir, Max|Min|Hide|UseErrorLevel, OutputVarPID] 参数 Target 要运行的文档, URL, 可执行文件 (.exe, .com, .bat, 等等), 快捷方式 (.lnk) 或 系统动词 (请参阅备注). 如果 Target

  • Runs a defined package script. You may define scripts in your package.json file. { "name": "my-package", "scripts": { "build": "babel src -d lib", "test": "jest" } } yarn run [script] [