From 6005bded4fb3dfeeccc255136a84edd0d0347944 Mon Sep 17 00:00:00 2001 From: buildmaster Date: Thu, 13 Dec 2018 18:39:19 +0000 Subject: [PATCH] Sync docs from master to gh-pages --- .../multi_spring-cloud-consul-discovery.html | 33 ++++++++- multi/multi_spring-cloud-consul.html | 2 +- single/spring-cloud-consul.html | 35 ++++++++- spring-cloud-consul.xml | 72 +++++++++++++++++++ 4 files changed, 138 insertions(+), 4 deletions(-) diff --git a/multi/multi_spring-cloud-consul-discovery.html b/multi/multi_spring-cloud-consul-discovery.html index 7b2f4535..fc7be35d 100644 --- a/multi/multi_spring-cloud-consul-discovery.html +++ b/multi/multi_spring-cloud-consul-discovery.html @@ -19,7 +19,38 @@ consul: host: localhost port: 8500

-

[Caution]Caution

If you use Spring Cloud Consul Config, the above values will need to be placed in bootstrap.yml instead of application.yml.

The default service name, instance id and port, taken from the Environment, are ${spring.application.name}, the Spring Context ID and ${server.port} respectively.

To disable the Consul Discovery Client you can set spring.cloud.consul.discovery.enabled to false.

To disable the service registration you can set spring.cloud.consul.discovery.register to false.

3.3 HTTP Health Check

The health check for a Consul instance defaults to "/health", which is the default locations of a useful endpoint in a Spring Boot Actuator application. You need to change these, even for an Actuator application if you use a non-default context path or servlet path (e.g. server.servletPath=/foo) or management endpoint path (e.g. management.server.servlet.context-path=/admin). The interval that Consul uses to check the health endpoint may also be configured. "10s" and "1m" represent 10 seconds and 1 minute respectively. Example:

application.yml.  +

[Caution]Caution

If you use Spring Cloud Consul Config, the above values will need to be placed in bootstrap.yml instead of application.yml.

The default service name, instance id and port, taken from the Environment, are ${spring.application.name}, the Spring Context ID and ${server.port} respectively.

To disable the Consul Discovery Client you can set spring.cloud.consul.discovery.enabled to false.

To disable the service registration you can set spring.cloud.consul.discovery.register to false.

3.2.1 Registering Management as a Separate Service

When management server port is set to something different than the application port, by setting management.server.port property, management service will be registered as a separate service than the application service. For example:

application.yml.  +

spring:
+  application:
+    name: myApp
+management:
+  server:
+    port: 4452

+

Above configuration will register following 2 services:

  • Application Service:
ID: myApp
+Name: myApp
  • Management Service:
ID: myApp-management
+Name: myApp-management

Management service will inherit its instanceId and serviceName from the application service. For example:

application.yml.  +

spring:
+  application:
+    name: myApp
+management:
+  server:
+    port: 4452
+spring:
+  cloud:
+    consul:
+      discovery:
+        instance-id: custom-service-id
+        serviceName: myprefix-${spring.application.name}

+

Above configuration will register following 2 services:

  • Application Service:
ID: custom-service-id
+Name: myprefix-myApp
  • Management Service:
ID: custom-service-id-management
+Name: myprefix-myApp-management

Further customization is possible via following properties:

/** Port to register the management service under (defaults to management port) */
+spring.cloud.consul.discovery.management-port
+
+/** Suffix to use when registering management service (defaults to "management" */
+spring.cloud.consul.discovery.management-suffix
+
+/** Tags to use when registering management service (defaults to "management" */
+spring.cloud.consul.discovery.management-tags

3.3 HTTP Health Check

The health check for a Consul instance defaults to "/health", which is the default locations of a useful endpoint in a Spring Boot Actuator application. You need to change these, even for an Actuator application if you use a non-default context path or servlet path (e.g. server.servletPath=/foo) or management endpoint path (e.g. management.server.servlet.context-path=/admin). The interval that Consul uses to check the health endpoint may also be configured. "10s" and "1m" represent 10 seconds and 1 minute respectively. Example:

application.yml. 

spring:
   cloud:
     consul:
diff --git a/multi/multi_spring-cloud-consul.html b/multi/multi_spring-cloud-consul.html
index c1a09520..173f48c3 100644
--- a/multi/multi_spring-cloud-consul.html
+++ b/multi/multi_spring-cloud-consul.html
@@ -1,3 +1,3 @@
 
       
-   Spring Cloud Consul
\ No newline at end of file
+   Spring Cloud Consul
\ No newline at end of file
diff --git a/single/spring-cloud-consul.html b/single/spring-cloud-consul.html
index 3d4b511d..77e2d3c4 100644
--- a/single/spring-cloud-consul.html
+++ b/single/spring-cloud-consul.html
@@ -1,6 +1,6 @@
 
       
-   Spring Cloud Consul

Spring Cloud Consul


2.1.0.BUILD-SNAPSHOT

This project provides Consul integrations for Spring Boot apps through autoconfiguration + Spring Cloud Consul

Spring Cloud Consul


2.1.0.BUILD-SNAPSHOT

