Service Architecture Overview
Sistema de Ventas follows a microservices architecture with:
- 2 Infrastructure Services: Config Server, Eureka Registry
- 1 API Gateway: Spring Cloud Gateway
- 8 Business Services: Auth, Catalogo, Cliente, Venta, Compra, Pedidos, Pagos, Proveedor
Service Dependencies
Spring Boot Version Matrix
| Service | Spring Boot | Spring Cloud | Java | Database |
|---|---|---|---|---|
| Config Server | 3.5.0 | 2025.0.0-RC1 | 17 | - |
| Registry Server | 3.5.0 | 2025.0.0-RC1 | 17 | - |
| Gateway Server | 3.3.3 | 2023.0.3 | 17 | - |
| Auth Service | 2.5.4 | 2020.0.3 | 17 | MySQL |
| Cliente Service | 3.1.3 | 2022.0.2 | 17 | PostgreSQL |
| Catalogo Service | 3.1.3 | 2022.0.2 | 17 | MySQL |
| Venta Service | 3.1.3 | 2022.0.2 | 17 | MySQL |
| Compra Service | 3.1.3 | 2022.0.2 | 17 | MySQL |
| Pedidos Service | 3.1.3 | 2022.0.2 | 17 | MySQL |
| Pagos Service | 3.1.3 | 2022.0.2 | 17 | MySQL |
| Proveedor Service | 3.1.3 | 2022.0.2 | 17 | MySQL |
Prerequisites
Before starting, ensure:
- Prerequisites installed
- Databases configured
- Ports available: 7070, 8085, 8090
Clone Repository
Infrastructure Services
Step 1: Start Config Server
The Config Server must start first as it provides configuration to all other services.Review Configuration
The Config Server is configured to read from GitHub:
config-server/src/main/resources/application.yml
Keep this terminal open. Config Server must run continuously.
Step 2: Start Eureka Registry Server
Verify Registry Server
Open browser: http://localhost:8090You should see the Eureka Dashboard.
Keep this terminal open. All microservices register with Eureka.
Step 3: Start API Gateway
Review Gateway Configuration
The gateway routes all requests to microservices:
config-data/jea-gateway-service.yml
Business Microservices
Step 4: Start Auth Service
The Auth service handles user authentication and JWT token generation.Run Auth Service
- Connect to Config Server
- Register with Eureka
- Create database tables automatically
- Start on a dynamic port
Verify Auth Service
Check Eureka Dashboard at http://localhost:8090jea-auth-service should appear in registered instances.
Step 5: Start Remaining Business Services
Start each service in a new terminal:- Catalogo Service
- Cliente Service
- Venta Service
- Compra Service
- Pedidos Service
- Pagos Service
- Proveedor Service
- Database:
catalogo-ms(MySQL) - Dynamic port allocation
- Swagger UI:
/doc/swagger-ui.html
Startup Order Summary
Infrastructure Layer
- Config Server (port 7070) - Wait 30 seconds
- Eureka Registry (port 8090) - Wait 30 seconds
- API Gateway (port 8085) - Wait 20 seconds
Verify Complete Deployment
Check Eureka Dashboard
Visit: http://localhost:8090 You should see all services registered:Expected Registered Services
Expected Registered Services
JEA-GATEWAY-SERVICEJEA-AUTH-SERVICEJEA-CATALOGO-SERVICEJEA-CLIENTE-SERVICEJEA-VENTA-SERVICEJEA-COMPRA-SERVICEJEA-PEDIDO-SERVICEJEA-PAGOS-SERVICEJEA-PROVEEDOR-SERVICE
Test Gateway Routes
Service Configuration Details
Database Connections
Eureka Client Configuration
All services connect to Eureka:Circuit Breaker Configuration
Venta, Compra, and Pedidos services use Resilience4j:Troubleshooting
Service won't start - Config Server connection failed
Service won't start - Config Server connection failed
Issue:
Could not locate PropertySource errorSolutions:- Ensure Config Server is running on port 7070
- Check
bootstrap.ymlhas correct config server URL: - Verify config-data folder exists in GitHub repo
Service not registering with Eureka
Service not registering with Eureka
Issue: Service doesn’t appear in Eureka dashboardSolutions:
- Check Eureka is running: http://localhost:8090
- Verify
application.ymlhas eureka client config - Check logs for connection errors
- Wait 30-60 seconds for registration
Database connection failed
Database connection failed
Issue:
Communications link failure or Access deniedSolutions:- Verify database exists:
SHOW DATABASES; - Check username/password in service config
- Ensure MySQL/PostgreSQL is running
- Test connection:
mysql -u root -p
Port already in use
Port already in use
Issue:
Port 8085 is already in useSolutions:Maven build fails
Maven build fails
Issue: Dependencies not resolvingSolutions:
Production Deployment
Build Production JARs
Environment Variables
Use environment variables for production:Automated Startup Script
Createstart-all.sh:
start-all.sh
Next Steps
Frontend Setup
Configure and run Angular frontend
Docker Deployment
Deploy using Docker containers