question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve Cloudfoundry support in client

See original GitHub issue

This 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:closed
  • Created 7 years ago
  • Comments:15

github_iconTop GitHub Comments

1reaction
abracadv8commented, Jan 31, 2017

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

  @Value("${CF_INSTANCE_ADDR:}")
  private String cfInstanceUrl;
  @Value("${CF_INSTANCE_IP:}")
  private String cfInstanceIp;
  @Value("${CF_INSTANCE_PORT:}")
  private String cfInstancePort;

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.

0reactions
sruthi-kotlacommented, Mar 14, 2018

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?

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting App Deployment and Health
If Cloud Foundry cannot identify an appropriate buildpack for your app, you see an Unable to detect a supported app type error. You...
Read more >
Troubleshooting Slow Requests in Cloud Foundry
This topic provides experiments that you can run to help determine what part of the Cloud Foundry request flow adds latency to your...
Read more >
Considerations for Designing and Running an App in the Cloud
Clients connect to apps running on Cloud Foundry by making requests to URLs associated with the app. Cloud Foundry allows HTTP requests to...
Read more >
Managing Service Instances with the cf CLI
Managing Service Instances with the cf CLI · List Marketplace Services · Rename a Service Instance · Upgrade a Service Instance · Delete...
Read more >
Upgrading to cf CLI v8 | Cloud Foundry Docs
A seamless upgrade experience from cf CLI v7. Changes are minimal. Where there are changes, the team has incorporated feedback from the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found