These are chat archives for spring-cloud/spring-cloud

29th
Feb 2016
Fabian Wallwitz
@cforce
Feb 29 2016 07:31
(how) can i use the same configuration (without doubling) in different microservices using spring cloud config
Dave Syer
@dsyer
Feb 29 2016 07:32
Use the search path in the config server?
I guess if you explain what you mean by "different" I might be able to suggest an implementation
You need to be able to identify the config groups in the server (obviously)
So you need to use some kind of naming convention over app names or profiles to identify the groups
It's super easy to share global defaults among all apps (I guess you knew that, so I'm guessing you want to be more fine-grained, but haven't really explained how).
Fabian Wallwitz
@cforce
Feb 29 2016 23:15
no, as you already supposed, i want to share a "group of configurations files between some group of microservices"..
i undertstood serach paths as feature for scanning for files (with proper naming bound to <application name>-<profile name>) in deeper folder srcuture
Spencer Gibb
@spencergibb
Feb 29 2016 23:16
that would be how spring profiles works with configuration: application-<springprofile>.{yml|properties} and <springappname>-<springprofile>.{yml|properties}
Fabian Wallwitz
@cforce
Feb 29 2016 23:18
i want to have ONE file in cfg server beeing mapped to 5 microservices e.g ..without the need to copy the file 5 times with differenbt name per application
Spencer Gibb
@spencergibb
Feb 29 2016 23:18
profiles
Fabian Wallwitz
@cforce
Feb 29 2016 23:18
if that is somehow possible .. i didn't undertstood it so far from doc
Spencer Gibb
@spencergibb
Feb 29 2016 23:18
application-my5apps.yml
and set my5apps as one of the apps spring profiles.
Fabian Wallwitz
@cforce
Feb 29 2016 23:19
and that would need in this 5 apps to activate the profile "my5apps" ?
Spencer Gibb
@spencergibb
Feb 29 2016 23:19
yes
Fabian Wallwitz
@cforce
Feb 29 2016 23:20
ok .. so "application" in cfg name is wildcard for all apps ..
the filter then is on profile only .. which is explicit to be selected
Spencer Gibb
@spencergibb
Feb 29 2016 23:21
application applies to all apps
Fabian Wallwitz
@cforce
Feb 29 2016 23:22
tx - one more ;) i am also trying to serve some "properitary cfg files" via the config server..that shall be only classic per application
Spencer Gibb
@spencergibb
Feb 29 2016 23:23
I don’t understand what "shall be only classic per application” means.
Fabian Wallwitz
@cforce
Feb 29 2016 23:23
means the file can be assigned only one app
i read a section describing "plain text files" in cfg server.. but the doc/ example does not make it clear for me
how to name this file and how to retrieve in in the application
Fabian Wallwitz
@cforce
Feb 29 2016 23:25
exactly
Spencer Gibb
@spencergibb
Feb 29 2016 23:26
Server provides these through an additional endpoint at /{name}/{profile}/{label}/{path} where "name", "profile" and "label" have the same meaning as the regular environment endpoint, but "path" is a file name (e.g. log.xml)
Fabian Wallwitz
@cforce
Feb 29 2016 23:26
the examle drsibed the cfg server git repo as /nginx.conf
but how can anyone guess from that which application/profile the file shall be published on /foo/default/master/nginx.conf
Spencer Gibb
@spencergibb
Feb 29 2016 23:27
/{name}/{profile}/{label}/{path}
Fabian Wallwitz
@cforce
Feb 29 2016 23:27
master come from git and nginx.conf is the path=filename
Spencer Gibb
@spencergibb
Feb 29 2016 23:27
foo is spring app name, default is the profile
Fabian Wallwitz
@cforce
Feb 29 2016 23:27
why is name=foo and profile=default .. where is it guessed from?
Spencer Gibb
@spencergibb
Feb 29 2016 23:28
it’s an example
default is the profile spring sets when no other profile is set
Fabian Wallwitz
@cforce
Feb 29 2016 23:29
ok .. but still the app name .where is it guessed from in the cfg server ?
there is only /nginx.conf
why does the cfg server publishes this under foo?
Spencer Gibb
@spencergibb
Feb 29 2016 23:30
It’s an example of a name of an app
the client sets spring.application.name.
I don’t understand "where is it guessed from in the cfg server”.
Fabian Wallwitz
@cforce
Feb 29 2016 23:31
but the clients queries on start the cfg server for its config files.. and the server "normally" can select the worng files because the file names include the app name (or it is valid for any of application*.yml)
/nginx.conf - thre is no app name there
Spencer Gibb
@spencergibb
Feb 29 2016 23:33
the first three are used to load config so the plain text file can do placeholder substitution like the docs say.
Fabian Wallwitz
@cforce
Feb 29 2016 23:36
-- do you hear me thinking ..i must be on the wrong lane..
how would the git repo layout of the cfg srv be in this example .. it can't just be /nginx.conf ? --- or will nginx.conf be available on all applications /*/default/master/ngnix.conf replaced with its individal placeholder's from active profiles?
Fabian Wallwitz
@cforce
Feb 29 2016 23:43
so ngnix.conf is not dedicated published for exactly one microservice config ressource
Spencer Gibb
@spencergibb
Feb 29 2016 23:43
No, files aren’t limited per application
Fabian Wallwitz
@cforce
Feb 29 2016 23:43
ahh!
thats not my use case
Spencer Gibb
@spencergibb
Feb 29 2016 23:44
There is NO SECURITY in config server at all. All files are available to all clients, they just have to send the right name.
Fabian Wallwitz
@cforce
Feb 29 2016 23:44
security is not my concern..
Spencer Gibb
@spencergibb
Feb 29 2016 23:45
then as long as the filepath is unique, what does it matter?
Fabian Wallwitz
@cforce
Feb 29 2016 23:46
i need to place an xml file .. in cfg server.. that a micorservics shall load as stream..
i think that is not supported imho
Spencer Gibb
@spencergibb
Feb 29 2016 23:47
sure it is
Fabian Wallwitz
@cforce
Feb 29 2016 23:48
thats great
so i place myXmlFile.xml in the root of the git repo of the cfg server..
how can i use it in my spring app?
if there is some documentation on that case, i would read that
Spencer Gibb
@spencergibb
Feb 29 2016 23:50
That part is all up to you, there is no client for text files.
Fabian Wallwitz
@cforce
Feb 29 2016 23:52
ok. Tht would load stream from url using vthe right cfg server urls cfgsrv:8888/foo/default/master/ myXmlFile.xml
Spencer Gibb
@spencergibb
Feb 29 2016 23:52
yes
Fabian Wallwitz
@cforce
Feb 29 2016 23:52
ok.. tx a lot for ur support
Spencer Gibb
@spencergibb
Feb 29 2016 23:53
np