README.md 4.43 KB
Newer Older
1 2 3 4 5 6
spring-boot-admin-server
================================

## Easy Setup
Add the following dependency to your pom.xml.

7
```xml
8 9 10
<dependency>
	<groupId>de.codecentric</groupId>
	<artifactId>spring-boot-admin-server</artifactId>
11
	<version>1.2.4</version>
12 13 14 15
</dependency>
<dependency>
	<groupId>de.codecentric</groupId>
	<artifactId>spring-boot-admin-server-ui</artifactId>
16
	<version>1.2.4</version>
17 18 19 20 21
</dependency>
```

Create the Spring Boot Admin Server with only one single Annotation.
Example in spring-admin-samples/spring-boot-admin-sample.
22
```java
23 24 25 26 27 28 29 30 31 32
@Configuration
@EnableAutoConfiguration
@EnableAdminServer
public class Application {
	public static void main(String[] args) {
		SpringApplication.run(Application.class, args);
	}
}
```

33
## Spring Cloud DiscoveryClient support
34
The Spring Boot Admin Server is capable of using  Spring Clouds DiscoveryClient to discover applications. When you do this the clients don't have to include the spring-boot-admin-starter-client. You just have to configure a DiscoveryClient - everything else is done by AutoConfiguration.
35 36 37 38 39 40 41
See the [discovery sample project](https://github.com/codecentric/spring-boot-admin/tree/master/spring-boot-admin-samples/spring-boot-admin-sample-discovery) in this repository.

One note: If you omit the Spring Boot Admin Client in you Client Applications you can't download the logfile (but hopefully my pull request will make it into Spring Boot 1.3.0);

### Further configuration
Since the DiscoveryClient doesn't tell the management.context-path you can suffix the url for all discovered clients by setting ``spring.boot.admin.discovery.management.context-path``.

42
Explictly disable DiscoveryClient support by setting ``spring.boot.admin.discover.enabled=false``.
43

44 45 46 47 48 49 50 51 52 53 54 55
## Mail notification options:

| Name                  | Description |
| --------------------- | ----------- |
|spring.boot.admin.notify.enabled|enable mail notification (default: true)|
|spring.boot.admin.notify.to|comma-delimited list of mail recipients (default: "root@localhost")|
|spring.boot.admin.notify.cc|comma-delimited list of mail cc-recipients|
|spring.boot.admin.notify.from|sender of mail|
|spring.boot.admin.notify.subject|mail-subject; SpEL-expressions supported (default: "#{application.name} (#{application.id}) is #{to.status}") |
|spring.boot.admin.notify.text|mail-body; SpEL-expressions supported (default: "#{application.name} (#{application.id})\nstatus changed from #{from.status} to #{to.status}\n\n#{application.healthUrl}"|
|spring.boot.admin.notify.ignoreChanges|comma-deleiited list of status changes to be ignored. (default: "UNKNOWN:UP")|

56
## Hazelcast Support
57 58 59 60
Spring Boot Admin Server supports cluster replication with Hazelcast.
It is automatically enabled when its found on the classpath.

Just add Hazelcast to your dependencies:
61
```xml
62 63 64 65 66 67 68 69 70 71
<dependency>
	<groupId>com.hazelcast</groupId>
	<artifactId>hazelcast</artifactId>
	<version>3.3.3</version>
</dependency>
```

And thats it! The server is going to use the default Hazelcast configuration.

### Custom Hazelcast configuration
72
To change the configuration add a ``com.hazelcast.config.Config``-bean to your application context (for example with hazelcast-spring):
73 74

Add hazelcast-spring to dependencies:
75
```xml
76 77 78 79 80 81 82 83
<dependency>
	<groupId>com.hazelcast</groupId>
	<artifactId>hazelcast-spring</artifactId>
	<version>3.3.3</version>
</dependency>
```

Import hazelcast spring configuration xml-file:
84
```java
85 86 87 88 89 90 91 92 93 94 95 96
@Configuration
@EnableAutoConfiguration
@EnableAdminServer
@ImportResource({ "classpath:hazelcast-config.xml" })
public class Application {
	public static void main(String[] args) {
		SpringApplication.run(Application.class, args);
	}
}
```

Write xml-config hazelcast-config.xml:
97
```xml
98 99 100 101 102 103 104 105 106 107
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:hz="http://www.hazelcast.com/schema/spring" 
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.hazelcast.com/schema/spring http://www.hazelcast.com/schema/spring/hazelcast-spring-3.3.xsd">
	<hz:config id="hazelcastConfig">
		<hz:instance-name>${hz.instance.name}</hz:instance-name>
		<hz:map name="spring-boot-admin-application-store" backup-count="1" eviction-policy="NONE" />
	</hz:config>
</beans>
```

### Further configuration
108
Disable Hazelcast support by setting ``spring.boot.admin.hazelcast.enabled=false``.
109 110

To alter the name of the Hazelcast-Map set ``spring.boot.admin.hazelcast.map= my-own-map-name``.