Skip to content

Commit 23aa945

Browse files
committed
add admin console client (disabled by default)
1 parent 92263f1 commit 23aa945

3 files changed

Lines changed: 47 additions & 3 deletions

File tree

README.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ This repository is the cornerstone of BBData. It contains:
2121
* [Executing the jar](#executing-the-jar)
2222
* [Caching](#caching)
2323
* [Async](#async)
24+
* [Monitoring](#monitoring)
2425
- [Permission system](#permission-system)
2526
- [Actuators](#actuators)
26-
* [Management interface](#management-interface)
27+
* [Management interface (Spring Boot Admin)](#management-interface-spring-boot-admin)
2728
* [Customizing the `/info` endpoint](#customizing-the-about-info-endpoint)
2829
* [Task executor monitoring](#task-executor-monitoring)
2930
* [Changing exposed actuators](#changing-exposed-actuators)
@@ -209,6 +210,10 @@ in this repo for default values). You can of course override any of those in you
209210

210211
If you want to **TURN OFF** asynchronous processing, simply set the custom property `async.enabled=false`.
211212

213+
### Monitoring
214+
215+
See [Spring Boot Admin](#management-interface-spring-boot-admin).
216+
212217
## Permission system
213218

214219
‼️ **tldr; IMPORTANT** Ensure that the `userGroup` with ID 1 has a meaningful name in the database (e.g. "admin") and that
@@ -232,8 +237,6 @@ This is the equivalent of `SUDO`: any admin of this group has read/write access
232237

233238
## Actuators
234239

235-
### Management interface
236-
237240
Actuators are a way to monitor the API. They can leak sensitive information, so the management interface should
238241
run on another port as the API, which only administrators have access to.
239242

@@ -248,6 +251,27 @@ or by disabling unsecure actuators, e.g.:
248251
management.endpoints.web.exposure.include=info
249252
```
250253

254+
### Management interface (Spring Boot Admin)
255+
256+
In production, the best would be to use [Spring Boot Admin](https://codecentric.github.io/spring-boot-admin/2.3.0/).
257+
The client is already included in the bbdata-api jar. What you need to do:
258+
259+
1. run a Spring Boot Admin server (see the doc),
260+
2. set the properties below in your application.properties
261+
262+
````properties
263+
## Spring Boot Admin
264+
265+
# expose every actuator available, but ensure it runs on another (secured) port !
266+
management.server.port=8111
267+
management.endpoints.web.exposure.include=*
268+
269+
# enable spring boot admin client, and provide the server's URL
270+
spring.boot.admin.client.enabled=true
271+
spring.boot.admin.client.url=<URL OF THE ADMIN SERVER>
272+
spring.boot.admin.client.instance.name=BBData test Instance
273+
````
274+
251275
### Customizing the `/about` (`/info`) endpoint
252276

253277
The actuator endpoint `/info` is mirrored in the public `/about` endpoint.

build.gradle.kts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ dependencies {
6969
val configurationProcessor = "org.springframework.boot:spring-boot-configuration-processor"
7070
kapt(configurationProcessor) // for jar
7171
annotationProcessor(configurationProcessor) // for IntelliJ Idea
72+
73+
// admin console: client
74+
implementation("de.codecentric:spring-boot-admin-starter-client")
75+
}
76+
77+
// for admin-console: client
78+
dependencyManagement {
79+
imports {
80+
mavenBom("de.codecentric:spring-boot-admin-dependencies:2.3.0")
81+
}
7282
}
7383

7484
tasks.withType<Test> {

src/main/resources/application.properties

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,16 @@ management.endpoint.health.show-components=always
107107
#management.server.port=8111 TODO uncomment in production !!!!
108108
management.endpoints.web.base-path=/
109109

110+
## Spring Boot Admin
111+
# disabled by default. To use it, you need to:
112+
# - have an admin server running,
113+
# - set the property spring.boot.admin.client.enabled=true
114+
# - set the property spring.boot.admin.client.url=<URL OF THE ADMIN SERVER>
115+
# - change the property management.endpoints.web.exposure.include=*
116+
spring.boot.admin.client.enabled=false
117+
spring.boot.admin.client.auto-deregistration=true
118+
spring.boot.admin.client.instance.name=BBData test Instance
119+
110120
## Documentation
111121
# Paths: UI at /docs/api, yaml at /docs/api/bbdata{.yaml}
112122
springdoc.swagger-ui.path=/docs/api

0 commit comments

Comments
 (0)