The SGIVU Config Repository is a Spring Cloud Config-based infrastructure project that centralizes configuration management for all SGIVU microservices across different environments.
Prerequisites
Before setting up the Config Server, ensure you have the following installed:Java 17+
Required for running Spring Boot applications
Docker & Docker Compose
For containerized deployment of services
Git
To clone and version the configuration repository
PostgreSQL
Database for microservices (Auth, User, Client, etc.)
Installation Steps
Clone the Config Repository
Clone this repository to your local machine:This repository contains all YAML configuration files organized by service and environment:
{service}.yml- Base configuration{service}-dev.yml- Development overrides{service}-prod.yml- Production overrides
Set Up Required Environment Variables
The configuration files use environment variable placeholders that must be resolved. Create a
.env file with the following variables:Configure the Spring Cloud Config Server
The Config Server (typically
sgivu-config) must be configured to use this repository as its configuration source.In the Config Server’s application.yml, add:application.yml
For Docker deployments, use the Git URI approach. For local development, you can use
native profile with a file path.Start the Config Server
Start the Spring Cloud Config Server using Docker Compose:Or run it locally with Maven/Gradle:The Config Server will start on port
8888 by default.Verify Configuration Endpoints
Test that the Config Server is serving configurations correctly:You should see JSON output with resolved configuration properties. The response will include:
name- Service nameprofiles- Active profilespropertySources- Merged configuration from base + profile-specific files
Configure Microservices to Use Config Server
Each microservice needs to be configured to fetch its configuration from the Config Server.Add to each service’s
bootstrap.yml or application.yml:bootstrap.yml
The
spring.application.name must match the base name of the configuration file (e.g., sgivu-auth matches sgivu-auth.yml and sgivu-auth-dev.yml).Configuration File Structure
The repository follows Spring Cloud Config naming conventions:Spring Cloud Config merges configurations in order: base file → profile-specific file. Profile-specific values override base values.
Key Configuration Patterns
Environment Variable Placeholders
All sensitive data uses Spring’s property placeholder syntax:${VAR_NAME:default_value} or ${VAR_NAME} (fails if not set)
Service Discovery Integration
All services register with Eureka:Management Endpoints
Development profiles expose all actuator endpoints for debugging:Security Best Practices
Troubleshooting
Config Server Not Starting
- Verify Git repository path or URL is correct
- Check network connectivity if using remote Git
- Ensure required environment variables are set
- Check logs:
docker logs sgivu-config
Services Can’t Connect to Config Server
- Verify Config Server is running:
curl http://localhost:8888/actuator/health - Check
spring.cloud.config.uriin service configuration - Ensure network connectivity (Docker network for containers)
- Check service name matches configuration file name
Configuration Not Updating
- Verify changes are committed and pushed (for Git backend)
- Check Config Server logs for refresh events
- Services may need restart or
/actuator/refreshcall - See Local Development for hot-reload setup
Next Steps
Local Development
Set up your local development environment with hot configuration reload
Configuration Reference
Explore detailed configuration options for each service