Overview
This guide will walk you through running the complete AspNetRun Microservices e-commerce application using Docker Compose. The application includes multiple microservices (Catalog, Basket, Discount, Ordering), databases (PostgreSQL, Redis, SQL Server), a message broker (RabbitMQ), an API Gateway (Yarp), and a web UI.Make sure you have completed all prerequisites before starting this guide.
Architecture Overview
The application consists of:- Catalog Service - Product catalog management with PostgreSQL
- Basket Service - Shopping cart with Redis cache
- Discount Service - gRPC service for discounts with SQLite
- Ordering Service - Order processing with SQL Server and RabbitMQ
- Yarp API Gateway - Reverse proxy with rate limiting
- Shopping Web UI - ASP.NET Core web application
Configure Docker Desktop
Before running the application, ensure Docker Desktop has sufficient resources allocated:
- Open Docker Desktop
- Go to Settings → Resources
- Configure the following minimum requirements:
- Memory: 4 GB (recommended: 8 GB)
- CPU: 2 cores (recommended: 4 cores)
- Disk: 20 GB available space
- Click Apply & Restart to save changes
- Ensure Docker Desktop is running before proceeding
Navigate to the Source Directory
Navigate to the directory containing the docker-compose files:The
src directory contains:docker-compose.yml- Service definitionsdocker-compose.override.yml- Environment-specific configurations
Start the Application
Run the following command to start all microservices and databases:The
-d flag runs containers in detached mode (background).The initial startup may take 5-10 minutes as Docker downloads all required images and builds the application containers.
Verify Container Status
Check that all containers are running:You should see all services with status “Up”:
- catalogdb
- basketdb
- distributedcache
- orderdb
- messagebroker
- catalog.api
- basket.api
- discount.grpc
- ordering.api
- yarpapigateway
- shopping.web
Wait for Services to Initialize
Some microservices need additional time to initialize after containers start:
- Database migrations - The Ordering service runs Entity Framework migrations on startup
- RabbitMQ initialization - Message broker takes 30-60 seconds to be fully ready
- Service dependencies - Services wait for their dependencies to be healthy
If the application doesn’t work immediately, wait 2-3 minutes for all services to fully initialize, then refresh your browser.
Access the Application
Once all services are running, access the application:
HTTP: http://localhost:6005
Shopping Web UI
The main user interface for the e-commerce application:HTTPS: https://localhost:6065HTTP: http://localhost:6005
Service Endpoints
Infrastructure Services
Test the Application
Test the complete workflow:
- Navigate to https://localhost:6065
- Browse the product catalog
- Add items to your shopping basket
- Proceed to checkout
- Monitor the order processing:
- View RabbitMQ dashboard at http://localhost:15672
- Check the
BasketCheckoutEventmessage queue - Verify the Ordering service consumes the message
The application demonstrates asynchronous communication: when you checkout, the Basket service publishes an event to RabbitMQ, which the Ordering service consumes to create the order.
Stopping the Application
To stop all services:Troubleshooting
Containers Keep Restarting
Check the logs for the specific service:- Database connection errors - Wait for database containers to fully initialize
- Port conflicts - Another service may be using the required ports
- Memory issues - Increase Docker Desktop memory allocation
Application Not Loading
- Verify all containers are running:
docker-compose ps - Check service health endpoints
- Wait 2-3 minutes for full initialization
- Clear browser cache and try again
Port Already in Use
If you see “port already in use” errors:docker-compose.override.yml.
Cannot Connect to Database
Ensure database containers are healthy:Next Steps
Architecture Overview
Learn about the microservices architecture and design patterns
Catalog Service
Explore the product catalog microservice with Vertical Slice Architecture
API Gateway
Learn about YARP reverse proxy and API gateway patterns
Docker Deployment
Deploy with Docker Compose and container orchestration
Visual Studio Alternative
If you prefer using Visual Studio:- Open the solution file in Visual Studio 2022
- Set
docker-composeas the startup project - Press F5 to run with debugging
