New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrating with Spring Cloud Config Server #501
Comments
The latter. You should implement the ConfigurationClient interface |
I will look into that. Thank you @graemerocher |
Started working on this: https://github.com/thiagolocatelli/micronaut-spring-client Still can't figure out why the method getPropertySources from SpringCloudConfigurationClient is not being invoked. I may be missing something. Decided to create the code in another repo and once it's stable and working 100% I will merge it into the oficial repo. |
with the help form @jameskleeh I identified the discovery-client library was missing. After adding it to the project, my SpringCloudConfigurationClient started being invoked. |
So the client for Spring Cloud config is working pretty well. I have just one question before I start writing the unit tests. The PropertySource.of method takes a priority. Which priority is loaded first: lowest or highest? Let's say I have a property "application.location" with priorities 10 and 20, which one will have the final value in the application context? |
@thiagolocatelli I believe the higher order will override config values with a lower order |
@jameskleeh sounds good James. That's how I implemented. Thank you. |
Progress: discovery client for spring cloud config server is working properly
|
@thiagolocatelli How are you ordering the property sources when both application and app specific config is specified for the environment? We should probably standardize and document what order the property sources should return in I think how it currently works for consul is:
|
I am currently ordering based on the response sent by the config server, which seems to the correct order to be used. The first one gets the highest priority and the subsequent ones get lowers priority. |
@thiagolocatelli In your logs there is no example with the application name and environment |
there is, in my example I am using -Dmicronaut.environments=dev,docker
|
@thiagolocatelli There isn't a property source for |
if I had included a file spring-config-sample-{env}.properties into my config server it would have been picked up by the client. My config server only contains application.properties, application-{env}.properties and spring-config-sample.properties. |
@thiagolocatelli Great! Have you verified that if that file were there it would be returned in the correct order? |
@jameskleeh working on that right now! will include the spring-config-sample-{env}.properties files there and see what comes up. |
@jameskleeh so I have included the following files to my config server:
the response back from the config server was:
so it seems to me that spring property source ordering is as follow, considering app name is 'foo' and environments are 'dev' and 'docker':
I am taking the environments names from |
@thiagolocatelli Seems like it is returning them in the correct order. I think it would be wise to ensure that the order is correct locally to be future proof of changes in spring cloud. It makes sense to me that the environment order should be a list and the order should be respected |
@jameskleeh I will open a separate issue on that and will do my best to send a PR with a fix. ok? |
@thiagolocatelli PRs welcome |
@graemerocher PR will be sent soon. First I need to setup micronaut-core on my local machine and move the client code to micronaut-core, right now its a library inside my project, its not inside micronaut yet. Second, I need to write unit tests for it and then I will be ready for the PR. Second phase would be include Vault as part of the process too, but I guess spring cloud config is a good beginning. Sorry for the delay. |
No worries, thanks for contributing! |
@graemerocher I have made the client available at https://github.com/thiagolocatelli/micronaut-spring-client I am still trying to figure out how I can use the SPRING_CLOUD_CONFIG_URI environment variable. The default scenario should be: first use the environment variable, if not available, then use spring.cloud.config.uri property, if that is also not available, default to http://localhost:8888 (default config server uri when deployed locally). Once I figure how to achieve this, I will merge that code into micronaut-core and send the PR. If you have any suggestion on how to achieve that, let me know. |
@thiagolocatelli A PR was just merged yesterday to allow backticks.
|
@jameskleeh per our discussion over Gitter, we found out that Micronaut wasnt evaluating the second element in the expression. It was returning a constant instead of trying to extract the value from the application context. ${SPRING_CLOUD_CONFIG_URI:spring.cloud.config.uri} returns 'spring.cloud.config.uri' instead of the value for it. I had opened an issue #516 but it was closed a couple of days ago. Even though I have spring.cloud.config.uri in the bootstrap.yml, micronaut is not evaluating it. In your example |
@thiagolocatelli That isn't true, only the last value is treated as a constant |
@jameskleeh ok, Thanks. I will wait for the next release with the PR sent to allow backticks to keep working on the config client. |
We have a SCCS running in house using ${GIT_URL} defined in the shell which SCCS seems to recognize from application.yml or a default. Would really like to see a MN profile for creating SCCS clients. Thanks. |
@graemerocher I'd like to take a crack at this and help you with this one, since we would like to have this feature so we can embed new MN services in our Spring Cloud ecosystem. The ability to use SCC for MN configuration would be very helpful to us. So, what's still open exactly, the ability to use SCC (a Client, I saw @thiagolocatelli did a lot of work already), or is creating a profile the only work left? |
We have made no progress on this issue. I don’t know what the state of @thiagolocatalli’s work is. Any help would be appreciated! |
@MichelSchudel Hey Michel, I have completed the code, its available in this repo: https://github.com/thiagolocatelli/micronaut-spring-client I just havent had the chance to merge my changes back into the official repo, you can give it a try. It has been working for us. |
Sure, I will take a look and give it a try.
…On Sat, Nov 10, 2018, 17:08 Thiago Locatelli ***@***.*** wrote:
@MichelSchudel <https://github.com/MichelSchudel> Hey Michel, I have
completed the code, its available in this repo:
https://github.com/thiagolocatelli/micronaut-spring-client
I just havent had the chance to merge my changes back into the official
repo, you can give it a try. It has been working for us.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#501 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFxMefWA4EN3R7ugzm0BoAnj1jBN_ZQbks5utvn3gaJpZM4WBqZi>
.
|
Great work! Thanks for this integration with spring cloud config server looking forward to utilize it. |
Working on it, having some issues getting all unit tests to run from
micronaut-core master branch. Some AWS / EC2 tests in discovery client fail.
…On Fri, Nov 16, 2018 at 2:57 AM mdkhwajams ***@***.***> wrote:
Great work! Thanks for this integration with spring cloud config server
looking forward to utilize it.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#501 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFxMeYN3EQ0kQ_wC_quSomqsQaW6Ni_5ks5uvhuDgaJpZM4WBqZi>
.
--
--------------------------------
Michel Schudel
email: michel.schudel@gmail.com
website: www.michelschudel.nl
twitter: http://twitter.com/MichelSchudel
facebook: http://www.facebook.com/michel.schudel
-------------------------------
|
@MichelSchudel Did you get any lucky integrating with the micronaut-core project? |
Working on getting all existing micronaut-core unit tests to run on windows
10... but your solution is fine. I just added some integration tests to
test your solution. Still have to integrate it with micronaut-core through
pull request, though.
…On Thu, Nov 29, 2018, 00:35 Thiago Locatelli ***@***.*** wrote:
@MichelSchudel <https://github.com/MichelSchudel> Did you get any lucky
integrating with the micronaut-core project?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#501 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFxMedAW01LJLjT7U45kqHyzkf6rNS0Mks5uzx3DgaJpZM4WBqZi>
.
|
Awesome! Thank you |
@MichelSchudel maybe you want to send the PR anyway and we can clean it up if necessary |
@graemerocher is there any way I can send you a private message? Twitter would be preferrable (follow me) |
@MichelSchudel were you able to send the PR? If not, I will work on sending the PR by Friday. |
Hi @thiagolocatelli, Due to a tragic familiy event I have been unable to cast your code into the micronaut-core java and test package structures. So, you still have to do that. Sorry but I have no time for that right now. So if you do, please use my changes, and make a pull request, by all means. |
@MichelSchudel sorry to hear about the family event. I will take care now and send @graemerocher a PR into their repo. I will be adding the code to their discovery module. Thank you for the changes you made. |
You're welcome, thank you for the apprecation. The integration test is a
Java test, I don't know if it should be a groovy test, since most micronaut
core tests are. See what you can use, glad to have helped.
…On Wed, Dec 26, 2018, 15:17 Thiago Locatelli ***@***.*** wrote:
@MichelSchudel <https://github.com/MichelSchudel> sorry to hear about the
family event. I will take care now and send @graemerocher
<https://github.com/graemerocher> a PR into their repo. I will be adding
the code to their discovery module.
Thank you for the changes you made.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#501 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFxMeRUwNVwm5VEhkg6zD0OkjpPKOfF8ks5u84TygaJpZM4WBqZi>
.
|
@graemerocher PR sent |
👌
…On Thu, Jan 3, 2019, 15:45 Graeme Rocher ***@***.*** wrote:
Closed #501
<#501>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#501 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFxMeWWervfet27JmqtDdcFwOXCZiQgAks5u_heNgaJpZM4WBqZi>
.
|
I want to migrate some of the applications I have written with Spring Boot but I would like to keep using the config servers I have. Looking at the documentation, I found this: "Alternatively one can register a PropertySourceLoader by creating a META-INF/services/io.micronaut.context.env.PropertySourceLoader containing a reference to the class name of the PropertySourceLoader".
I am creating my own spring config server client for Micronaut to read the properties from the config server, should I just go with my own implementation of PropertySourceLoader or should I follow the same approach used for Eureka and Consul in the discovery-client module?
The text was updated successfully, but these errors were encountered: