Spaces:
Sleeping
Sleeping
File size: 4,834 Bytes
1c8e50c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# Eureka Server Configuration
A Spring Boot microservice that acts as a service registry for the Task Management System. This Eureka Server provides service discovery capabilities for all microservices in the system.
## Features
- **Service Registration and Discovery**: Allows microservices to register themselves and discover other services
- **Health Monitoring**: Monitors the health of registered services
- **Load Balancing Support**: Provides client-side load balancing information
- **Circuit Breaker Integration**: Works with Hystrix for fault tolerance
- **Distributed Tracing**: Integrated with Zipkin for request tracing
- **Actuator Endpoints**: Comprehensive monitoring and management endpoints
## Prerequisites
- Java 17 or higher
- Gradle 8.5 or higher
- Docker (for containerized deployment)
## Configuration
### Local Development
The application uses `application.properties` for local development configuration:
- Server runs on port 8085
- Eureka dashboard available at http://localhost:8085
### Docker Deployment
The application uses `application-docker.properties` for Docker deployment:
- Configured for container networking
- Zipkin integration with container service names
## Building the Application
```bash
# Build with Gradle
./gradlew build
# Build Docker image
docker build -t eureka-server:1.0.0 .
```
## Running the Application
### Local Development
```bash
# Run with Gradle
./gradlew bootRun
# Run JAR file
java -jar build/libs/eureka-server.jar
```
### Docker
```bash
# Run Docker container
docker run -p 8085:8085 eureka-server:1.0.0
```
## Endpoints
### Eureka Dashboard
- **URL**: http://localhost:8085
- **Description**: Web UI for viewing registered services
### Actuator Endpoints
- **Health**: http://localhost:8085/actuator/health
- **Info**: http://localhost:8085/actuator/info
- **Metrics**: http://localhost:8085/actuator/metrics
- **All Endpoints**: http://localhost:8085/actuator
### API Endpoints
- **Info**: http://localhost:8085/info
- **Home**: http://localhost:8085/
## Health Checks
The application includes comprehensive health checks:
- Custom Eureka health indicator
- Actuator health endpoints
- Docker health checks
- Liveness and readiness probes
## Monitoring
### Metrics
- Micrometer metrics integration
- Prometheus metrics endpoint
- JVM and system metrics
### Logging
- Structured JSON logging (in Docker)
- Log rotation and retention
- Configurable log levels
### Tracing
- Zipkin distributed tracing
- Request correlation IDs
- Performance monitoring
## Configuration Properties
| Property | Description | Default |
|----------|-------------|---------|
| `server.port` | Server port | 8085 |
| `eureka.server.enable-self-preservation` | Enable self-preservation mode | true |
| `eureka.server.renewal-percent-threshold` | Renewal threshold percentage | 0.85 |
| `eureka.server.eviction-interval-timer-in-ms` | Eviction interval | 30000 |
## Security
- Runs as non-root user in Docker
- Health checks for container orchestration
- Actuator endpoints secured appropriately
- Network security through container networking
## Performance Tuning
- Optimized JVM settings for containers
- Response cache configuration
- Renewal and eviction timers optimized
- G1 garbage collector for better performance
## Troubleshooting
### Common Issues
1. **Service not registering**
- Check network connectivity
- Verify service configuration
- Check Eureka client configuration
2. **High CPU usage**
- Check eviction interval settings
- Monitor garbage collection
- Review renewal threshold
3. **Memory issues**
- Adjust JVM heap settings
- Monitor registered services count
- Check for memory leaks
### Logs Location
- Local: `logs/eureka-server.log`
- Docker: Container stdout/stderr
## Development
### Project Structure
```
src/
βββ main/
β βββ java/
β β βββ in/garvit/tasks/
β β βββ EurekaServerConfigurationApplication.java
β β βββ config/
β β β βββ EurekaServerConfig.java
β β βββ controller/
β β βββ EurekaHealthIndicator.java
β β βββ EurekaInfoController.java
β βββ resources/
β βββ application.properties
β βββ application-docker.properties
β βββ logback-spring.xml
β βββ META-INF/
β βββ additional-spring-configuration-metadata.json
βββ test/
βββ java/
```
### Building and Testing
```bash
# Run tests
./gradlew test
# Build application
./gradlew build
# Check dependencies
./gradlew dependencies
```
## License
This project is part of the Task Management System microservices architecture.
## Author
**garvitpathak27** - Initial work and maintenance |