4.9 KiB
4.9 KiB
Docker & Configuration Inconsistencies Analysis
Meldestelle Project - Optimization Report
🔍 IDENTIFIED INCONSISTENCIES
1. Docker Compose Network Configuration Issues
❌ Critical Issue: Network Declaration Mismatch
- Main File (
docker-compose.yml): Createsmeldestelle-networkas bridge driver - Services File (
docker-compose.services.yml): References network asexternal: true - Clients File (
docker-compose.clients.yml): References network asexternal: true - Impact: Services and clients compose files cannot work standalone - network dependency issue
❌ Healthcheck Interval Inconsistencies
- Infrastructure Services: 10s intervals (postgres, redis, consul, etc.)
- Application Services: 15s intervals (ping-service, members-service, etc.)
- Client Services: Mixed (web-app: 30s, auth-server: 15s, monitoring-server: 30s)
- Impact: Inconsistent monitoring behavior, potential delayed failure detection
2. API Gateway Port Configuration Issues
❌ Port Mapping Mismatch
- Dockerfile: Exposes port 8080 and healthcheck uses port 8080
- Docker-compose: Maps to port 8081 via
${GATEWAY_PORT:-8081} - Healthcheck in compose: Still checks port 8080 instead of configured port
- Impact: Healthchecks will fail, service appears unhealthy
3. Dockerfile Inconsistencies
❌ Base Image Versions
- Ping Service: Uses
gradle:8.14-jdk21-alpineandeclipse-temurin:21-jre-alpine - API Gateway: Uses
eclipse-temurin:21-jdk-alpine(no version specified) - Impact: Potential version drift, inconsistent runtime behavior
❌ User Creation Patterns
- Ping Service: Structured approach with build args (APP_USER, APP_UID, etc.)
- API Gateway: Hardcoded user creation (
adduser -D -u 1001 -G gateway gateway) - Impact: Inconsistent security patterns, harder maintenance
❌ JVM Configuration Differences
- Ping Service: Modern Java 21 optimizations (
MaxRAMPercentage=80.0,UseG1GC, etc.) - API Gateway: Older pattern (
-Xmx512m -Xms256m,MaxRAMPercentage=75.0) - Impact: Suboptimal performance, inconsistent memory management
❌ Health Check Configuration
- Ping Service:
--interval=15s --timeout=3s --start-period=40s --retries=3 - API Gateway:
--interval=30s --timeout=10s --start-period=60s --retries=3 - Impact: Inconsistent failure detection timing
4. Environment Variable Inconsistencies
❌ Default Profile Handling
- Services: Use
${SPRING_PROFILES_ACTIVE:-dev}(dev default) - API Gateway Dockerfile: Hardcoded
SPRING_PROFILES_ACTIVE=prod - Impact: Environment-specific behavior not aligned
❌ Port Environment Variables
- Most Services: Consistent pattern
${SERVICE_NAME_PORT:-default} - Some Services: Missing environment variable fallbacks
- Impact: Reduced deployment flexibility
5. Service Dependencies Issues
❌ Circular Dependencies
- Services depend on
api-gatewaywith health condition - API Gateway depends on infrastructure services
- Impact: Potential startup race conditions
🛠️ RECOMMENDED FIXES
1. Network Configuration Fix
# In docker-compose.services.yml and docker-compose.clients.yml
networks:
meldestelle-network:
external: false # or remove external: true
2. API Gateway Port Fix
# In infrastructure/gateway/Dockerfile
ENV SERVER_PORT=${GATEWAY_PORT:-8081}
EXPOSE ${GATEWAY_PORT:-8081}
HEALTHCHECK CMD curl -f http://localhost:${GATEWAY_PORT:-8081}/actuator/health || exit 1
3. Standardize Health Check Intervals
# Recommended standard intervals:
# Infrastructure: interval=10s, timeout=5s, start-period=20s, retries=3
# Services: interval=15s, timeout=5s, start-period=30s, retries=3
# Clients: interval=30s, timeout=10s, start-period=60s, retries=3
4. Standardize Dockerfile Patterns
- Use consistent base image versions
- Standardize user creation with build args
- Align JVM configurations
- Use consistent health check patterns
5. Environment Variables Standardization
- Consistent default profiles across all services
- Standardize port variable patterns
- Add missing environment variable fallbacks
📊 IMPACT ASSESSMENT
High Priority (Critical)
- Network configuration (prevents services from starting)
- API Gateway port mismatch (health checks fail)
Medium Priority (Performance/Maintenance)
- JVM configuration inconsistencies
- Health check timing differences
- Dockerfile pattern standardization
Low Priority (Best Practices)
- Environment variable naming consistency
- Service dependency optimization
✅ NEXT STEPS
- Fix network configuration in services and clients compose files
- Correct API Gateway port configuration
- Standardize health check intervals
- Update Dockerfiles for consistency
- Test all services startup and health checks