-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Client-side management endpoints to register and deregister a client. #151
Comments
Hi @RobWin, I think doing a |
And what about a separate endpoints module which can be plugged-in via a conditional bean? Similar to the admin-client-starter module? Just a management extension which can be added as a dependency by people who need it? |
I still hesitate to add the endpoints (even as a module). |
Ok |
This commit contains multiple changes: - Start the registration task after the ApplicationReady event. This makes AdminClientProperties.isReady() unnecessary. - The RegistarApplicationListener has two new public methods to start/stop the periodic registration task. - Add spring.boot.admin.auto-registration property (default: true). When this property is set the registration task is automatically scheduled after the ApplicationReadyEvent. closes #151
So I found (imho) a good solution: First of all I've added the @Autowired
private RegistrationApplicationListener listener;
@Autowired
private Environment env;
@EventListener
public void onContextRefresh(EnvironmentChangeEvent event) {
Boolean runRegistration = env.getProperty("runRegistration", Boolean.class, true);
LOGGER.info("Environment changed! runRegistration = {}", runRegistration);
if (runRegistration) {
listener.startRegisterTask();
} else {
listener.stopRegisterTask();
}
} Now when you do a |
I have implemented Spring boot Admin client & server in my project and its successfully registering-an-application on the Spring boot Admin UI. We are using PCF env for production/QA. Whenever application is deployed from PCF blue region to PCF green region it does not show the updates on the Spring boot Admin UI and we end up restaging all our applications on the production during deployment time. We would not want to do this activity. I understand Spring Boot application auto-registers when the applicationContext is started and ready and this does not happen for PCF Blue to PCF Green deployments. I read this thread where its discussed above approach. Based on the change of the environment it will be register task again. Will this work for my problem? Thanks for helping. |
Hi @joshiste
currently a Spring Boot application auto-registers when the applicationContext is started and ready. It would be nice to have a property called
autoRegistration
similar toautoDeregistration
which enables/disables this behavior.Furthermore it would be nice that have Client-Side Spring Actuator management endpoints which can be triggered to register and deregister the client. The
register
endpoint either activates theScheduledTaskRegistrar
or sets theAdminClientProperties.ready
property to true.For example:
http://localhost:8080/admin/register
http://localhost:8080/admin/deregister
Background:
We use a blue/green deployment process where different versions of the same application can be started on different ports and run in parallel. But only one version is active, that means HTTP requests are routed to this version via a proxy. Currently each application registers itself automatically, but we would like to see only the active instances in the Spring Boot UI.
We would like to be able to trigger the registration only when a version is activated and deregister the deactivated version. We can't do this in a generic way (script) via the Admin REST API directly, because each Spring Boot application could have different management endpoint paths and ports.
I would also contribute this to Spring Boot Admin.
The text was updated successfully, but these errors were encountered: