@SpringBootApplication
@EnableDiscoveryClient
@Configuration
@EnableAutoConfiguration
@EnableAdminServer
public class CoeAdminApplication {
s public static void main(String[] args) {
SpringApplication.run(CoeAdminApplication.class, args);
}
}
b. Client-side 구성 with Eureka Client (1.5.x)
각 마이크로서비스가 Eureka Client로 구성되어 있는 경우, Actuator 정보만 추가하여 Admin Server에 자동 등록하고 사용할 수 있다.
Eureka 는 필수가 아니며, Spring Boot Admin Client 를 통해 구성 가능하다.
@SpringBootApplication
@EnableDiscoveryClient
@Configuration
@EnableAutoConfiguration
@EnableAdminServer
public class CoeAdminApplication {
s public static void main(String[] args) {
SpringApplication.run(CoeAdminApplication.class, args);
}
}
b. Client-side 구성 with Eureka Client (2.0.x)
각 마이크로서비스가 Eureka Client로 구성되어 있는 경우, Actuator 정보만 추가하여 Admin Server에 자동 등록하고 사용할 수 있다.
Eureka 는 필수가 아니며, Spring Boot Admin Client 를 통해 구성 가능하다.
@Configuration
public static class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
// Page with login form is served as /login.html and does a POST on /login
http.formLogin().loginPage("/login.html").loginProcessingUrl("/login").permitAll();
// The UI does a POST on /logout on logout
http.logout().logoutUrl("/logout");
// The ui currently doesn't support csrf
http.csrf().disable();
// Requests for the login page and the static assets are allowed
http.authorizeRequests()
.antMatchers("/login.html", "/**/*.css", "/img/**", "/third-party/**")
.permitAll();
// ... and any other request needs to be authorized
http.authorizeRequests().antMatchers("/**").authenticated();
// Enable so that the clients can authenticate via HTTP basic for registering
http.httpBasic();
}
}
1.5.x 버전의 경우 hystrix-ui, turbine-ui 모듈을 추가할 수 있다. (2.x 버전은 지원하지 않음)
참고
버전이슈
SpringBoot Admin Sever의 버전과 마이크로 서비스의 SpringBoot(Actuator) 버전에 따라 이슈가 있음 1. SpringBoot Admin Sever : 2.0.0
Eureka 에 등록된 서버 정보를 SpringBoot Admin에 등록하지 못하는 문제 (springBoot-admin-client를 통해서는 등록 됨)
(참고 : https://github.com/codecentric/spring-boot-admin/issues/776)
==> Spring Boot 2.0.1-SNAPSHOT 사용 권장
SpringBoot Admin Sever : 2.0.1-SNAPSHOT
- admin server issue
spring-boot-admin-server-ui-hystrix, spring-boot-admin-server-ui-turbine의 최종 버전 1.5.8 이고
Spring Admin 2.x에서 해당 버전을 지원하지 않음(추후 계획 없음)
(참고 : https://github.com/codecentric/spring-boot-admin/issues/657)
- client issue
마이크로 서비스가 Spring Boot 1.x 버전을 사용할 경우 Admin Server에서 모든 Endpoint 지원하지 않음
(참고 : http://codecentric.github.io/spring-boot-admin/2.0.0/)
>As some of the actuator endpoints changed with the Spring Boot 2 release not all options might be available (e.g. /metrics endpoint); for some of the endpoints we provide legacy converters.
SpringBoot Admin Server : 1.5.7
- client issue
마이크로 서비스가 Spring Boot 2.x 버전을 사용할 경우 Admin Server에서 모든 Endpoint 지원하지 않음
SpringBoot Admin Server와 각 마이크로 서비스의 버전을 맞춰서 사용하는 것을 권장. SpringBoot Admin 2.x를 사용하는 경우 turbine은 별도의 서비스로 제공 해야 함