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

15th
Jul 2016
Fabian Wallwitz
@cforce
Jul 15 2016 10:36
what is the best practice to load plain text files from ressource spring cloud config, where the "reload" shall only happen if the spring cloud config (no matter if its served from local or remote repo managed by bootstrapping) ressource file has changed?
Dave Syer
@dsyer
Jul 15 2016 10:37
There's actually no way to tell that an individual file has changed in general
You can get a generic notification that something changed in the app configuration (based on a naming convention IIRC).
The hooks that you get from github and other providers are not consistent in that way. So it's the best we can do, I think (but feel free to look into it if you think there might be a better way).
Dave Syer
@dsyer
Jul 15 2016 10:41
Indeed
Fabian Wallwitz
@cforce
Jul 15 2016 10:42
Just the question how to load the txt file in a transparent way from the cloud cfg endpoint is not clear to me .. shall i access the URL from localhost (so my own copy of the current cfg repo served by spring boot http endpoints?)
..or directly access the remote iurl of the cfg server..
for standard properties this is manged for me by spring cloud
This feature is extremely useful for e.g. template engines like thymeleaf or ealsticsearch query templates..
Dave Syer
@dsyer
Jul 15 2016 10:45
I'm not sure what you mean. Localhost isn't normally where you run the config server.
There's no local client that downloads files for you. You have to do that yourself.
Fabian Wallwitz
@cforce
Jul 15 2016 10:58
The spring cloud config client itself also published the properties bootstrapped from cfg server on its endpoints, so i though there is somehow a local copy.
I know there is one in the local git repo the cfg client clones from .. so i could access it on the file system.. which may be faster than having a remote lookup
with rest
can i access this local repo similar way via rest (on localhost) as i do for the remote server?
at the end every cfg client is somehow syncing the remote state of the cfg repo, deson't it?
Fabian Wallwitz
@cforce
Jul 15 2016 11:13
"If you want to read the configuration for an application directly from the backend repository (instead of from the config server) that’s basically an embedded config server with no endpoints. You can switch off the endpoints entirely if you don’t use the @EnableConfigServer annotation (just set spring.cloud.config.server.bootstrap=true)."
Dave Syer
@dsyer
Jul 15 2016 11:14
that's the exception not the rule
Normally a config client gets its config from the server over HTTP
that's why those endpoints exist
So the clients don't need to know about git.
If you are happy for all your client apps to be aware of the config backend, you can use that hint I guess to get a local copy of the config files.
Luke Shannon
@lshannon
Jul 15 2016 18:44
Hello, can I ask questions about Spring Cloud Netflix components in here?
Marcos Barbero
@marcosbarbero
Jul 15 2016 18:45
Yes, you can
Luke Shannon
@lshannon
Jul 15 2016 18:46
I am trying to get Blue/Green deployments running on PWS with my micro services registered to Eureka. Right now the Blue and Green service are clashing on their spring.application.name values in Eureka (ie: Green services takes the registry of Blue...when I want them in parallel until my testing is done). I think I am missing something. How are other people getting Blue/Green to work with Eureka in the mix?
Marcos Barbero
@marcosbarbero
Jul 15 2016 18:48
Let me see if I understood your case
You’re trying to do blue green deployment but the ribbon routing is the problem because it has the same application name and it doesn't alternate among the versions? Am I right?
Luke Shannon
@lshannon
Jul 15 2016 18:53
Correct. I would like the "current" version of the application running and getting its traffic, but i want to run the "new" version on a route/url that is not known. Here I will do some testing, if it looks good I will promote the new to the current and remove the previous current. Does that make sense?
Marcos Barbero
@marcosbarbero
Jul 15 2016 18:54
Yeah, it does make sense
Unfortunately it’s not implemented out of the box
Luke Shannon
@lshannon
Jul 15 2016 18:55
But there is a way right... :-D
Marcos Barbero
@marcosbarbero
Jul 15 2016 18:55
yeah, there is… I’m looking for a link
give me a sec
Luke Shannon
@lshannon
Jul 15 2016 18:55
:-D awesome!
Marcos Barbero
@marcosbarbero
Jul 15 2016 18:59
You’ll need to implement a ZuulFilter with routing type and play with the IRule of ribbon load balancing rules. The best approach to do it is adding the API version into eureka metadata
A sample of IRule implementation can be found here https://jmnarloch.wordpress.com/2015/11/25/spring-cloud-ribbon-dynamic-routing/
Dave Syer
@dsyer
Jul 15 2016 19:00
I think ZuulFilter might be a distraction there. But good tip on the IRule
Marcos Barbero
@marcosbarbero
Jul 15 2016 19:01
Oops.. my bad on ZuulFilter then :D
Dave Syer
@dsyer
Jul 15 2016 19:01
FWIW I think @ryanjbaxter is in the hook for some zero-downtime r&d
Luke Shannon
@lshannon
Jul 15 2016 19:02
great :-)
Dave Syer
@dsyer
Jul 15 2016 19:02
He's barely started. But there should be some docs/blogs in the pipeline soon.
Luke Shannon
@lshannon
Jul 15 2016 19:04
@dsyer thank you
OK, next question
I have an Edge service that uses a ZuulProxy to talk to Eureka to get all the back end services it might need to call
When I looking at the /mappings endpoint in my edge service I do see the mappings that are picked up from Eureka
/branch-service/**: {
bean: "zuulHandlerMapping"
},
/officer-service/**: {
bean: "zuulHandlerMapping"
},
/identity-service/**: {
bean: "zuulHandlerMapping"
},
/config-service/**: {
bean: "zuulHandlerMapping"
},
when i test locally I can do /edge-service/branch-service/v1/myendpoint/{some arguement} and get back the response from the branch service
But when I push this up to PWS and try and run it, I get a routing error
The cause of the error is this:
com.sun.jersey.api.client.ClientHandlerException: java.net.UnknownHostException: http
    com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:187)
    com.sun.jersey.api.client.Client.handle(Client.java:652)
    com.sun.jersey.api.client.WebResource.handle(WebResource.java:682)
    com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
    com.sun.jersey.api.client.WebResource$Builder.get(WebResource.java:509)
    com.netflix.niws.client.http.RestClient.execute(RestClient.java:618)
    com.netflix.niws.client.http.RestClient.execute(RestClient.java:527)
    com.netflix.niws.client.http.RestClient.execute(RestClient.java:92)
    com.netflix.client.AbstractLoadBalancerAwareClient$1.call(AbstractLoadBalancerAwareClient.java:109)
    com.netflix.loadbalancer.reactive.LoadBalancerCommand$3$1.call(LoadBalancerCommand.java:303)
    com.netflix.loadbalancer.reactive.LoadBalancerCommand$3$1.call(LoadBalancerCommand.java:287)
    rx.internal.util.ScalarSynchronousObservable$4.call(ScalarSynchronousObservable.java:223)
    rx.internal.util.ScalarSynchronousObservable$4.call(ScalarSynchronousObservable.java:220)
    rx.Observable.unsafeSubscribe(Observable.java:8460)
    rx.internal.operators.OnSubscribeConcatMap$ConcatMapSubscriber.drain(OnSubscribeConcatMap.java:286)
    rx.internal.operators.OnSubscribeConcatMap$ConcatMapSubscriber.onNext(OnSubscribeConcatMap.java:144)
    com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:185)
    com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:180)
    rx.Observable.unsafeSubscribe(Observable.java:8460)
    rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:94)
    rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:42)
    rx.Observable.unsafeSubscribe(Observable.java:8460)
It does work if I use the RestTemplate
but not via a HTTP call
I might want to have Javascript call these services through the Edge service, so it would be handy to figure it out
Luke Shannon
@lshannon
Jul 15 2016 19:09
I can post my applications.yml for the edge, eureka and branch service if it makes sense
but does the problem description make sense?
Marcos Barbero
@marcosbarbero
Jul 15 2016 19:17
As I can see it's looking for a host named http which might be a misconfiguration. What's your edge server configuration?
Luke Shannon
@lshannon
Jul 15 2016 19:18
Here is my application.yml:
ribbon:
  IsSecure: false

server:
  port: 8087
eureka:
  client:
    serviceUrl:
      defaultZone: ${vcap.services.discovery-service.credentials.uri:http://localhost:8761}/eureka/
---
spring:
  profiles: cloud
eureka:
  instance:
    hostname: ${vcap.services.discovery-service.credentials.uri}
    nonSecurePort: 80
Here is my bootstrap.yml:
spring:
  application:
    name: edge-service
  cloud:
    config:
      uri: ${vcap.services.config-service.credentials.uri:http://localhost:8888}
This is running on PWS, the vcap service variable should contain the URL of the running service on the platform
As this does work locally, I thought it could be something weird about the routing when inside the platform. Maybe something I have to add to ribbon's config to resolve?
Marcos Barbero
@marcosbarbero
Jul 15 2016 19:25
your configuration looks fine
the problem occurs when you try to reach the same endpoint but deployed on PWS?
Luke Shannon
@lshannon
Jul 15 2016 19:26
correct
works fine locally
Marcos Barbero
@marcosbarbero
Jul 15 2016 19:28
is it working if you access the /branch-service/v1/myendpoint/ directly? Skipping the the edge server
on PWS
Luke Shannon
@lshannon
Jul 15 2016 19:28
it does
yes
And those Zuul mappings show up on PWS too
Marcos Barbero
@marcosbarbero
Jul 15 2016 19:31
if you reach eureka endpoint /eureka/appsthe applications infos are fine?
Luke Shannon
@lshannon
Jul 15 2016 19:32
Wow, thats pretty neat, did not know about that end point
yes, they are all there
Marcos Barbero
@marcosbarbero
Jul 15 2016 19:33
hehehe you can also filter it by application name, e.g. /eureka/apps/{foo}
Luke Shannon
@lshannon
Jul 15 2016 19:33
cool!
yep, that works too :-)
Marcos Barbero
@marcosbarbero
Jul 15 2016 19:34
Well I guess you should change the application log level so we can try to find some more info on that case
Luke Shannon
@lshannon
Jul 15 2016 19:34
Roger that
pradeepkusingh
@pradeepkusingh
Jul 15 2016 19:48
@dsyer : can I send Hystrix data toKafka ?
Dave Syer
@dsyer
Jul 15 2016 19:57
If you can imagine it, you can do it
pradeepkusingh
@pradeepkusingh
Jul 15 2016 19:57
ha ha ha :)
That lets you send Hystrix data to any Spring Cloud Stream broker (so Kafka is easy)