spring-boot-admin
2019-01-28 19:20:17 34 举报
AI智能生成
spring-boot-admin 笔记
作者其他创作
大纲/内容
SBA Client
Registering client applications
Spring Boot Admin Client
Spring Cloud Discovery
Show version in application list
spring-boot-maven-plugin
<executions><br> <execution><br> <goals><br> <goal>build-info</goal><br> </goals><br> </execution><br> </executions>
JMX-bean management
Dependency
<dependency><br> <groupId>org.jolokia</groupId><br> <artifactId>jolokia-core</artifactId><br></dependency>
Loglevel management
logback-spring.xml
<?xml version="1.0" encoding="UTF-8"?><br><configuration><br> <include resource="org/springframework/boot/logging/logback/base.xml"/><br> <jmxConfigurator/><br></configuration>
Spring Boot Admin Client
configuration options<br>
spring.boot.admin.url<br>spring.boot.admin.username<br>spring.boot.admin.password<br>
Instance metadata options<br>
user.name<br>user.password
Security
Securing Spring Boot Admin Server
@Configuration<br> public static class SecurityConfig extends WebSecurityConfigurerAdapter {<br> @Override<br> protected void configure(HttpSecurity http) throws Exception {<br> // Page with login form is served as /login.html and does a POST on /login<br> http.formLogin().loginPage("/login.html").loginProcessingUrl("/login").permitAll();<br> // The UI does a POST on /logout on logout<br> http.logout().logoutUrl("/logout");<br> // The ui currently doesn't support csrf<br> http.csrf().disable();<br> // Requests for the login page and the static assets are allowed<br> http.authorizeRequests()<br> .antMatchers("/login.html", "/**/*.css", "/img/**", "/third-party/**")<br> .permitAll();<br> // ... and any other request needs to be authorized<br> http.authorizeRequests().antMatchers("/**").authenticated();<br> // Enable so that the clients can authenticate via HTTP basic for registering<br> http.httpBasic();<br> }<br> }
Securing Client Actuator Endpoints
Properties
spring.boot.admin.url: http://localhost:8080<br>
spring.boot.admin.client.metadata.user.name: ${security.user.name}
spring.boot.admin.client.metadata.user.password: ${security.user.password}
Reference
http://codecentric.github.io/spring-boot-admin/1.5.7/
SBA Server
Getting Started
Dependency
<dependency><br> <groupId>de.codecentric</groupId><br> <artifactId>spring-boot-admin-starter-server</artifactId><br> </dependency>
Annotation
@EnableAdminServer
configuration options<br>
spring.boot.admin.context-path
spring.boot.admin.monitor.period
10,000<br>
spring.boot.admin.monitor.status-lifetime<br>
10,000<br>
spring.boot.admin.monitor.connect-timeout<br>
2,000<br>
spring.boot.admin.monitor.read-timeout<br>
5,000<br>
spring.boot.admin.routes.endpoints<br>
"env", "metrics", "trace", "dump", "jolokia", "info", "configprops", "activiti", "logfile", "refresh", "flyway", "liquibase", "loggers"<br>
spring.boot.admin.metadata-keys-to-sanitize<br>
".password$", ".*secret$", ".*key$", ".$token$", ".credentials.", ".*vcap_services$"<br>
Instance metadata options
Spring Cloud Discovery
Dependencies
<dependency><br> <groupId>org.springframework.cloud</groupId><br> <artifactId>spring-cloud-starter-eureka</artifactId><br></dependency>
Annotations
@EnableDiscoveryClient
Properties
eureka.client.serviceUrl.defaultZone: ${EUREKA_SERVICE_URL:http://localhost:8761}/eureka/
management.security.enabled: false
spring.boot.admin.discovery.ignored-services
spring.boot.admin.discovery.services
Clustering
Dependencies
<dependency><br> <groupId>com.hazelcast</groupId><br> <artifactId>hazelcast</artifactId><br></dependency><br>
Beans
@Bean<br> public Config hazelcastConfig() {<br> return new Config().setProperty("hazelcast.jmx", "true")<br> .addMapConfig(new MapConfig("spring-boot-admin-application-store").setBackupCount(1)<br> .setEvictionPolicy(EvictionPolicy.NONE))<br> .addListConfig(new ListConfig("spring-boot-admin-event-store").setBackupCount(1)<br> .setMaxSize(1000));<br> }
Properties<br>Hazelcast configuration options<br>
spring.boot.admin.hazelcast.enabled=true<br>
spring.boot.admin.hazelcast.application-store="spring-boot-admin-application-store"
spring.boot.admin.hazelcast.event-store="spring-boot-admin-event-store"<br>
Notifications
Reminder notifications
Notifier
RemindingNotifier
Filtering notifications
Notifier
FilteringNotifier
Mail notifications
Dependencies
<dependency><br> <groupId>org.springframework.boot</groupId><br> <artifactId>spring-boot-starter-mail</artifactId><br></dependency>
Properties
spring.boot.admin.notify.mail.enabled=true<br>spring.boot.admin.notify.mail.ignore-changes="UNKNOWN:UP"<br>spring.boot.admin.notify.mail.to="root@localhost"<br>spring.boot.admin.notify.mail.to<br>spring.boot.admin.notify.mail.cc<br>spring.boot.admin.notify.mail.from<br>spring.boot.admin.notify.mail.subject="#{application.name} (#{application.id}) is #{to.status}"<br>spring.boot.admin.notify.mail.text="#{application.name} (#{application.id})\nstatus changed from #{from.status} to #{to.status}\n\n#{application.healthUrl}"<br>
PagerDuty notifications
OpsGenie notifications
Hipchat notifications
Slack notifications
Let’s Chat notifications
Microsoft Teams notifications
Telegram notifications
UI Modules
Hystrix UI Module
Dependencies
<dependency><br> <groupId>de.codecentric</groupId><br> <artifactId>spring-boot-admin-server-ui-hystrix</artifactId><br> <version>1.5.7</version><br></dependency>
Properties
spring.boot.admin.routes.endpoints
env,metrics,dump,jolokia,info,configprops,trace,logfile,refresh,flyway,liquibase,heapdump,loggers,auditevents,hystrix.stream
Turbine UI Module
Dependencies
<dependency><br> <groupId>de.codecentric</groupId><br> <artifactId>spring-boot-admin-server-ui-turbine</artifactId><br> <version>1.5.7</version><br></dependency>
Properties
spring.boot.admin.turbine.enabled
true
spring.boot.admin.turbine.clusters
default
spring.boot.admin.turbine.location
turbine
Activiti UI Module
Dependencies
<dependency><br> <groupId>de.codecentric</groupId><br> <artifactId>spring-boot-admin-server-ui-activiti</artifactId><br> <version>1.5.7</version><br></dependency>
Properties
pring.boot.admin.routes.endpoints
env,metrics,dump,jolokia,info,configprops,trace,logfile,refresh,flyway,liquibase,heapdump,activiti
Login UI Module
Dependencies
<dependency><br> <groupId>de.codecentric</groupId><br> <artifactId>spring-boot-admin-server-ui-login</artifactId><br> <version>1.5.7</version><br></dependency>
只提供了登陆页面和退出按钮
0 条评论
下一页