This project provides Consul integrations for Spring Boot apps through autoconfiguration and binding to the Spring Environment and other Spring programming model idioms. With a few simple annotations you can quickly enable and configure the common patterns inside your application and build large distributed systems with Consul based components. The @@ -25,7 +25,38 @@ Intelligent Routing (Zuul) and Client Side Load Balancing (Ribbon), Circuit Brea consul: host: localhost port: 8500

-

[Caution]Caution

If you use Spring Cloud Consul Config, the above values will need to be placed in bootstrap.yml instead of application.yml.

The default service name, instance id and port, taken from the Environment, are ${spring.application.name}, the Spring Context ID and ${server.port} respectively.

To disable the Consul Discovery Client you can set spring.cloud.consul.discovery.enabled to false.

To disable the service registration you can set spring.cloud.consul.discovery.register to false.

3.3 HTTP Health Check

The health check for a Consul instance defaults to "/health", which is the default locations of a useful endpoint in a Spring Boot Actuator application. You need to change these, even for an Actuator application if you use a non-default context path or servlet path (e.g. server.servletPath=/foo) or management endpoint path (e.g. management.server.servlet.context-path=/admin). The interval that Consul uses to check the health endpoint may also be configured. "10s" and "1m" represent 10 seconds and 1 minute respectively. Example:

application.yml.  +

[Caution]Caution

If you use Spring Cloud Consul Config, the above values will need to be placed in bootstrap.yml instead of application.yml.

The default service name, instance id and port, taken from the Environment, are ${spring.application.name}, the Spring Context ID and ${server.port} respectively.

To disable the Consul Discovery Client you can set spring.cloud.consul.discovery.enabled to false.

To disable the service registration you can set spring.cloud.consul.discovery.register to false.

3.2.1 Registering Management as a Separate Service

When management server port is set to something different than the application port, by setting management.server.port property, management service will be registered as a separate service than the application service. For example:

application.yml.  +

spring:
+  application:
+    name: myApp
+management:
+  server:
+    port: 4452

+

Above configuration will register following 2 services:

  • Application Service:
ID: myApp
+Name: myApp
  • Management Service:
ID: myApp-management
+Name: myApp-management

Management service will inherit its instanceId and serviceName from the application service. For example:

application.yml.  +

spring:
+  application:
+    name: myApp
+management:
+  server:
+    port: 4452
+spring:
+  cloud:
+    consul:
+      discovery:
+        instance-id: custom-service-id
+        serviceName: myprefix-${spring.application.name}

+

Above configuration will register following 2 services:

  • Application Service:
ID: custom-service-id
+Name: myprefix-myApp
  • Management Service:
ID: custom-service-id-management
+Name: myprefix-myApp-management

Further customization is possible via following properties:

/** Port to register the management service under (defaults to management port) */
+spring.cloud.consul.discovery.management-port
+
+/** Suffix to use when registering management service (defaults to "management" */
+spring.cloud.consul.discovery.management-suffix
+
+/** Tags to use when registering management service (defaults to "management" */
+spring.cloud.consul.discovery.management-tags

3.3 HTTP Health Check

The health check for a Consul instance defaults to "/health", which is the default locations of a useful endpoint in a Spring Boot Actuator application. You need to change these, even for an Actuator application if you use a non-default context path or servlet path (e.g. server.servletPath=/foo) or management endpoint path (e.g. management.server.servlet.context-path=/admin). The interval that Consul uses to check the health endpoint may also be configured. "10s" and "1m" represent 10 seconds and 1 minute respectively. Example:

application.yml. 

spring:
   cloud:
     consul:
diff --git a/spring-cloud-consul.xml b/spring-cloud-consul.xml
index 5f2dff8f..e755c51f 100644
--- a/spring-cloud-consul.xml
+++ b/spring-cloud-consul.xml
@@ -69,6 +69,78 @@ public class Application {
 The default service name, instance id and port, taken from the Environment, are ${spring.application.name}, the Spring Context ID and ${server.port} respectively.
 To disable the Consul Discovery Client you can set spring.cloud.consul.discovery.enabled to false.
 To disable the service registration you can set spring.cloud.consul.discovery.register to false.
+
+Registering Management as a Separate Service +When management server port is set to something different than the application port, by setting management.server.port property, management service will be registered as a separate service than the application service. For example: + +application.yml + +spring: + application: + name: myApp +management: + server: + port: 4452 + + +Above configuration will register following 2 services: + + +Application Service: + + +ID: myApp +Name: myApp + + +Management Service: + + +ID: myApp-management +Name: myApp-management +Management service will inherit its instanceId and serviceName from the application service. For example: + +application.yml + +spring: + application: + name: myApp +management: + server: + port: 4452 +spring: + cloud: + consul: + discovery: + instance-id: custom-service-id + serviceName: myprefix-${spring.application.name} + + +Above configuration will register following 2 services: + + +Application Service: + + +ID: custom-service-id +Name: myprefix-myApp + + +Management Service: + + +ID: custom-service-id-management +Name: myprefix-myApp-management +Further customization is possible via following properties: +/** Port to register the management service under (defaults to management port) */ +spring.cloud.consul.discovery.management-port + +/** Suffix to use when registering management service (defaults to "management" */ +spring.cloud.consul.discovery.management-suffix + +/** Tags to use when registering management service (defaults to "management" */ +spring.cloud.consul.discovery.management-tags +
HTTP Health Check