Spring Boot Admin Client Configuration using Basic HTTP Authentication

Spring Boot Admin Application can be used to manage and monitor our applications.

Client applications register with our Spring Boot Admin Client (via HTTP) or are discovered using Spring Cloud ® (e.g. Eureka, Consul). The UI is just an AngularJs application on top of the Spring Boot Actuator endpoints.

image2018-11-9_13-9-30.png

We can monitor the metrics of each of the deployed instances of the micro services

It provides the following features for registered application.

  • Show health status
  • Show details, like
    • JVM & memory metrics
    • micrometer.io metrics
    • Datasource metrics
    • Cache metrics
  • Show build-info number
  • Follow and download logfile
  • View jvm system- & environment-properties
  • View Spring Boot Configuration Properties
  • Support for Spring Cloud’s postable /env- &/refresh-endpoint
  • Easy loglevel management
  • Interact with JMX-beans
  • View thread dump
  • View http-traces
  • View auditevents
  • View http-endpoints
  • View scheduled tasks
  • View and delete active sessions (using spring-session)
  • View Flyway / Liquibase database migrations
  • Download heapdump
  • Notification on status change (via e-mail, Slack, Hipchat, …)
  • Event journal of status changes (non persistent)

Setup the Server and Client Configuration

Server Setup

  1. Add Spring Boot Admin Server starter to your dependencies:
    pom.xml

    <dependencies>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-server</artifactId>
            <version>1.5.7</version>
        </dependency>
    </dependencies>
  2. Pull in the Spring Boot Admin Server configuration via adding @EnableAdminServer to your configuration:
    @Configuration
    @EnableAutoConfiguration
    @EnableAdminServer
    public class SpringBootAdminApplication {
        public static void main(String[] args) {
            SpringApplication.run(SpringBootAdminApplication.class, args);
        }
    }

Application Properties

spring.application.name=Boot-Admin
server.port=8080
security.user.name=admin
security.user.password=admin

Login Page is authenticated with username and password as admin

Client Setup

  1. Add spring-boot-admin-starter-client to your dependencies:
    pom.xml

    <dependency>
        <groupId>de.codecentric</groupId>
        <artifactId>spring-boot-admin-starter-client</artifactId>
        <version>1.5.7</version>
    </dependency>
  2. Enable the SBA Client by configuring the URL of the Spring Boot Admin Server:
    application.yml

    spring.boot.admin.url: http://localhost:8080 
    management.security.enabled: false 

Application Properties

server.port=8082
management.context-path=/mgmt
spring.boot.admin.url=http://localhost:8093
spring.application.name=resource-server

security.user.name=admin
security.user.password=admin
logging.level.org.springframework.security: DEBUG

security.basic.enabled=false
management.security.enabled=true

zuul.sensitive-headers=

spring.boot.admin.client.metadata.user.name = admin
spring.boot.admin.client.metadata.user.password = admin

We can monitor the memory metrics of the containers and can modify the performance based on the metrics

 

We can change the log levels of the deployed instances in the run time without the need of restarting the containers

We can add the security on the management endpoints by implementing Basic, oAuth2 or Session Authentication.

The above properties depicts the way of securing the managements by Basic Authentication.

 

Multiple boot applications, all registering to same boot admin server. These applications have secured management endpoints having different authentication credentials (different username/ password for each application).
The boot admin UI pops up the window to enter the credentials for each application.This way we can  pass the authentication credentials from client, so that admin server automatically reads it and connects to secure endpoints.

Source Code :https://github.com/aritnag/SpringBootAdminClientUsingBasicAuthentication

References :

https://github.com/codecentric/spring-boot-admin

http://codecentric.github.io/spring-boot-admin/2.0.2/

Digiprove sealCopyright secured by Digiprove © 2019 Geeks 18

7 Comments

    • Thanks Nicolialia for the valuable feedback and encouraging words. We are working on increasing the content with real time examples. Meanwhile you can subscribe as well to our channel and share the website to the known geeks. Happy geeking! 🙂

  1. That is really interesting, You are an excessively skilled
    blogger. I’ve joined your feed and look ahead to looking for more of your
    magnificent post. Additionally, I have shared your site in my social networks

Leave a Reply

Your email address will not be published.


*