- Install dotnet core version in file
global.json
- IDE: Visual Studio 2022+, Rider, Visual Studio Code
- Docker Desktop
Run command for build project
dotnet build
Go to folder contain file docker-compose
- Using docker-compose
docker-compose -f docker-compose.yml -f docker-compose.override.yml up -d --remove-orphans
- Product API: http://localhost:6002/api/products
- Customer API: http://localhost:6003/api/customers
- Basket API: http://localhost:6004/api/baskets
- Order API: http://localhost:6005/api/v1/orders
- Portainer: http://localhost:9000 - username: admin ; pass: "{your-password}"
- Kibana: http://localhost:5601 - username: elastic ; pass: admin
- RabbitMQ: http://localhost:15672 - username: guest ; pass: guest
- Using Visual Studio 2022
- Open aspnetcore-microservices.sln -
aspnetcore-microservices.sln
- Run Compound to start multi projects
- Product API: http://localhost:5002/api/products
- Customer API: http://localhost:5003/api/customers
- Basket API: http://localhost:5004/api/baskets
- Order API: http://localhost:5005/api/orders
- https://docs.microsoft.com/en-us/aspnet/core/tutorials/grpc/grpc-start?view=aspnetcore-6.0&tabs=visual-studio
- https://docs.microsoft.com/en-us/aspnet/core/fundamentals/minimal-apis?view=aspnetcore-6.0
- https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mongo-app?view=aspnetcore-6.0&tabs=visual-studio
- https://docs.microsoft.com/en-us/aspnet/core/grpc/troubleshoot?view=aspnetcore-6.0
- https://github.com/ThreeMammals/Ocelot
- https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-6.0
- https://docs.microsoft.com/en-us/aspnet/web-api/overview/advanced/httpclient-message-handlers
- https://github.com/dotnet-architecture/eShopOnContainers
- https://github.com/jasontaylordev/CleanArchitecture
- Up & running:
docker-compose -f docker-compose.yml -f docker-compose.override.yml up -d --remove-orphans --build
- Stop & Removing:
docker-compose down
- 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
- Should do one thing and one thing only = Single object responsibility
- Easier to maintain and scale
- 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
- Can be moved from one runtime environment to another
- Easier to use in an automated or declarative deployment process
- 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
- 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
- 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.
- 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