AspnetRun Microservices Renewed !

Mehmet Ozkaya
4 min readFeb 25, 2021

--

I have a huge update for Microservices repository. The repository is totally renewed. New version has extensive enhancements with implementing lots of best practices.
Please check the repository and give a star on github;
https://github.com/aspnetrun/run-aspnetcore-microservices

Udemy Microservices course also will be update according to new repository changes. You can find the whole new details as below. For run docker-compose, Docker Memory should be at least 4 GB.

Building Microservices on .Net Ecosystem

Used Asp.Net Web API, Docker, RabbitMQ, MassTransit, Grpc, Ocelot API Gateway, MongoDB, Redis, PostgreSQL, SqlServer, Dapper, Entity Framework Core, CQRS and Clean Architecture implementation. Also includes Cross-Cutting concerns like Implementing Centralized Distributed Logging with Elasticsearch, Kibana and SeriLog, use the HealthChecks with Watchdog, Implement Retry and Circuit Breaker patterns with Polly and so on..

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

Basket Microservice
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
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

Installing Project

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

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

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

You can launch microservices as below urls:

Launch http://host.docker.internal:8007 in your browser to view the Web Status. Make sure that every microservices are healthy.

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.

You will see the above screen. After that you can perform the main use case which is add item to basket and check out the basket in order to create order.

Catalog — Basket — Order
Add to Basket
Checkout Basket

You can follow the use case from RabbitMQ Dashboard and Kibana Logs.

--

--

Mehmet Ozkaya
Mehmet Ozkaya

Written by Mehmet Ozkaya

Software Architect | Udemy Instructor | AWS Community Builder | Cloud-Native and Serverless Event-driven Microservices https://github.com/mehmetozkaya

Responses (3)