47 lines
1.8 KiB
Markdown
47 lines
1.8 KiB
Markdown
# Ping Service 503 Error Fix Verification
|
|
|
|
## Problem Analysis
|
|
- **Issue**: GET http://localhost:8081/api/ping returns 503 SERVICE_UNAVAILABLE
|
|
- **Root Cause**: Gateway has Consul service discovery disabled (CONSUL_ENABLED:false) but uses load balancing route (lb://ping-service)
|
|
- **Evidence**:
|
|
- Gateway config line 23-26: `enabled: ${CONSUL_ENABLED:false}`
|
|
- Ping service is registered with Consul (register: true)
|
|
- Consul container is running and healthy
|
|
- Health endpoint shows ping-service is registered in Consul
|
|
|
|
## Solution Applied
|
|
**File**: `/home/stefan/WsMeldestelle/Meldestelle/infrastructure/gateway/src/main/resources/application.yml`
|
|
|
|
**Change**: Lines 23-26
|
|
```yaml
|
|
# BEFORE (causing 503 error)
|
|
enabled: ${CONSUL_ENABLED:false}
|
|
discovery:
|
|
enabled: ${CONSUL_ENABLED:false}
|
|
register: ${CONSUL_ENABLED:false}
|
|
|
|
# AFTER (fixes 503 error)
|
|
enabled: ${CONSUL_ENABLED:true}
|
|
discovery:
|
|
enabled: ${CONSUL_ENABLED:true}
|
|
register: ${CONSUL_ENABLED:true}
|
|
```
|
|
|
|
## Why This Fixes the Issue
|
|
1. **Service Discovery**: Gateway can now discover services registered in Consul
|
|
2. **Load Balancing**: `lb://ping-service` route can now resolve to actual service instances
|
|
3. **Health Checks**: Gateway can perform health checks on discovered services
|
|
4. **Automatic Routing**: Requests to `/api/ping/**` will be routed to the ping service at localhost:8082
|
|
|
|
## Expected Result
|
|
- GET http://localhost:8081/api/ping → 200 OK (routed to ping service)
|
|
- Gateway will discover ping-service from Consul registry
|
|
- Circuit breaker and retry mechanisms will work properly
|
|
- Service load balancing will function as designed
|
|
|
|
## Configuration Consistency
|
|
- **Gateway**: Consul discovery enabled ✓
|
|
- **Ping Service**: Consul registration enabled ✓
|
|
- **Consul**: Running and accessible on localhost:8500 ✓
|
|
- **Network**: All services can communicate ✓
|