Skip to content

Learn microservice with multiple technique via a ecommerce project

Notifications You must be signed in to change notification settings

huydq2152/ecommerce_microservice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prepare environment

  • Install dotnet core version in file global.json
  • IDE: Visual Studio 2022+, Rider, Visual Studio Code
  • Docker Desktop
  • EF Core tools reference (.NET CLI):
dotnet tool install --global dotnet-ef

Warning:

Some docker images are not compatible with Apple Chip (M1, M2). You should replace them with appropriate images. Suggestion images below:

  • sql server: mcr.microsoft.com/azure-sql-edge
  • mysql: arm64v8/mysql:oracle

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

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

If docker desktop takes up too much disk space

  1. Run docker desktop
  2. Run cmd
  • docker system df
  • docker image prune
  • docker volume prune
  • docker builder prune
  1. Go to %APPDATA%\Docker or %LOCALAPPDATA%\Docker and delete this folder to delete all log file of docker

Useful commands:

  • ASPNETCORE_ENVIRONMENT=Production 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 "SampleMigration" -p Ordering.Infrastructure --startup-project Ordering.API -o Persistence/Migrations
    • dotnet ef migrations remove -p Ordering.Infrastructure --startup-project Ordering.API
    • dotnet ef database update -p Ordering.Infrastructure --startup-project Ordering.API

About

Learn microservice with multiple technique via a ecommerce project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published