Skip to content

Commit 69f8568

Browse files
committed
Discover applications on ApplicationReadyEvent
Since there is no Heartbeat or InstanceRegisteredEvent when using the SimpleDiscoveryClient we need to listen on the ApplicationReadyEvent and register the configured instances closes codecentric#505
1 parent 7c3130b commit 69f8568

File tree

4 files changed

+358
-318
lines changed

4 files changed

+358
-318
lines changed

spring-boot-admin-docs/src/main/asciidoc/getting-started.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ See also the https://github.com/codecentric/spring-boot-admin/tree/master/spring
4444
[[register-client-applications]]
4545
=== Registering client applications ===
4646

47-
To register your application at the SBA Server you can either include the SBA Client or use http://projects.spring.io/spring-cloud/spring-cloud.html[Spring Cloud Discovery] (e.g. Eureka)
47+
To register your application at the SBA Server you can either include the SBA Client or use http://projects.spring.io/spring-cloud/spring-cloud.html[Spring Cloud Discovery] (e.g. Eureka, Consul, ...). There is also a <<spring-cloud-discovery-static-config,simple option using a static configuration on the SBA Server side>>.
4848

4949
[[register-clients-via-spring-boot-admin]]
5050
==== spring-boot-admin-starter-client ====

spring-boot-admin-docs/src/main/asciidoc/server-discovery.adoc

Lines changed: 52 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,65 @@
11
[[spring-cloud-discovery-support]]
22
=== Spring Cloud Discovery ===
33

4-
The Spring Boot Admin Server can use Spring Clouds `DiscoveryClient` to discover applications. The advantage is that the clients don't have to include the `spring-boot-admin-starter-client`. You just have to add a DiscoveryClient to your admin server - everything else is done by AutoConfiguration.
5-
The setup is explained <<discover-clients-via-spring-cloud-discovery,above>>.
6-
7-
==== ServiceInstanceConverter ====
4+
The Spring Boot Admin Server can use Spring Clouds `DiscoveryClient` to discover applications. The advantage is that the clients don't have to include the `spring-boot-admin-starter-client`. You just have to add a `DiscoveryClient` implementation to your admin server - everything else is done by AutoConfiguration.
5+
6+
[[spring-cloud-discovery-static-config]]
7+
==== SimpleDiscoveryClient configuration ====
8+
9+
Spring Boot Admin ships with the `SimpleDiscoveryClient` included. This allows you to specify client applications via configuration, without adding the SBA Client or a DiscoveryClient implementation to your monitored applications:
10+
11+
[source,yml]
12+
.application.yml
13+
----
14+
spring:
15+
cloud:
16+
discovery:
17+
client:
18+
simple:
19+
instances:
20+
test:
21+
- uri: http://instance1.intern:8080
22+
metadata:
23+
management.context-path: /actuator
24+
- uri: http://instance2.intern:8080
25+
metadata:
26+
management.context-path: /actuator
27+
----
28+
29+
==== Other DiscoveryClient implementations (Eureka, Zookeeper, Consul, ...) ====
30+
Spring Boot Admin supports all other implementation of Spring Cloud's `DiscoveryClient`. You need to add it to the Spring Boot Admin Server and configure it properly.
31+
An <<discover-clients-via-spring-cloud-discovery,example setup using Eureka>> is shown above.
32+
33+
==== Converting ServiceInstances into monitored applications ====
834

935
The information from the service registry are converted by the `ServiceInstanceConverter`. Spring Boot Admin ships with a default and Eureka converter implementation. The correct one is selected by AutoConfiguration.
1036

1137
TIP: You can modify how the information from the registry is used to register the application by using SBA Server configuration options and instance metadata. The values from the metadata takes precedence over the server config. If the plenty of options don't fit your needs you can provide your own `ServiceInstanceConverter`.
1238

1339
NOTE: When using Eureka, the `healthCheckUrl` known to Eureka is used for health-checking, which can be set on your client using `eureka.instance.healthCheckUrl`.
1440

41+
.Instance metadata options
42+
|===
43+
| Key |Value |Default value
44+
45+
| user.name +
46+
user.password
47+
| Credentials being used to access the endpoints.
48+
|
49+
50+
| management.port
51+
| The port is substituted in the service URL and will be used for accessing the actuator endpoints.
52+
|
53+
54+
| management.context-path
55+
| The path is appended to the service URL and will be used for accessing the actuator endpoints.
56+
| `${spring.boot.admin.discovery.converter.mangement-context-path}`
57+
58+
| health.path
59+
| The path is appended to the service URL and will be used for the health-checking. Ignored by the `EurekaServiceInstanceConverter`.
60+
| `${spring.boot.admin.discovery.converter.health-endpoint}`
61+
|===
62+
1563
.Discovery configuration options
1664
|===
1765
| Property name |Description |Default value
@@ -36,25 +84,3 @@ NOTE: When using Eureka, the `healthCheckUrl` known to Eureka is used for health
3684
| This services will be included when using discovery and registered as application. Supports simple patterns (e.g. "foo*", "*bar", "foo*bar*").
3785
| `"*"`
3886
|===
39-
40-
.Instance metadata options
41-
|===
42-
| Key |Value |Default value
43-
44-
| user.name +
45-
user.password
46-
| Credentials being used to access the endpoints.
47-
|
48-
49-
| management.port
50-
| The port is substituted in the service URL and will be used for accessing the actuator endpoints.
51-
|
52-
53-
| management.context-path
54-
| The path is appended to the service URL and will be used for accessing the actuator endpoints.
55-
| `${spring.boot.admin.discovery.converter.mangement-context-path}`
56-
57-
| health.path
58-
| The path is appended to the service URL and will be used for the health-checking. Ignored by the `EurekaServiceInstanceConverter`.
59-
| `${spring.boot.admin.discovery.converter.health-endpoint}`
60-
|===

0 commit comments

Comments
 (0)