diff --git a/kernel/kernel-config-server/README.md b/kernel/kernel-config-server/README.md index f2ff0838f0a..3cf11fb8891 100644 --- a/kernel/kernel-config-server/README.md +++ b/kernel/kernel-config-server/README.md @@ -24,34 +24,51 @@ For more information look [here]( https://cloud.spring.io/spring-cloud-config/si **How To Run**
To run the application:
-Make sure you have configured ssh keys to connect to git, because it will take ssh keys from default location (${user.home}/.ssh) . +Make sure you have configured ssh keys to connect to git, because it will take ssh keys from default location (${user.home}/.ssh) . +Set environment variables to support git repos for composite profile. Here 0,1 indicates list items. +If any property exists in multiple repositories then repo at 0 index will have high priority and value will be referred from that repo. +``` +export SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_URI= +export SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_TYPE=git +export SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_DEFAULT_LABEL= + +export SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_1_URI= +export SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_1_TYPE=git +export SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_1_DEFAULT_LABEL= +``` Now run the jar using the following command:

-`java -jar -Dspring.cloud.config.server.git.uri=< git-repo-ssh-url > -Dspring.cloud.config.server.git.search-paths=< config-folder-location-in-git-repo > -Dencrypt.keyStore.location=file:///< file-location-of-keystore > -Dencrypt.keyStore.password=< keystore-passowrd > -Dencrypt.keyStore.alias=< keystore-alias > -Dencrypt.keyStore.secret=< keystore-secret > < jar-name >` +`java -jar -Dencrypt.keyStore.location=file:///< file-location-of-keystore > -Dencrypt.keyStore.password=< keystore-passowrd > -Dencrypt.keyStore.alias=< keystore-alias > -Dencrypt.keyStore.secret=< keystore-secret > < jar-name >`

-To run it inside Docker container provide the follwing run time arguments: -1. git_url_env +To run it inside Docker container provide the following run time arguments: +1. SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_URI The URL of your Git repo -2. git_config_folder_env +2. SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_TYPE +Repo type, which is git + +3. SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_DEFAULT_LABEL +branch to refer in git repo. If not provided, it will default to `main` branch + +4. SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_SEARCH_PATHS The folder inside your git repo which contains the configuration -3. encrypt_keyStore_location_env +5. encrypt_keyStore_location_env The encrypt keystore location -4. encrypt_keyStore_password_env +6. encrypt_keyStore_password_env The encryption keystore password -5. encrypt_keyStore_alias_env +7. encrypt_keyStore_alias_env The encryption keystore alias -6. encrypt_keyStore_secret_env +8. encrypt_keyStore_secret_env The encryption keyStore secret The final docker run command should look like: -`docker run --name= -d -v /server.keystore:/server.keystore:z -v /home/madmin/:/.ssh:z -e git_url_env= -e git_config_folder_env= -e encrypt_keyStore_location_env=file:////server.keystore -e encrypt_keyStore_password_env= -e encrypt_keyStore_alias_env= -e encrypt_keyStore_secret_env= -p 51000:51000 ` +`docker run --name= -d -v /server.keystore:/server.keystore:z -v /home/madmin/:/.ssh:z -e SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_URI= -e SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_TYPE=git -e SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_DEFAULT_LABEL= -e encrypt_keyStore_location_env=file:////server.keystore -e encrypt_keyStore_password_env= -e encrypt_keyStore_alias_env= -e encrypt_keyStore_secret_env= -p 51000:51000 `

**To Encrypt any property:**
@@ -86,11 +103,7 @@ server.servlet.path=/config #Path inside the GIT repo where config files are stored, in our case they are inside config directory #spring.cloud.config.server.git.search-paths= -# Uncomment spring.profiles.active and spring.cloud.config.server.native.search-locations for # connecting to local file system for configuration. -################################################################# -# spring.profiles.active=native - -# spring.cloud.config.server.native.search-locations=file:/// +spring.profiles.active=composite #Server would return a HTTP 404 status, if the application is not found.By default, this flag is set to true. spring.cloud.config.server.accept-empty=false @@ -148,7 +161,7 @@ spring.cloud.config.uri=http://: spring.cloud.config.label= spring.application.name= spring.cloud.config.name= -spring.profiles.active= +spring.profiles.active=composite management.endpoints.web.exposure.include=refresh #management.security.enabled=false diff --git a/kernel/kernel-config-server/src/main/resources/bootstrap.properties b/kernel/kernel-config-server/src/main/resources/bootstrap.properties index 088020c6c6f..62ddc9b00bf 100644 --- a/kernel/kernel-config-server/src/main/resources/bootstrap.properties +++ b/kernel/kernel-config-server/src/main/resources/bootstrap.properties @@ -22,11 +22,9 @@ server.servlet.context-path=${server.servlet.path} #Path inside the GIT repo where config files are stored, in our case they are inside config directory #spring.cloud.config.server.git.search-paths= -# Uncomment spring.profiles.active and spring.cloud.config.server.native.search-locations for # connecting to local file system for configuration. -################################################################# -#spring.profiles.active=native - -#spring.cloud.config.server.native.search-locations=file:/// +#support for composite property. +#use env variables to provide list of repos. +spring.profiles.active=composite #Server would return a HTTP 404 status, if the application is not found.By default, this flag is set to true. spring.cloud.config.server.accept-empty=false