Usage:
cd config-server docker build -t config-server . Run
docker run --name="config-server" -p 7761:7761 config-server
Spring Cloud Config provides server and client modules for supporting externalized Configuration in a distributed system. With Config server, spring bootmicroservices configuration centralized across all environments.
The concept is similar to Environment, PropertySource in client applications. If the application moves from one profile to another profile, spring boot applications need not restarted, without downtime microservices will switch from one profile to another.
The default storage for these externalizes properties are git version system, as it supports branching, different properties for each configuration environment.
spring.cloud.config.server.git.uri is the property used to configure the git repository.
By default, spring config server will load properties from a master, but we can configure this using spring.cloud.config.server.git.default-label property.
We can also load profile specific properties using {application}-{profile}.properties(yml) file format. Suppose if a file named bookservice-default.properties file is present, then it will be loaded only if none of the profiles are configured, bookservice-dev.properties will load bookservice service only if he is running in dev as an active profile in bookservice application.
Spring config server also supports Vault storage, which is used to storage the secured properties, like passwords, and SSL certificates, etc.
spring:
profiles:
active: native
cloud:
config:
server:
native:
searchLocations: file:///path/to/local/git/repository
spring:
cloud:
config:
allowOverride: true
overrideNone: true
overrideSystemProperties: false
Clean and install the components configuration-client and configuration-server
cd configuration-client ./mvnw clean install cd .. And server
cd configuration-server ./mvnw clean install cd .. And start docker-compose
docker-compose up --build
mvn spring-boot:run -Dspring-boot.run.profiles=dev
CHERARA REDDAH.