Skip to content

E-commerce microservices with .NET Core 6, SQL Server, MySQL, PosgresSQL, MongoDB, Redis, RabbitMQ, Serilog, Elasticsearch, Ocelot, dentity Server, Docker, Polly, Hangfire

Notifications You must be signed in to change notification settings

huynhdieutuong/tedu-microservice

Repository files navigation

Tedu AspnetCore Microservices:

Prepare environment

  • Install dotnet core version in file global.json
  • IDE: Visual Studio 2022+, Rider, Visual Studio Code
  • Docker Desktop

How to run the project

Run command for build project

dotnet build

Go to folder contain file docker-compose

  1. Using docker-compose
docker-compose -f docker-compose.yml -f docker-compose.override.yml up -d --remove-orphans

Application URLs - LOCAL Environment (Docker Container):

Docker Application URLs - LOCAL Environment (Docker Container):

  1. Using Visual Studio 2022
  • Open aspnetcore-microservices.sln - aspnetcore-microservices.sln
  • Run Compound to start multi projects

Application URLs - DEVELOPMENT Environment:


Application URLs - PRODUCTION Environment:


Packages References

Install Environment

References URLS

Docker Commands: (cd into folder contain file docker-compose.yml, docker-compose.override.yml)

  • Up & running:
docker-compose -f docker-compose.yml -f docker-compose.override.yml up -d --remove-orphans --build
  • Stop & Removing:
docker-compose down

Useful commands:

  • ASPNETCORE_ENVIRONMENT=Development dotnet ef database update
  • dotnet watch run --environment "Development"
  • dotnet restore
  • dotnet build
  • Migration commands for Ordering API:
    • cd into Ordering folder
    • dotnet ef migrations add "Int_OrderDB" -p Ordering.Infrastructure --startup-project Ordering.API --output-dir Persistence/Migrations
    • dotnet ef migrations remove -p Ordering.Infrastructure --startup-project Ordering.API
    • dotnet ef database update -p Ordering.Infrastructure --startup-project Ordering.API


Microservices architecture principles

1. A microservices has a single concern

  • Should do one thing and one thing only = Single object responsibility
  • Easier to maintain and scale

2. A microservice is a discrete

  • Must clear boudaries separating it from its environment
  • Must be well-encapsulated
  • Development: Isolated from all other microservices
  • Production: It becomes part of a larger application after deployment

3. A microservices is transportable

  • Can be moved from one runtime environment to another
  • Easier to use in an automated or declarative deployment process

4. A microservice carries its own data

  • Should have its own data storage that is isolated from all other microservices
  • Shared with other microservices by a public interface
  • The common problem is data redundancy

5. A microservice is ephemeral

  • It can be created, destroyed, and replenished on demand
  • The standard operating expectation is that microservices come and go all the time, sometimes due to system failure and sometimes due to scaling demands

Microservice communication

1. Synchronous protocol

  • HTTP/HTTPS
  • The client sends a request and waits for a response from the service
  • Thread is blocked
  • The client code can only continue its task when it receives the HTTP server response.

2. Asynchronous protocol

  • AMQP (a protocol supported by many OS and cloud environments)
  • Asynchronous messages
  • The client send message and doesn't wait for a response
  • RabbitMQ or Kafka is a message queue

About

E-commerce microservices with .NET Core 6, SQL Server, MySQL, PosgresSQL, MongoDB, Redis, RabbitMQ, Serilog, Elasticsearch, Ocelot, dentity Server, Docker, Polly, Hangfire

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published