Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document using the same port for the management server on Cloud Foundry #15640

Closed
milindsonawane opened this issue Jan 7, 2019 · 9 comments
Closed
Labels
type: documentation A documentation update
Milestone

Comments

@milindsonawane
Copy link

I have deployed my spring boot application on PCF; all the actuator endpoints have been exposed. The actuator endpoints are configured as:

management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
management.server.port=${CF_INSTANCE_PORT}

On hitting the /actuator/** or /actuator, the requests are redirected to / endpoint. This was verified by creating an endpoint in the controller. While the application worked perfectly on local environment, it failed on PCF (have not tried this in other env). If we add any actuator endpoint in a controller, it works smoothly. For example, I added /actuator/health is added in a controller and all the request for health endpoint were redirected to this endpoint within my controller.

The spring boot version is 2.0.5 and the spring cloud dependencies are managed under Finchley.SR1.

Here's the code link.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 7, 2019
@philwebb
Copy link
Member

philwebb commented Jan 7, 2019

According to the Cloud Foundry documentation CF-INSTANCE-PORT is the external port so I don't think it's possible to use it as a management port.

If you want to access actuator URLs using standard CF routes then try removing the management.server.port=${CF_INSTANCE_PORT} line from your properties file.

You should then be able to hit the actuator via https://myapp.cfapps.io/actuator/health.

@philwebb philwebb added the status: waiting-for-feedback We need additional information before we can continue label Jan 7, 2019
@mbhave
Copy link
Contributor

mbhave commented Jan 7, 2019

Since only a single port is routable through the go-router on CF (by default at least), we can document that management.server.port should be the same as server.port for a CF deployment.

@milindsonawane
Copy link
Author

According to the Cloud Foundry documentation CF-INSTANCE-PORT is the external port so I don't think it's possible to use it as a management port.

If you want to access actuator URLs using standard CF routes then try removing the management.server.port=${CF_INSTANCE_PORT} line from your properties file.

You should then be able to hit the actuator via https://myapp.cfapps.io/actuator/health.

Okay, but are the requests supposed to be redirected to / on adding the property on cloudfoundry?

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jan 8, 2019
@mbhave
Copy link
Contributor

mbhave commented Jan 8, 2019

That is not related to CloudFoundry. You have an empty @GetMapping which acts as the fallback.

I'm going to convert this to a documentation issue to document using the same port for the management server for a CF deployment.

If you have any more questions, please ask on StackOverflow or join us on Gitter.

@mbhave mbhave added type: documentation A documentation update and removed status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged labels Jan 8, 2019
@mbhave mbhave added this to the 2.1.x milestone Jan 8, 2019
@mbhave mbhave changed the title Actuator endpoint redirects to "/" on using property management.server.port on cloudfoundry Document using the same port for the management server on Cloud Foundry Jan 8, 2019
@milindsonawane
Copy link
Author

@philwebb Can I please request you to share the link of the documentation?

@milindsonawane
Copy link
Author

milindsonawane commented Jan 31, 2019

That is not related to CloudFoundry. You have an empty @GetMapping which acts as the fallback.

I'm going to convert this to a documentation issue to document using the same port for the management server for a CF deployment.

If you have any more questions, please ask on StackOverflow or join us on Gitter.

@mbhave What might the issue be in this case? IMO, it should not fall back to an empty @GetMapping at all. The reason I tagged this as a Cloud Foundry issue is that I haven't been able to reproduce this issue elsewhere. I tried assigning server.port=${CF_INSTANCE_PORT} but result was still the same.

@wilkinsona
Copy link
Member

@milindsonawane The documentation is here: https://docs.run.pivotal.io/devguide/deploy-apps/environment-variable.html. It's the first result (for me at least) when Googling for "CloudFoundry CF_INSTANCE_PORT".

@dilipmighty245
Copy link

dilipmighty245 commented Feb 3, 2019

@milindsonawane

use eureka.instance.metadata-map.management.port=${CF_INSTANCE_PORT}
instead of management.server.port=${CF_INSTANCE_PORT} , it will work.

@milindsonawane
Copy link
Author

@dilipmighty245
But it won't always be a micro-service. Also, this property helps only is case you are using eureka. What if someone opts for consul or zookeeper?

@mbhave mbhave modified the milestones: 2.1.x, 2.1.4 Mar 22, 2019
@mbhave mbhave closed this as completed in 1ad52b6 Mar 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation A documentation update
Projects
None yet
Development

No branches or pull requests

6 participants