spring-cloud / spring-cloud-config Goto Github PK
View Code? Open in Web Editor NEWExternal configuration (server and client) for Spring Cloud
License: Apache License 2.0
External configuration (server and client) for Spring Cloud
License: Apache License 2.0
It would be nice to be able to use the native
profile and be able to specify a configuration file that doesn't include other properties from the spring-cloud-config-server
's environment such as server.port
, admin path, etc. thus making it more "isolated". This would be similar to how JGitEnvironmentRepository
currently works with repo contained files. It would be very useful when first starting out with the cloud config project because it would enable a straightforward migration path to eventually using git
.
Perhaps this could be implemented as a new profile or repository type?
Current spring-cloud-config server doesn't work on windows environment.
I think on windows enviroment "file:/" prefix should added for git.getRepository().getDirectory().getParent();
In my bootstrap.yml I have:
spring:
application:
name: configserver
cloud:
config:
enabled: false
server:
git:
uri: file:///tmp/git
basedir: target/config
Create local repo:
$ cat appmaster.yml
bar: "mybar222"
$ git init
Initialised empty Git repository in /tmp/git/.git/
/tmp/git [master|…1]
14:28 $ git add appmaster.yml
/tmp/git [master|●1]
14:28 $ git commit -m "update1" -a
[master (root-commit) 988b57a] update1
1 file changed, 2 insertions(+)
create mode 100644 appmaster.yml
/tmp/git [master L|✔]
14:28 $ git log
commit 988b57a9e13fa13c9a3dc5756e19cfe9de9e0d5c
Author: Janne Valkealahti <[email protected]>
Date: Fri Jan 16 14:28:22 2015 +0000
update1
Check what config server gives:
$ curl http://localhost:8888/appmaster/default/master
{"name":"default","label":"","propertySources":[{"name":"file:///tmp/git/appmaster.yml","source":{"bar":"mybar222"}}]}
Looks ok, lets update appmaster.yml in git repo:
$ cat appmaster.yml
bar: "mybar333"
/tmp/git [master L|✚ 1]
$ git add appmaster.yml
/tmp/git [master L|●1]
$ git commit -m "update2" -a
[master acd9a46] update2
1 file changed, 1 insertion(+), 1 deletion(-)
/tmp/git [master L|✔]
$ git log
commit acd9a46785ad97b5dd3ea628b35d54c81bcef46c
Author: Janne Valkealahti <[email protected]>
Date: Fri Jan 16 14:35:39 2015 +0000
update2
commit 988b57a9e13fa13c9a3dc5756e19cfe9de9e0d5c
Author: Janne Valkealahti <[email protected]>
Date: Fri Jan 16 14:28:22 2015 +0000
update1
Check what config server gives after restart:
$ curl http://localhost:8888/appmaster/default/master
{"name":"default","label":"","propertySources":[{"name":"file:///tmp/git/appmaster.yml","source":{"bar":"mybar222"}}]}
Didn't update. lets check cloned repo:
$ cd target/config/
~/repos/work/yarn-cloud/target/config [master L|✔]
14:39 $ git log
commit 988b57a9e13fa13c9a3dc5756e19cfe9de9e0d5c
Author: Janne Valkealahti <[email protected]>
Date: Fri Jan 16 14:28:22 2015 +0000
update1
~/repos/work/yarn-cloud/target/config [master L|✔]
14:39 $ cat appmaster.yml
bar: "mybar222"
It looks like repo is cloned once and never updated.
It fails for me on building with this error
[ERROR] Failed to execute goal on project spring-cloud-config-client: Could not resolve dependencies for project org.springframework.cloud:spring-cloud-config-client:jar:1.0.0.BUILD-SNAPSHOT: Failure to find org.springframework.security:spring-security-rsa:jar:1.0.0.M2 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
I noticed that you are building with this dependency
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-rsa</artifactId>
<version>1.0.0.M2</version>
</dependency>
I can't find that in any of the repos and when I looked at its location in github https://github.com/dsyer/spring-security-rsa, ieee that it was rolled back to snapshot.
What am I missing?
In a context hierarchy there's no sense in all contexts loading the same properties (and the parent will always have the remote values since it has to be initialized before a child is added).
Instead of a single git repository, does Spring Cloud Config Server plan to support more than 1 git repository? If running Spring Cloud Config Server as a central config management server, it may have ownership concerns on having hundreds or thousands different application configurations in a single git repo.
There are a lot of nice things about the cloud-config-client that would be applicable to anything that does configuration using a remote property source.
It looks like it should be possible to create an implementation of the PropertySourceLocator
and with its .locate()
method have it return a remotely-retrieved PropertySource.
The more generic pieces like the:
would be usable for lots of different implementations - for instance, a zookeeper based config store could implement things using watches on specific znodes and have it trigger the Refresh automatically (and indeed, this is what I'd be primarily working with this for)
It would be very nice if this config stuff could be set up so that someone could start out using one kind of provider (like a git-based one, which would be simple to set up and suitable for a certain number of applications) and then swap it out later to a different style configuration (such as a zookeeper based one) and not have to make changes to their code.
I can't change the location of the bootstrap.properties file during startup with --spring.cloud.bootstrap.location=...
It looks like a copy/past error in line 95 of BootstrapApplicationListener?
Freshly cloned repo cannot be build:
$ mvn clean compile
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project org.springframework.cloud:spring-cloud-config:1.0.0.BUILD-SNAPSHOT (<path-to-repo>\spring-cloud-config\pom.xml) has 1 error
[ERROR] Non-resolvable parent POM: Could not find artifact org.springframework.cloud:spring-cloud-build:pom:1.0.0.BUILD-SNAPSHOT and 'parent.relativePath' points at no local POM @ line 11, column 10 -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
I am not sure the root cause is Spring Cloud Config, but since the @RefreshScope
and refresh functionality is part of Spring Cloud Config, I thought I would start here. And perhaps this is expected behavior, but it was a surprise to me.
I basically followed the Spring Cloud Config tutorial here but was including the @Configuration
annotation via the new @SpringBootApplication
annotation. I was able to reproduce the issue by only adding a @Configuration
annotation to the client's ClientApp class of the tutorial. GitHub for the tutorial is available here.
Working Client
@EnableAutoConfiguration
@ComponentScan
@RestController
@RefreshScope
public class ClientApp {
@Value("${bar:World!}")
String bar;
@RequestMapping("/")
String hello() {
return "Hello " + bar + "!";
}
public static void main(String[] args) {
SpringApplication.run(ClientApp.class, args);
}
}
Not working client
@Configuration // **This is the only thing different!**
@EnableAutoConfiguration
@ComponentScan
@RestController
@RefreshScope
public class ClientApp {
@Value("${bar:World!}")
String bar;
@RequestMapping("/")
String hello() {
return "Hello " + bar + "!";
}
public static void main(String[] args) {
SpringApplication.run(ClientApp.class, args);
}
}
Error
The following error is thrown after trying to access http://localhost:8080 following a refresh.
2014-11-25 00:03:56.487 ERROR 9868 --- [nio-8080-exec-7] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.clientApp': Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: demo.ClientApp.setBeanFactory(Lorg/springframework/beans/factory/BeanFactory;)V] with root cause
java.lang.NoSuchMethodError: demo.ClientApp.setBeanFactory(Lorg/springframework/beans/factory/BeanFactory;)V
at demo.ClientApp$$EnhancerBySpringCGLIB$$9e153ad7.setBeanFactory(<generated>)
at org.springframework.context.annotation.ConfigurationClassPostProcessor$EnhancedConfigurationBeanPostProcessor.postProcessPropertyValues(ConfigurationClassPostProcessor.java:448)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1185)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$2.getObject(AbstractBeanFactory.java:341)
at org.springframework.cloud.context.scope.GenericScope$BeanLifecycleWrapper.getBean(GenericScope.java:447)
at org.springframework.cloud.context.scope.GenericScope.get(GenericScope.java:181)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:336)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:35)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.getTarget(CglibAopProxy.java:676)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:627)
at demo.ClientApp$$EnhancerBySpringCGLIB$$316d9b47.hello(<generated>)
...
Question
Is this expected behavior? This also happens with Spring Boot 1.2.0.RC2's new @SpringBootApplication
annotation that includes the @Configuration
annotation, which is how I originally ran into this issue. I suppose there is no need to annotate this class with the @Configuration
annotation since it is not actually configuring anything, but that is often a default annotation that people put on their main Application class, as I believe is evidenced by the creation of the @SpringBootApplication
annotation. I also suppose in an app with more substance, the Controller and/or beans containing @Value
annotations would likely be separated out from the main class. Still, perhaps this is something to make more clear or fix.
When the ContextIdApplicationContextInitializer
is run for the main context, it does not contain bootstrap
yet, therefor it defaults the name to 'application' unless spring.application.name
is also set in application.yml
. Context Id is used in the bus for uniqueness.
Hello,
When a change is pulled from the remote git repository do all services with the changed configuration get the changes automatically? Or do we need to call the /refresh or /restart endpoints on those services?
I made a change to the repository and the changes didn't get pulled until the next call for a configuration was made. That is fine, but when that happens do all other services get their configuration updated automatically? If not that is fine as well, we need to call the endpoints to have configuration updated - which works really well for rolling updates. If it does update services automatically, how can we disable that so that we can do rolling updates? Please let me know if you have any questions for me, thanks for the great work!
Broken tests including randomizedCipher(), formDataIn(), decryptEnvironment(), sunnyDaySymmetricKey(), sunnyDayRsaKey()
@Test
public void sunnyDayRsaKey() {
controller.setEncryptor(new RsaSecretEncryptor());
String cipher = controller.encrypt("foo", MediaType.TEXT_PLAIN);
assertEquals("foo", controller.decrypt(cipher, MediaType.TEXT_PLAIN));
}
breaks in encryptor.encrypt(data);
Produces:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000052454979, pid=6304, tid=6840
#
# JRE version: Java(TM) SE Runtime Environment (7.0_67-b01) (build 1.7.0_67-b01)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.65-b04 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# V [jvm.dll+0x54979]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
#
....
When running the config server using version 7 of the JRE, I received the following error.
java.lang.NoSuchMethodError: java.util.concurrent.ConcurrentHashMap.keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView;
at org.springframework.cloud.config.server.EncryptionController.decrypt(EncryptionController.java:215)
at org.springframework.cloud.config.server.EnvironmentController.labelled(EnvironmentController.java:55)
at org.springframework.cloud.config.server.EnvironmentController.labelledYaml(EnvironmentController.java:109)
...
The line in question is:
ConcurrentHashMap<Object, Object> map = new ConcurrentHashMap<Object, Object>(source.getSource());
for (Object key : map.keySet()) { // **exception thrown here**
String name = key.toString();
I'm guessing this is related to the Build-Jdk for the package being 1.8.0 and this Java compatability issue.
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.cloud.config.client.ConfigClientProperties org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.configClientProperties; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.cloud.config.client.ConfigClientProperties] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:558)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
... 29 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.cloud.config.client.ConfigClientProperties] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1308)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1054)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:949)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:530)
... 31 more
if spring.cloud.config.enabled:false
, PropertySourceBootstrapConfiguration
still tries to inject ConfigClientProperties
With changes b0c3642 (main function removed) and fdb6d0e (Application renamed) it's impossible to start server by mvn spring-boot:run
:
Error: Could not find or load main class org.springframework.cloud.config.server.Application
or using spring-cloud-config-server-1.0.0.M1-exec.jar
from milestone repo:
$ java -jar ./spring-cloud-config-server-1.0.0.M1-exec.jar
java.lang.ClassNotFoundException: org.springframework.cloud.config.server.Application
which stays in contradiction with all the documentation.
Right now it doesn't seem possible to share common configuration across applications. This might be a typical use case for certain types of configurations such as shared resources and system wide conventions. Perhaps it would be possible to add something conventional like a bootstrap.yml
file for this purpose. Some ideas for naming here:
defaults.yml
base.yml
common.yml
shared.yml
application.yml
This could also support the label variants as well (e.g. application-development.yml
, application-production.yml
, etc.) The last one is particularly interesting because it is already a convention for Spring Boot. It seems to make sense in a system context as well.
Open to suggestions, but this is something that seems general enough to warrant some sort of support.
After cloning the repo, run the mvn clean install and got the following error:
org.junit.ComparisonFailure: expected:<...classes/config-repo/[]bar.properties> but was:<...classes/config-repo/[file:/private/var/folders/9k/2k7ntkvj14ncy7dg5nf42hj00000gn/T/config-repo-5075686710249411088/]bar.properties>
Adding repository.setBasedir(basedir); as the first line in the test makes it pass.
It would be much easier to interact with github, bitbucket, etc. if OAuth was supported. In this way, users could generate a personal application token instead of having to specify their own credentials. This would allow revoking of tokens independent of their account credentials, etc.
This will make it more embeddable (in an application that itself wants to share the global configuration for example).
Please externalize the default git label (branch) on config-server.
Decryption done in EnvironmentDecryptApplicationListener
is performed before properties
added with @PropertSource
are added and therefore they are not decrypted.
A test reproducing the issue was pushed in #29.
What would high availability look like for the config server?
Consul is a cluster. Cassandra is highly available.
In aws would you run one per availability zone?
Just wanting to start a conversation, I know it doesn't need to be done for spring one.
In my opinion it would be better to throw exception in EnvironmentDecryptApplicationListener
on decryption error rather than just clear property value. As a developer/devops I would like to get error immediately (context initialization failed, application is not available - red error in the monitoring system) rather than get an error a few hours/days later when the first database query is made or the first message is sent to the queue.
If you see practical use cases for just logging that error and clearing the value maybe it could be configurable, but IMHO by default it should fail immediately.
Might just be a eureka server problem (need to investigate).
username/password has the drawback that they a tied to a human or a technical user.
There is also the possibility to access the repository not only with username/password but also with ssh keys.
Does spring-cloud-config support ssh keys?
In general the config server needs a separate clone, or a lock for each unique checkout. The checkout is unique per requested label, so the locking needs to be at least as granular as that. Actually it might even be worth sticking with one clone and locking the write operation for a different label than the current checkout. If all concurrent requests are for "master" for example, they can all make progress together from the same clone.
If the source location of configuration data is not configured, config server defaults to using the github URI of a demo repo: https://github.com/spring-cloud/spring-cloud-config/blob/master/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/JGitEnvironmentRepository.java#L62.
If a location source is not specified via one of the acceptable config options (e.g. spring.cloud.config.server.locations
, spring.cloud.config.server.git.uri
) then the config server should treat that as an error and make the error obvious to the user (possibly failing to start the app?).
The config-server is not ment to bootstrap itself by fetching the configuration from localhost:8888. This makes sense because the server in question is being started. So for this reason I wanted to disable the bootstrap process for the config-server.
public static void main(String[] args) throws IOException {
System.setProperty("spring.cloud.bootstrap.enabled","false")
run(Application.class, args)
}
The error I get is this:
Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.cloud.config.client.RefreshEndpoint] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:561)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
... 16 common frames omitted
E.g. spring.cloud.config.server.prefix
(default empty).
See #1
After changes from the Simplify README generator commit the travis build stopped working.
It seems that preinstalled asciidoctor gem is missing.
mvn --settings .settings.xml install -P docs -q -U -DskipTests=true -Dmaven.test.redirectTestOutputToFile=true
Oct 14, 2014 4:13:31 PM org.apache.maven.wagon.providers.http.httpclient.client.protocol.ResponseProcessCookies processCookies
WARNING: Cookie rejected: "[version: 0][name: rememberMe][value: deleteMe][domain: repository.jboss.org][path: /nexus][expiry: Tue Oct 14 16:13:31 UTC 2014]". Illegal path attribute "/nexus". Path of origin: "/maven2/org/jboss/weld/weld-parent/6/weld-parent-6.pom"
Oct 14, 2014 4:13:31 PM org.apache.maven.wagon.providers.http.httpclient.client.protocol.ResponseProcessCookies processCookies
WARNING: Cookie rejected: "[version: 0][name: rememberMe][value: deleteMe][domain: repository.jboss.org][path: /nexus][expiry: Tue Oct 14 16:13:31 UTC 2014]". Illegal path attribute "/nexus". Path of origin: "/maven2/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.pom"
Oct 14, 2014 4:13:32 PM org.apache.maven.wagon.providers.http.httpclient.client.protocol.ResponseProcessCookies processCookies
WARNING: Cookie rejected: "[version: 0][name: rememberMe][value: deleteMe][domain: repository.jboss.org][path: /nexus][expiry: Tue Oct 14 16:13:32 UTC 2014]". Illegal path attribute "/nexus". Path of origin: "/maven2/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.pom.sha1"
Oct 14, 2014 4:13:32 PM org.apache.maven.wagon.providers.http.httpclient.client.protocol.ResponseProcessCookies processCookies
WARNING: Cookie rejected: "[version: 0][name: rememberMe][value: deleteMe][domain: repository.jboss.org][path: /nexus][expiry: Tue Oct 14 16:13:32 UTC 2014]". Illegal path attribute "/nexus". Path of origin: "/maven2/javax/inject/javax.inject/1/javax.inject-1.pom"
Oct 14, 2014 4:13:44 PM org.apache.maven.wagon.providers.http.httpclient.client.protocol.ResponseProcessCookies processCookies
WARNING: Cookie rejected: "[version: 0][name: rememberMe][value: deleteMe][domain: repository.jboss.org][path: /nexus][expiry: Tue Oct 14 16:13:44 UTC 2014]". Illegal path attribute "/nexus". Path of origin: "/maven2/javax/inject/javax.inject/1/javax.inject-1.jar"
Oct 14, 2014 4:13:44 PM org.apache.maven.wagon.providers.http.httpclient.client.protocol.ResponseProcessCookies processCookies
WARNING: Cookie rejected: "[version: 0][name: rememberMe][value: deleteMe][domain: repository.jboss.org][path: /nexus][expiry: Tue Oct 14 16:13:44 UTC 2014]". Illegal path attribute "/nexus". Path of origin: "/maven2/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar"
Oct 14, 2014 4:13:45 PM org.apache.maven.wagon.providers.http.httpclient.client.protocol.ResponseProcessCookies processCookies
WARNING: Cookie rejected: "[version: 0][name: rememberMe][value: deleteMe][domain: repository.jboss.org][path: /nexus][expiry: Tue Oct 14 16:13:45 UTC 2014]". Illegal path attribute "/nexus". Path of origin: "/maven2/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar.sha1"
LoadError: no such file to load -- asciidoctor
require at org/jruby/RubyKernel.java:1065
require at file:/home/travis/.m2/repository/org/jruby/jruby-complete/1.7.12/jruby-complete-1.7.12.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55
(root) at /home/travis/build/spring-cloud/spring-cloud-config/docs/src/main/ruby/generate_readme.sh:5
Permissions.java:196:in `checkExit': org.apache.tools.ant.ExitException: Permission ("java.lang.RuntimePermission" "exitVM") was not granted.
from Runtime.java:107:in `exit'
from System.java:962:in `exit'
from Main.java:199:in `main'
from NativeMethodAccessorImpl.java:-2:in `invoke0'
from NativeMethodAccessorImpl.java:57:in `invoke'
from DelegatingMethodAccessorImpl.java:43:in `invoke'
from Method.java:606:in `invoke'
from ExecuteJava.java:217:in `run'
from ExecuteJava.java:152:in `execute'
from Java.java:771:in `run'
from Java.java:221:in `executeJava'
from Java.java:135:in `executeJava'
from Java.java:108:in `execute'
from UnknownElement.java:291:in `execute'
from NativeMethodAccessorImpl.java:-2:in `invoke0'
from NativeMethodAccessorImpl.java:57:in `invoke'
from DelegatingMethodAccessorImpl.java:43:in `invoke'
from Method.java:606:in `invoke'
from DispatchUtils.java:106:in `execute'
from Task.java:348:in `perform'
from Target.java:390:in `execute'
from Target.java:411:in `performTasks'
from Project.java:1399:in `executeSortedTargets'
from Project.java:1368:in `executeTarget'
from AntRunMojo.java:327:in `execute'
from DefaultBuildPluginManager.java:132:in `executeMojo'
from MojoExecutor.java:208:in `execute'
from MojoExecutor.java:153:in `execute'
from MojoExecutor.java:145:in `execute'
from LifecycleModuleBuilder.java:116:in `buildProject'
from LifecycleModuleBuilder.java:80:in `buildProject'
from SingleThreadedBuilder.java:51:in `build'
from LifecycleStarter.java:120:in `execute'
from DefaultMaven.java:347:in `doExecute'
from DefaultMaven.java:154:in `execute'
from MavenCli.java:582:in `execute'
from MavenCli.java:214:in `doMain'
from MavenCli.java:158:in `main'
from NativeMethodAccessorImpl.java:-2:in `invoke0'
from NativeMethodAccessorImpl.java:57:in `invoke'
from DelegatingMethodAccessorImpl.java:43:in `invoke'
from Method.java:606:in `invoke'
from Launcher.java:289:in `launchEnhanced'
from Launcher.java:229:in `launch'
from Launcher.java:415:in `mainWithExitCode'
from Launcher.java:356:in `main'
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (readme) on project spring-cloud-config-docs: An Ant BuildException has occured: Java returned: 1
[ERROR] around Ant part ...<java classname="org.jruby.Main" failonerror="yes">... @ 4:54 in /home/travis/build/spring-cloud/spring-cloud-config/docs/target/antrun/build-main.xml
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :spring-cloud-config-docs
travis_time:end:244795a4:start=1413303152337661355,finish=1413303257234615401,duration=104896954046
�[0K
�[31;1mThe command "mvn --settings .settings.xml install -P docs -q -U -DskipTests=true -Dmaven.test.redirectTestOutputToFile=true" failed and exited with 1 during .�[0m
Your build has been stopped.
$ spring run app.groovy -- --spring.main.webEnvironment=false --debug
output clearly shows that the Environment
is a servlet one (even though the ApplicationContext
is not).
If you create a new branch and push it to the remote, and then try and load it fro ma running config server it barfs with "no reference". Git on the command line seems to work.
JGitEnvironmentRepositoryTests failing;
root cause: org.eclipse.jgit.api.errors.JGitInternalException: Object c4bd92016dc14b9fe376d9c3f7af1c9d22d44ee4 is corrupt: bad stream
java.lang.IllegalStateException: Cannot load environment
at org.springframework.cloud.config.server.JGitEnvironmentRepository.findOne(JGitEnvironmentRepository.java:161)
at org.springframework.cloud.config.server.JGitEnvironmentRepositoryTests.nested(JGitEnvironmentRepositoryTests.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.eclipse.jgit.api.errors.JGitInternalException: Object c4bd92016dc14b9fe376d9c3f7af1c9d22d44ee4 is corrupt: bad stream
at org.eclipse.jgit.api.CheckoutCommand.call(CheckoutCommand.java:294)
at org.springframework.cloud.config.server.JGitEnvironmentRepository.checkout(JGitEnvironmentRepository.java:208)
at org.springframework.cloud.config.server.JGitEnvironmentRepository.loadEnvironment(JGitEnvironmentRepository.java:179)
at org.springframework.cloud.config.server.JGitEnvironmentRepository.findOne(JGitEnvironmentRepository.java:155)
... 25 more
Caused by: org.eclipse.jgit.errors.CorruptObjectException: Object c4bd92016dc14b9fe376d9c3f7af1c9d22d44ee4 is corrupt: bad stream
at org.eclipse.jgit.storage.file.UnpackedObject.open(UnpackedObject.java:189)
at org.eclipse.jgit.storage.file.ObjectDirectory.openObject2(ObjectDirectory.java:537)
at org.eclipse.jgit.storage.file.FileObjectDatabase.openObjectImpl2(FileObjectDatabase.java:198)
at org.eclipse.jgit.storage.file.FileObjectDatabase.openObject(FileObjectDatabase.java:163)
at org.eclipse.jgit.storage.file.WindowCursor.open(WindowCursor.java:123)
at org.eclipse.jgit.lib.ObjectReader.open(ObjectReader.java:229)
at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:817)
at org.eclipse.jgit.revwalk.RevWalk.parseCommit(RevWalk.java:730)
at org.eclipse.jgit.api.CheckoutCommand.call(CheckoutCommand.java:229)
... 28 more
Just starting to play with this a little bit. I had a question in the documentation it says
$ curl localhost:8080/env
{
"profiles":[],
"configService:https://github.com/scratches/config-repo/bar.properties":{"foo":"bar"},
"servletContextInitParams":{},
"systemProperties":{...},
...
}
This for me gets a whitelabel error page on the sample project. /env/foo works as does /foo/env. Is this a typo in the docs or a problem with the code?
In its current form, Spring Cloud Config is only good for software projects starting now using Spring Boot that anticipate scaling up in the future. Existing Spring webapps that do not use Spring Boot (even those on Spring 4...) can't make use of Spring Cloud Config at all -- at least, not according to existing documentation.
Spring Boot and Spring Cloud Config seem aimed at two totally-disjoint user bases: Spring Boot is aimed at getting a small app up and running quickly, and allowing developers to build out enterprise-grade control later as they move further out and away from Boot's "automagic"; Spring Cloud Config is aimed at managing multiple large multi-environment enterprise-grade applications.
For anecdotal evidence: I work at a company looking to scale up our existing Spring 4 webapp (assembled without Boot), and would like to be able to use Spring Cloud Config for managing per-environment configuration of our app. But since Spring Boot is a prerequisite for Spring Cloud Config, the benefits of Cloud Config are unavailable to us unless we tear out all of our existing Spring context setup and hoping Boot "automagically" picks the right results in every case.
When running ApplicationTests
individually from your IDE, the test fails because JGitEnvironmentRepository#copyFromLocalRepository
does not recognize the path 'file:./target/test-classes/config-repo' as a file. This is primarily due to the IDE working directory when running tests defaults to the parent project. We can easily change the working directory in our Run configuration, but I thought if there was a better way to initialize the spring.cloud.config.server.git.uri
property in the test it might make for smoother testing.
java.lang.IllegalArgumentException: Source File must denote a directory or file
at org.springframework.util.Assert.isTrue(Assert.java:65)
at org.springframework.util.FileSystemUtils.copyRecursively(FileSystemUtils.java:61)
at org.springframework.cloud.config.server.JGitEnvironmentRepository.copyFromLocalRepository(JGitEnvironmentRepository.java:264)
at org.springframework.cloud.config.server.JGitEnvironmentRepository.copyRepository(JGitEnvironmentRepository.java:249)
at org.springframework.cloud.config.server.JGitEnvironmentRepository.createGitClient(JGitEnvironmentRepository.java:241)
In case one have 15-20 services, git repo for configuration service will end-up with 45-60 files all in root directory. It make sense to provide some simple convention for organizing files in folder per application. For example: if the configuration file is now {app}-{env}.yaml it may be expected in folder /{app}
Hello
this might be a bit off topic as it is only directed to a cloud config client.
We have a zone where all microservices have one and the same profile (prod/te/dev) currently we start each microservice with spring.profiles.active and the url to the config server.
IMHO providing the spring.profiles.active for each microservice is redundant as it can be also retrieved from the config-server. So I would like to start only the config-server in the zone with an active profile such as (prod/te/dev) and this should be propagated to the config clients.
Regarding an implementation.
For the sake of clarity: by default the app should start irrespective, but if the flag is set and config server is unavailable, refuse to start.
(Fail /refresh as well, but not fatal for the app in that case.)
It's not clear how one would protect the config server and ensure only authorized clients can access the configuration information contained therein. It would be nice to define the security model or future intentions in this regard.
POST /env can be missing because of startup order: sometimes the EnvironmentEndpoint
bean is not created in time, so we need an additional @AutoConfigureAfter
.
I am trying to integrate spring cloud config into our docker micro-service architecture.
Currently spring-cloud-config propagates a client service architecture.
[GitRepp] <---accessedBy--- [Config Server] <---accessedBy--- [Config Client 1..N]
In our case the Config Server is just a main method with all the overhead of (git, gradle, jenkins, docker, versioning, jira, testcases and many more) This is quite a lot for an Application having "only" an empty main method.
While rethinking all this, the only USP that counts for us is the ability to pull the config from a git repository. So suddenly the question popped up, why do we need a Client Server setup at all?
Why don't the clients get their configuration directly from git?. This setup would have many advantages compared to the config server. (always running, failsafe, known address)
Could you explain why this is a good or bad idea, what features could the config server offer more then just to get the config from a repository?
I was wondering, if there is a possibility to configure the priority of the added "bootstrap"-proprtySource on client side. currently, it has highest priority, even higher than system-environment or startup-parameters. I would have thought that it should be after jvm parameters, just like normal application.properties. I actually reorder this propertySource via applicationInitializer. Is there a way to make this more easily configurable or even default?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.