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

9th
Jul 2018
Patrick Cornelißen
@pcornelissen
Jul 09 2018 06:16
Hi! I'm not sure if I had this problem prior to spring boot 2 + Finchley, but I can't override the server port when it is also set using a property from that is delivered from the configserver.

I'm using a command line in the docker container like this:

CMD LANG=DE.UTF-8 java -Djava.net.preferIPv4Stack=true  -Xmx256m -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:MaxRAMFraction=1  -Dfile.encoding=utf-8 -Dserver.port=$PORT -jar  service.jar --server.port=$PORT --spring.server.port=$PORT  --spring.profiles.active=$ENVIRONMENT,docker --spring.cloud.config.uri="http://admin:....@confighub:8888"

And I'm seeing in the actuator env endpoint that the system property, the commandline argument etc. have been detected as server.port with the correct value, but the server still starts with port 8080 which is defined in a application-docker.yaml that is delivered from the config server :-(

am I missing something that changed? is there a special setting that is now required to restore local overrideability?

        "spring.cloud.config.config.overrideSystemProperties": {
          "value": false
        },

is set in the application.yaml that is served by the config server, so all services should have that flag set to false. It's not defined anywhere else
(inspired by spring-cloud/spring-cloud-config#167)

salaboy
@salaboy
Jul 09 2018 07:29
@fiunchinho example fixed: https://github.com/Salaboy/spring-cloud-k8s-minion thanks for reporting.. it was a bug in the importing procedure of JX
that deleted those files inside the charts/ dir
I will add a secret now
@fiunchinho I will also test the separate entries.. instead of the entire file
Patrick Cornelißen
@pcornelissen
Jul 09 2018 07:40
spring-cloud/spring-cloud-config#1080 Bug + Showcase for the configuration override using system properties or command line parameters
Jose Armesto
@fiunchinho
Jul 09 2018 11:25
using the Spring cloud kubernetes integration, I'm getting some debug logs from the fabric8 k8s client that is not using my log format
10:11:37.425 [main] DEBUG io.fabric8.kubernetes.client.Config - Did not find Kubernetes config at: [/root/.kube/config]. Ignoring.
10:11:37.425 [main] DEBUG io.fabric8.kubernetes.client.Config - Trying to configure client from service account...
10:11:37.425 [main] DEBUG io.fabric8.kubernetes.client.Config - Found service account ca cert at: [/var/run/secrets/kubernetes.io/serviceaccount/ca.crt].
10:11:37.431 [main] DEBUG io.fabric8.kubernetes.client.Config - Found service account token at: [/var/run/secrets/kubernetes.io/serviceaccount/token].
10:11:37.431 [main] DEBUG io.fabric8.kubernetes.client.Config - Trying to configure client namespace from Kubernetes service account namespace path...
10:11:37.431 [main] DEBUG io.fabric8.kubernetes.client.Config - Found service account namespace at: [/var/run/secrets/kubernetes.io/serviceaccount/namespace].
{"date":"2018-07-09 10:11:40,049","priority":"INFO","pid":"1","thread":"main","logger":"org.springframework.context.annotation.AnnotationConfigApplicationContext","message":"Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@a22cb6a: startup date [Mon Jul 09 10:11:40 GMT 2018]; root of context hierarchy","stacktrace":""}
{"date":"2018-07-09 10:11:40,382","priority":"INFO","pid":"1","thread":"main","logger":"org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor","message":"JSR-330 'javax.inject.Inject' annotation found and supported for autowiring","stacktrace":""}
is that the expected behavior? how can I make it log with the same format that the rest of the application is using?
I'm using logback
salaboy
@salaboy
Jul 09 2018 11:26
hmm are they usnig a different logging framework?
Jose Armesto
@fiunchinho
Jul 09 2018 11:27
it seems to be using SLF4J, like we do
Patrick Cornelißen
@pcornelissen
Jul 09 2018 11:52
Argh, forget my bugreport I had .config.config in the property key due to bad copy pasting X-)
CH4:D
@chad_d_stud_twitter
Jul 09 2018 12:55

i have this configured in my zuul route:

zuul.routes.service.path=/my/url/**
zuul.routes.service.url=http://xxxx.ngrok.io/
zuul.routes.service.strip-prefix=true

but my node service throws a 404 error because it can’t find /my/url

i tried strip-prefix to false as well
CH4:D
@chad_d_stud_twitter
Jul 09 2018 13:08
nevermind. i got it working
Roy Jacobs
@RoyJacobs
Jul 09 2018 13:30
hi, I'm trying to set up some spring-cloud properties in an EnvironmentPostProcessor, but I need some keys that come from an external property source. However, PropertySourceBootstrapConfiguration only calls 'locate' on these property sources after the EnvironmentPostProcessor runs in the non-bootstrap phase
I would expect the PropertySourceBootstrapConfiguration to run before any EnvironmentPostProcessors? (background: I'm trying to set spring.cloud.consul.discovery.acl-token and a bunch of other Consul properties based on data from the external source, but it's not a 1-to-1 mapping so I need to run some code to map the property names and so on)
Roy Jacobs
@RoyJacobs
Jul 09 2018 13:41
should I run my code in an ApplicationContextInitializer<ConfigurableApplicationContext> instead?
because that does work, ordering-wise. but I'm not sure if that's intended :)
Spencer Gibb
@spencergibb
Jul 09 2018 15:26
@RoyJacobs if it works, hard to complain. The other option might be another propertysourcelocator ordered before consul
Roy Jacobs
@RoyJacobs
Jul 09 2018 15:27
no I'm indeed fine with this approach, but I was just wondering why EnvironmentPostProcessors run before the bootstrap properties had a chance to load, in the child application context
Spencer Gibb
@spencergibb
Jul 09 2018 15:28
not sure I have an answer.
Roy Jacobs
@RoyJacobs
Jul 09 2018 15:28
that's ok :)