Skip to content

ExhibitFlow/config-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Config Server

Centralized Configuration Management Server for ExhibitFlow Microservices Architecture.

Overview

The Config Server provides centralized configuration management for all microservices in the ExhibitFlow ecosystem. It uses Spring Cloud Config Server to externalize configuration and supports dynamic configuration refresh via Kafka events.

Features

  • Centralized Configuration: Single source of truth for all microservice configurations
  • Dynamic Refresh: Configuration changes can be applied without restarting services
  • Git Backend: Stores configurations in Git for version control and audit trail
  • Service Discovery: Registers with Eureka for service discovery
  • Kafka Integration: Publishes config refresh events to notify services of changes

Architecture Integration

+----------------+    
| Config Server  | <--- Git/DB (central config)
+-------+--------+
        |
        | Publish refresh event
        v
+----------------+     Kafka Topic     +----------------+
| Microservice A | <------------------ | Microservice B |
+----------------+                    +----------------+

Configuration

Port

  • Default Port: 8888

Eureka Integration

  • Registers with Eureka at http://localhost:8761/eureka/
  • Service name: config-server

Git Repository

  • Default URI: https://github.com/ExhibitFlow/config-repo
  • Branch: main
  • Search paths: {application} directory per service

Kafka Topics

  • Config Refresh Events: config-refresh-events

API Endpoints

Configuration Management

Refresh Single Service Config

POST /config/refresh/{serviceName}
Content-Type: application/json

[
  "database.url",
  "api.timeout"
]

Refresh All Services

POST /config/refresh-all

Health Check

GET /config/health

Spring Cloud Config Endpoints

Get Configuration for Service

GET /{application}/{profile}
GET /{application}/{profile}/{label}

Example:

GET /api-gateway/default
GET /stall-service/production/main

Configuration Repository Structure

config-repo/
├── api-gateway/
│   ├── application.properties
│   ├── application-dev.properties
│   └── application-prod.properties
├── identity-service/
│   ├── application.properties
│   └── application-prod.properties
├── stall-service/
│   ├── application.properties
│   └── application-prod.properties
├── reservation-service/
│   └── application.properties
└── notification-service/
    └── application.properties

Running the Config Server

Prerequisites

  • Java 17+
  • Maven 3.8+
  • Kafka running on localhost:9092
  • Eureka Server running on localhost:8761

Start the Server

# Using Maven
mvn spring-boot:run

# Using compiled JAR
mvn clean package
java -jar target/config-server-0.0.1-SNAPSHOT.jar

Client Configuration

Microservices that want to use the Config Server should add these dependencies:

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-bus-kafka</artifactId>
</dependency>

And configure in application.properties:

spring.cloud.config.uri=http://localhost:8888
spring.cloud.config.fail-fast=true
spring.cloud.config.retry.max-attempts=3

# Kafka for config refresh
spring.kafka.bootstrap-servers=localhost:9092

Dynamic Configuration Refresh

When configuration changes are pushed to the Git repository:

  1. Config Server detects the changes
  2. Publishes a refresh event to Kafka topic config-refresh-events
  3. Microservices listening to this topic reload their configuration
  4. No service restart required

Actuator Endpoints

# View current environment properties
GET /actuator/env

# View configuration properties
GET /actuator/configprops

# Manually refresh configuration
POST /actuator/refresh

# Health check
GET /actuator/health

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published