Improve Cloudfoundry support in client
See original GitHub issueThis is being re-reported after failure to get a help on Stackoverflow - http://stackoverflow.com/questions/41742918
There is an issue being faced when SBA client and server are running on Cloud Foundry.
We are developing a Boot-Admin dashboard using the codecentric provided library of spring-boot-admin-server
version 1.4.5
The application are registering itself with the server as client using spring-boot-admin-starter-client
version 1.4.5.
Both client and server are deployed on a PCF environment and are communication over HTTPS.
The application though is able to register itself with the admin sever but is showing up as OFFLINE on dashboard. There are no errors reported in the logs for either the admin-server or the admin-client.
The application properties used for the spring-boot-admin-client app to run in PCF is:
spring:
application:
name: bootadmin-ms-charlie
boot:
admin:
url: https://bootadmin-dashboard.abc.intl.com
ssl:
trust_store:
path: classpath:ssl/sslcacert.jks
password: a-password
Here are the logs from SBA server showing that the communication between server and client is working okay. I don’t see any logs giving any indication of an error, don’t they?
OUT 2017-01-23 05:15:15.139 DEBUG 10 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : DispatcherServlet with name 'dispatcherServlet' processing POST request for [/api/applications]
OUT 2017-01-23 05:15:15.151 DEBUG 10 --- [nio-8080-exec-1] m.m.a.RequestResponseBodyMethodProcessor : Read [class de.codecentric.boot.admin.model.Application] as "application/json;charset=UTF-8" with [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter@7df33a9f]
OUT 2017-01-23 05:15:15.163 DEBUG 10 --- [nio-8080-exec-1] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Written [Application [id=3805ee6a, name=bootadmin-ms-charlie, managementUrl=http://23fcf304-82d6-44cd-7fce-2a5027de9f21:8080, healthUrl=http://23fcf304-82d6-44cd-7fce-2a5027de9f21:8080/health, serviceUrl=http://23fcf304-82d6-44cd-7fce-2a5027de9f21:8080]] as "application/json" using [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter@7df33a9f]
OUT 2017-01-23 05:15:15.166 DEBUG 10 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Null ModelAndView returned to DispatcherServlet with name 'dispatcherServlet': assuming HandlerAdapter completed request handling
OUT 2017-01-23 05:15:15.166 DEBUG 10 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Successfully completed request
OUT bootadmin-dashboard.abc-intl.com - [23/01/2017:05:15:15.140 +0000] "POST /api/applications HTTP/1.1" 201 302 308 "-" "Java/1.8.0_121" 60.16.25.20:43224 x_forwarded_for:"10.10.10.10" x_forwarded_proto:"https" vcap_request_id:a40159e4-543f-40e0-627e-e8f1e7688b99 response_time:0.034164523 app_id:adcc8a33-83f4-448d-9ae2-bf2a2b16ea72
OUT 2017-01-23 05:15:18.719 DEBUG 10 --- [ updateTask1] o.s.web.client.RestTemplate : Created GET request for "http://23fcf304-82d6-44cd-7fce-2a5027de9f21:8080/health"
OUT 2017-01-23 05:15:18.722 DEBUG 10 --- [ updateTask1] o.s.web.client.RestTemplate : Setting request Accept header to [application/json, application/*+json]
The logs from client are all clean. It throws warning of “Failed to register” only when the server is down.
The same apps are working perfectly fine locally where the admin dashboard shows all the applications as expected.
Is there any configuration that needs to be done in specific to Cloud Foundry? Or any obvious mistake that I might have made?
Any suggestion is most welcome.
Issue Analytics
- State:
- Created 7 years ago
- Comments:15
Top GitHub Comments
I ran into the same issue. I forked an older version of the client/SBA because our teams are still on Spring Boot 1.2.x and made some custom changes. Cloud Foundry ‘hides’ the true IP and port of the service. You can see this is evident during the registration; the IP is some GUID value.
serviceUrl=http://23fcf304-82d6-44cd-7fce-2a5027de9f21:8080
I ended up autowiring the following properties and using them if those properties exist instead of InetAddress and building the URL using them.
Reference: https://docs.run.pivotal.io/devguide/deploy-apps/environment-variable.html#CF-INSTANCE-IP
The newer versions use the ApplicationFactory interface, so in the future it may make sense to make a custom CloudFoundryApplicationFactory to autowire those custom values.
Is SSL mandatory? When I hover over OFFLINE I get the below error. It is trying to hit health of someother /health endpoint. Am not sure why is thiis happening.
Could you suggest in this?