Dependencies and version: ——————————————- Spring boot : 2.5.0 Spring cloud function : 3.1.3 Spring cloud config server: 3.0.4 Aws-Java-ask-s3 : 1.11.1019 Spring cloud starter bootstrap: 3.0.3
bootstrap.yml ————————- spring: application: name: Demo profiles: active: dev cloud: config: profile: awss3 server: awss3: region: us-east-1 bucket: sample-bucket
Aws s3: ————— Bucket : sample-bucket App folder under bucket: Demo Properties file under app folder : application-dev.properties
Deployed in to lambda function and specified the spring_cloud_function_definition: fetch spring_profiles_active: dev
Code: ————- Added @EnableConfigServer in DemoApplication.Java (spring boot application)
Scenario-1: Did lambda test with above configuration : reading from the application.properties not from the application-dev.properties Seems it s not connected to aws S3. Even I didn’t see any bootstrap logs also.
scenario-2: removed spring_profiles_active: dev in the lambda environment Even it’s not working
scenario -3: keep bootstrap.yml properties into application.yml and ran the lambda test Same situation as in scenario-1
I tried lot of ways still not working .. please help me on this.
Note: looking for @refrsh scope also
Comment From: ryanjbaxter
Can you provide a complete, minimal, verifiable sample that reproduces the problem? It should be available as a GitHub (or similar) project or attached to this issue as a zip file.
Comment From: jaganm2018
Sure I will do it. Let me prepare and share to you.
Comment From: jaganm2018
Hi Ryanjbaxter, Please see git repo URl: https://github.com/jaganm2018/spring-cloud-function-aws
Please see below points: 1) This is spring cloud function with config-server (pointed to AWS S3 Bucket) and deployed into AWS lambda function. 2) Below specified are the lambda env variables spring_cloud_function_definition: fetch spring_profiles_active: dev 3) My AWS S3 Bucket and folder structure. sample-config (bucket name: specified in the bootstrap.yml) | | DemoApp (Application Folder Name: specified in the appication.properties) | | application-dev.properties
Issue 1: Ran the application : it's always retrieve local application properties value instead of retrieve from config-server O/P: local expected value: dev
Issue-2: How to specified the search-patterns like {application}-{profile}.properties or application -> profile -> application.properties
Issue-3: @RefreshScope will work awss3 bucket.
Appreciate for your help and thanks in advance. Waiting for your response.
Comment From: ryanjbaxter
Couple of things just looking at the POM:
- There is not yet a Spring Cloud release that is compatible with Boot 2.5.0, you will need to use Boot 2.4.x.
- Please use the Spring Cloud BOM and do not specify the versions yourself.
Also I don't understand you use case, why are you starting a Config Server in a function?
Comment From: ryanjbaxter
You also said it doesn't work after upgrading, what versions are you upgrading from?
Comment From: jaganm2018
why are you starting a Config Server in a function? I’m implementing for aws lambda function so I chooses spring function along with spring boot. Vault integration is working but config-server I’m facing issue.
Another one for ec2 deploy also.
Earlier we used the spring boot 2.3.8 release version and pointed to git repo. Now I’m moving latest and aws-s3.
Thanks for replying & let me check and get back to you.
Comment From: jaganm2018
Hi, Updated with spring boot 2.4.3 version and as per your suggestion. https://github.com/jaganm2018/spring-cloud-function-aws
but in your comment , I didn’t understand about spring cloud BOM? What’s that ?
If you are using git profile, you need to set a git URI in your configuration. If you are using a native profile and have spring.cloud.config.server.bootstrap =true, you need to use a composite configuration.
but configuration property is not showing as a property.
Comment From: ryanjbaxter
See the maven and gradle examples here https://spring.io/projects/spring-cloud#overview
Comment From: jaganm2018
Already gone through those document and but no useful. Is it ok can you please involve @spencergibb in this conversation.. because I saw same error in another issue : 1635. But they are using 2.3.x spring boot. He helped to them last time.. might be he can us to fix this issue.
Comment From: ryanjbaxter
Issue 1: Ran the application : it's always retrieve local application properties value instead of retrieve from config-server O/P: local expected value: dev
This is why I am confused by your sample. Its just a config server, so its not fetching config from itself. Where is the config client application?
Comment From: jaganm2018
let me explain you ... normally application environment (dev,test,prod) properties are keeping in to either git repo /aws s3. My application is deploying into aws so I created my config properties in the aws s3 bucket. I’m reading those application properties from the s3 bucket based on profile. Please see below my s3 folder structure.
- My AWS S3 Bucket and folder structure. sample-config (bucket name: specified in the bootstrap.yml) | | DemoApp (Application Folder Name: specified in the appication.properties) | | application-dev.properties
Sorry for confuse you. Hope now you got clear. For your reference : https://github.com/spring-cloud/spring-cloud-config/issues/1635
Note: suppose if not specified profile or failed to read properties from config server (aws s3 bucket) then it will fetch from application.properties. This application.properties file is with in the application. You can refer in the my sample project .
Comment From: jaganm2018
Any updates?
Comment From: ryanjbaxter
Your sample does not compile
Comment From: jaganm2018
Can you please check now? Seems import has issue with caps letter. Fixed. Thanks for relying.
Comment From: ryanjbaxter
Your configuration is not correct as you need to use a composite when spring.cloud.config.server.bootstrap=true You can try this
spring:
profiles:
active: dev,composite
cloud:
config:
server:
composite:
- type: aws
region: us-east-1
bucket: sample-config
bootstrap: true
Comment From: jaganm2018
Thanks for checking but as per the new upgrade, spring.cloud.config.server.composite property is not available. It’s saying unknown property.
Comment From: spencergibb
What an ide says and what actually works are two different things
Comment From: jaganm2018
IDE saying , “Unknown property’spring.cloud.config.server.composite’.
If I deploy my repository code, it’s not showing any error and not reading from aws-s3 bucket.
Comment From: ryanjbaxter
Did you deploy with the configuration I suggested?
Comment From: jaganm2018
Not yet.. let me try now .. give me few mins please
Comment From: jaganm2018
I ran with what you provided one.. after I deployed in to aws , got error as below.
{ “ErrorMessage”: “error creating bean with name ‘defaultEnvironmentRepository’ defined in the class path resource [org/springframework/cloud/config/server/config/DefaultRepositoryConfiguration.class]: Invocation of unit method failed; nested exception is Java.Lang.IllegalStateException: you need to configure a uri for the git repository”, “ErrorType”: “org.springframework.beans.factory.BeanCreationException” }
Comment From: jaganm2018
Please let me know if you need any more information. Actually 2.4.x spring boot version and spring cloud 2020.0.2. You can see my sample application in above comment section.
Thanks in advance
Comment From: spencergibb
@jaganm2018 please update your repo with the updated configuration you tried.
Comment From: jaganm2018
@spencergibb updates with new configuration what @ryanjbaxter provided. Here in IDE , it’s showing “Unknown property’spring.cloud.config.server.composite’”.
Please see below updated git repo https://github.com/jaganm2018/spring-cloud-function-aws
Comment From: jaganm2018
Any updates?
Comment From: spencergibb
After removing spring cloud function, the thin launcher, and the maven shade plugin and moving DemoApplication out of the default package and renaming Java to java (in other words, making a minimal project), I can not recreate the error
Comment From: jaganm2018
Can you please suggest me one thing .. Do you have any sample on config-server with aws s3 with latest version?
why it’s showing unknown property of spring.cloud.config.server.composite . Is this property deprecated or still available in latest version?
mean while let me update it that git repo.
Comment From: spencergibb
The property not being recognized by the ide has ZERO bearing on it actually working which I have verified thru the debugger. See https://github.com/spring-cloud/spring-cloud-config/issues/1909 to add the metadata. This project worked for me https://github.com/jaganm2018/spring-cloud-function-aws/pull/1
Comment From: jaganm2018
Is it working? Did you tested in aws -s3 side? Please let me know. If yes then I will test in aws side. Thanks.
Comment From: jaganm2018
Please let me know the current solution/fix for this?
Comment From: spencergibb
I have nothing to add besides my pr
Comment From: jaganm2018
Let me update the git repo with spring boot configuration and will let you know. Thanks.
Comment From: jaganm2018
Hi, Thanks to all. It’s working ec2 but not in lambda.. seems some thing role access issue in aws. Let’s check it.
Before closing this .. I have 2 issues .. 1. I’m running locally , I’m getting git uri configuration even I disabled the spring.cloud.config.enabled is false also in bootstrap.yml. Even I tried spring.cloud.import .. seems some thing I’m missing. 2. Present its looking application-{profile}.yml/properties/Json. But I’m want to provide different search paths.
Can you please suggest me where I did mistake.
Once again thanks for helping.
Comment From: jaganm2018
Any suggestions?
Comment From: spencergibb
My pr worked locally. What is different?
Comment From: jaganm2018
Hi, Thanks to all. It’s working ec2 but not in lambda.. seems some thing role access issue in aws. Let’s check it.
Before closing this .. I have 2 issues ..
I’m running locally , I’m getting git uri configuration even I disabled the spring.cloud.config.enabled is false also in bootstrap.yml. Even I tried spring.cloud.import .. seems some thing I’m missing. Present its looking application-{profile}.yml/properties/Json. But I’m want to provide different search paths. Can you please suggest me where I did mistake.
Once again thanks for helping.
Comment From: jaganm2018
Any updates on above my question?
Comment From: spencergibb
are the two items listed new? I was able to get the app running locally (see my PR). Have you changed anything? If so push it to the example and describe how to recreate it.
Comment From: jaganm2018
I ran locally with composite and local properties then it trying to connect to aws s3 config server. I want to disabled the config-server by using spring.cloud.config.enabled=False. It’s not working. What I can do?
Comment From: ryanjbaxter
How are you setting spring.cloud.config.enabled=false
?
Comment From: jaganm2018
Setting this in boot strap yml file.
Comment From: ryanjbaxter
Can you try setting it in an environment variable?
Comment From: jaganm2018
It’s not working. I tried in the profile based application properties, it’s working fine. Another question is .. how to disabled spring.cloud.config.server.vault property. I didn’t see enabled: true/false option under that above property. Seems it’s trying to connect to vault server. How I can disabled.
Comment From: spencergibb
Please keep this to a single issue with s3. Is your example updated with the things you have tried? This conversation is so long and disjointed that it's hard to understand. Let us know when your project is able to replicate the latest problem.
Comment From: jaganm2018
Sure. Let me close this issue and create new one with sample. Thanks a lot.
Comment From: spencergibb
No just update the sample here
Comment From: spring-cloud-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: spring-cloud-issues
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.