Commit 232bb5f1 by Johannes Edmeier

Merge branch 'master' into 2.x

parents 4a0ff1e6 cfad8fe7
......@@ -32,13 +32,13 @@ This application provides a simple UI to administrate Spring Boot applications.
## Getting Started
[A quick guide](http://codecentric.github.io/spring-boot-admin/1.5.3/#getting-started) to get started can be found in our docs.
[A quick guide](http://codecentric.github.io/spring-boot-admin/1.5.4/#getting-started) to get started can be found in our docs.
## Getting Help
Having trouble with Spring Boot Admin? We’d like to help!
* Check the [reference documentation](http://codecentric.github.io/spring-boot-admin/1.5.3/).
* Check the [reference documentation](http://codecentric.github.io/spring-boot-admin/1.5.4/).
* Ask a question on [stackoverflow.com](http://stackoverflow.com/questions/tagged/spring-boot-admin) - we monitor questions tagged with `spring-boot-admin`.
......@@ -47,7 +47,7 @@ Having trouble with Spring Boot Admin? We’d like to help!
* Report bugs with Spring Boot Admin at http://github.com/codecentric/spring-boot-admin/issues.
## Reference Guide
[Version 1.5.3](http://codecentric.github.io/spring-boot-admin/1.5.3/)
[Version 1.5.4](http://codecentric.github.io/spring-boot-admin/1.5.4/)
[Version 1.4.6](http://codecentric.github.io/spring-boot-admin/1.4.6/)
......
......@@ -83,15 +83,15 @@ spring.boot.admin.client.password
| spring.boot.admin.client.period
| Interval for repeating the registration (in ms).
| `10.000`
| `10,000`
| spring.boot.admin.connectTimeout
| spring.boot.admin.connect-timeout
| Connect timeout for the registration (in ms).
| `5.000`
| `5,000`
| spring.boot.admin.readTimeout
| spring.boot.admin.read-timeout
| Read timeout for the registration (in ms).
| `5.000`
| `5,000`
| spring.boot.admin.auto-registration
| If set to true the periodic task to register the application is automatically scheduled after the application is ready.
......@@ -115,7 +115,7 @@ spring.boot.admin.client.password
| spring.boot.admin.client.instance.management-url
| Management-url to register with. Can be overridden in case the reachable url is different (e.g. Docker).
| Guessed based on managment-base-url and `management.context-path`.
| Guessed based on management-base-url and `management.context-path`.
| spring.boot.admin.client.instance.service-base-url
| Base url for computing the service-url to register with. The path is inferred at runtime, and appended to the base url.
......
......@@ -73,7 +73,7 @@ public class NotifierConfiguration {
<1> Add the `FilteringNotifier` bean using a delegate (e.g. `MailNotifier` when configured)
<2> Add the `RemindingNotifier` as primary bean using the `FilteringNotifier` as delegate.
TIP: This examples combines the reminding and filtering notifiers. This allows you to get notifications after the deployed applications hasn't restarted in a certain amount of time (until the filter expires).
TIP: This example combines the reminding and filtering notifiers. This allows you to get notifications after the deployed application hasn't restarted in a certain amount of time (until the filter expires).
[[mail-notifications]]
==== Mail notifications ====
......
......@@ -21,7 +21,7 @@
<parent>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin</artifactId>
<version>1.5.4-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>spring-boot-admin-samples</artifactId>
......
<!DOCTYPE html>
<!--
~ Copyright 2014-2017 the original author or authors.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="format-detection" content="telephone=no,email=no">
<title>Spring Boot Admin - Applications</title>
</head>
<body>
<div class="instances-list"></div>
</body>
</html>
/*
* Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Vue from 'vue'
import App from './app.vue'
new Vue({
el: '.applications-list',
render: h => h(App)
});
\ No newline at end of file
<template>
<div class="instances-list">
<div v-for="item in statusGroups" :key="item.status"
class="instances-list__status-section">
<h3 v-text="item.status"></h3>
<div v-for="group in item.groups" :key="group.name"
class="instances-list__group">
<span v-text="group.name"></span>
<span v-if="group.versions.length === 1" v-text="group.versions[0]"></span>
<span v-else-if="group.versions.length > 1">{{group.versions.length}} different versions</span>
<span v-text="group.status"></span>
<span v-text="group.statusTimestamp"></span>
</div>
</div>
</div>
</template>
<script>
import instances from '../../services/instances'
import * as _ from 'lodash';
export default {
data: () => ({
groups: [],
errors: [],
}),
computed: {
statusGroups() {
const byStatus = _.groupBy(this.groups, group => group.status);
const list = _.transform(byStatus, (result, value, key) => {
result.push({status: key, groups: value})
}, []);
return _.sortBy(list, [item => item.status]);
}
},
async created() {
try {
this.groups = await instances.getGroups();
} catch (e) {
this.errors.push(e);
}
}
}
</script>
<style lang="scss">
.instances-list {
&__status-section {
}
&__group {
}
}
</style>
/*
* Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import axios from 'axios';
export default {
async getGroups() {
const res = await axios.get("applications/groups");
return res.data;
}
}
\ No newline at end of file
......@@ -25,8 +25,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.web.util.UriComponentsBuilder;
import static org.apache.commons.lang.StringUtils.defaultIfEmpty;
import static org.apache.commons.lang.StringUtils.stripStart;
import static org.springframework.util.StringUtils.isEmpty;
/**
* Converts any {@link ServiceInstance}s to {@link Instance}s. To customize the health- or
......@@ -79,29 +78,36 @@ public class DefaultServiceInstanceConverter implements ServiceInstanceConverter
}
protected URI getHealthUrl(ServiceInstance instance) {
String healthPath = defaultIfEmpty(instance.getMetadata().get(KEY_HEALTH_PATH), healthEndpointPath);
healthPath = stripStart(healthPath, "/");
String healthPath = instance.getMetadata().get(KEY_HEALTH_PATH);
if (isEmpty(healthPath)) {
healthPath = healthEndpointPath;
}
return UriComponentsBuilder.fromUri(getManagementUrl(instance)).pathSegment(healthPath).build().toUri();
return UriComponentsBuilder.fromUri(getManagementUrl(instance)).path("/").path(healthPath).build().toUri();
}
protected URI getManagementUrl(ServiceInstance instance) {
String managamentPath = defaultIfEmpty(instance.getMetadata().get(KEY_MANAGEMENT_PATH), managementContextPath);
managamentPath = stripStart(managamentPath, "/");
String managamentPath = instance.getMetadata().get(KEY_MANAGEMENT_PATH);
if (isEmpty(managamentPath)) {
managamentPath = managementContextPath;
}
URI serviceUrl = getServiceUrl(instance);
String managamentPort = defaultIfEmpty(instance.getMetadata().get(KEY_MANAGEMENT_PORT),
String.valueOf(serviceUrl.getPort()));
String managamentPort = instance.getMetadata().get(KEY_MANAGEMENT_PORT);
if (isEmpty(managamentPort)) {
managamentPort = String.valueOf(serviceUrl.getPort());
}
return UriComponentsBuilder.fromUri(serviceUrl)
.port(managamentPort)
.pathSegment(managamentPath)
.path("/")
.path(managamentPath)
.build()
.toUri();
}
protected URI getServiceUrl(ServiceInstance instance) {
return instance.getUri();
return UriComponentsBuilder.fromUri(instance.getUri()).path("/").build().toUri();
}
protected Map<String, String> getMetadata(ServiceInstance instance) {
......
......@@ -34,8 +34,8 @@ public class DefaultServiceInstanceConverterTest {
Registration registration = new DefaultServiceInstanceConverter().convert(service);
assertThat(registration.getName()).isEqualTo("test");
assertThat(registration.getServiceUrl()).isEqualTo("http://localhost:80");
assertThat(registration.getManagementUrl()).isEqualTo("http://localhost:80");
assertThat(registration.getServiceUrl()).isEqualTo("http://localhost:80/");
assertThat(registration.getManagementUrl()).isEqualTo("http://localhost:80/");
assertThat(registration.getHealthUrl()).isEqualTo("http://localhost:80/health");
}
......@@ -49,7 +49,7 @@ public class DefaultServiceInstanceConverterTest {
Registration registration = converter.convert(service);
assertThat(registration.getName()).isEqualTo("test");
assertThat(registration.getServiceUrl()).isEqualTo("http://localhost:80");
assertThat(registration.getServiceUrl()).isEqualTo("http://localhost:80/");
assertThat(registration.getManagementUrl()).isEqualTo("http://localhost:80/mgmt");
assertThat(registration.getHealthUrl()).isEqualTo("http://localhost:80/mgmt/ping");
}
......@@ -66,7 +66,7 @@ public class DefaultServiceInstanceConverterTest {
Registration registration = new DefaultServiceInstanceConverter().convert(service);
assertThat(registration.getName()).isEqualTo("test");
assertThat(registration.getServiceUrl()).isEqualTo("http://localhost:80");
assertThat(registration.getServiceUrl()).isEqualTo("http://localhost:80/");
assertThat(registration.getManagementUrl()).isEqualTo("http://localhost:1234/mgmt");
assertThat(registration.getHealthUrl()).isEqualTo("http://localhost:1234/mgmt/ping");
assertThat(registration.getMetadata()).isEqualTo(metadata);
......
......@@ -44,7 +44,7 @@ public class EurekaServiceInstanceConverterTest {
Registration registration = new EurekaServiceInstanceConverter().convert(service);
assertThat(registration.getName()).isEqualTo("test");
assertThat(registration.getServiceUrl()).isEqualTo("http://localhost:80");
assertThat(registration.getServiceUrl()).isEqualTo("http://localhost:80/");
assertThat(registration.getManagementUrl()).isEqualTo("http://localhost:80/mgmt");
assertThat(registration.getHealthUrl()).isEqualTo("http://localhost:80/mgmt/ping");
}
......@@ -60,7 +60,7 @@ public class EurekaServiceInstanceConverterTest {
Registration registration = new EurekaServiceInstanceConverter().convert(service);
assertThat(registration.getManagementUrl()).isEqualTo("http://localhost:80");
assertThat(registration.getManagementUrl()).isEqualTo("http://localhost:80/");
}
@Test
......
......@@ -149,8 +149,8 @@ public class InstanceDiscoveryListenerTest {
StepVerifier.create(registry.getInstances()).assertNext(application -> {
Registration registration = application.getRegistration();
assertThat(registration.getHealthUrl()).isEqualTo("http://localhost:80/health");
assertThat(registration.getManagementUrl()).isEqualTo("http://localhost:80");
assertThat(registration.getServiceUrl()).isEqualTo("http://localhost:80");
assertThat(registration.getManagementUrl()).isEqualTo("http://localhost:80/");
assertThat(registration.getServiceUrl()).isEqualTo("http://localhost:80/");
assertThat(registration.getName()).isEqualTo("service");
}).verifyComplete();
......
......@@ -84,7 +84,7 @@ public class DefaultApplicationFactoryTest {
}
@Test
public void test_ssl_managment() {
public void test_ssl_management() {
management.setSsl(new Ssl());
management.getSsl().setEnabled(true);
publishApplicationReadyEvent(factory, 8080, 9090);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment