Search code examples
spring-boot-admin

Spring-Boot-Admin on Cloud Foundry: Showing UP applications as OFFLINE


We are developing a Boot-Admin dashboard using the codecentric provided library of spring-boot-admin-server version 1.4.5

Some of the applications are registering itself with the server via Eureka, and some directly using the spring-boot-admin-starter-client version 1.4.5.

All components are deployed on a PCF environment and are communication over HTTPS. In either ways, the applications though are able to register themselves with the admin sever but are showing up as OFFLINE only. There are no errors reported in the logs for any of the components viz. admin-server, admin-client, eureka-server, eureka-client.

However the only application showing as Up is the admin server itself.

The application properties for 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

As the result is same for both methods of registration, I've skipped putting the config here for apps registering via Eureka path to keep it simple.

The same is 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 suggestions are most welcome.

---EDIT---

Here are the logs from SBA server showing that the communication between server and client is working okay. If these logs give any indication of an error, please point out.

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 refister" only when the server is down.


Solution

  • Based upon the discussion on https://github.com/codecentric/spring-boot-admin/issues/399 it has been found out that below properties are vital for SBA clients to work with Dashboard on Cloud Foundry or container based architecture: spring: boot: admin: client: management-url: <complete management-url for the client> health-url: <complete health endpoint url for the client> service-url: <complete root/service url for the client>

    This is due to the fact that, when a client registers itself with the SBA server it uses the runC container ID to form its service url. Such url is not valid for the Cloud Foundry router. That results in failure of communication between SBA dashboard and the client later on, causing it to show as OFFLINE.

    The other approach can be to go ahead with container IPs, using spring.boot.admin.client.prefer-ip=true. That would list all containers/CF instacnes on SBA but not give a clear picture of overall health of the complete app from a site/AZ. Also direct connection to containers is never encouraged in CF as per the principles of cloud-native app and 12-factors.