From 982180998c9b4069330bf3aa37db2b5b70e49403 Mon Sep 17 00:00:00 2001 From: zhangxd1989 Date: Wed, 21 Jun 2017 18:47:11 +0800 Subject: [PATCH 01/10] add consul --- auth-service/pom.xml | 2 +- config-repo/application.yml | 14 +++--- config-repo/auth-service.yml | 12 ++--- config-repo/svca-service.yml | 10 ++-- config-repo/svcb-service.yml | 10 ++-- config/pom.xml | 2 +- config/src/main/resources/application.yml | 17 +++---- docker-compose.yml | 16 +++--- gateway/pom.xml | 2 +- monitor/pom.xml | 2 +- monitor/src/main/resources/application.yml | 17 +++---- pom.xml | 3 +- registry/Dockerfile | 6 --- registry/pom.xml | 42 ---------------- .../zhangxd/registry/RegistryApplication.java | 14 ------ registry/src/main/resources/application.yml | 17 ------- registry/src/main/resources/bootstrap.yml | 3 -- .../cn/zhangxd/registry/ApplicationTests.java | 49 ------------------- svca-service/pom.xml | 2 +- svcb-service/pom.xml | 2 +- 20 files changed, 50 insertions(+), 192 deletions(-) delete mode 100644 registry/Dockerfile delete mode 100644 registry/pom.xml delete mode 100644 registry/src/main/java/cn/zhangxd/registry/RegistryApplication.java delete mode 100644 registry/src/main/resources/application.yml delete mode 100644 registry/src/main/resources/bootstrap.yml delete mode 100644 registry/src/test/java/cn/zhangxd/registry/ApplicationTests.java diff --git a/auth-service/pom.xml b/auth-service/pom.xml index 2b317b0e..cfa31333 100644 --- a/auth-service/pom.xml +++ b/auth-service/pom.xml @@ -33,7 +33,7 @@ org.springframework.cloud - spring-cloud-starter-eureka + spring-cloud-starter-consul-all diff --git a/config-repo/application.yml b/config-repo/application.yml index fffb14a5..7f9f14e8 100644 --- a/config-repo/application.yml +++ b/config-repo/application.yml @@ -1,11 +1,3 @@ -eureka: - instance: - hostname: registry - prefer-ip-address: true - client: - service-url: - defaultZone: http://user:${REGISTRY_SERVER_PASSWORD:password}@registry:8761/eureka/ - hystrix: command: default: @@ -19,6 +11,12 @@ ribbon: ConnectTimeout: 5000 spring: + cloud: + consul: + discovery: + prefer-ip-address: true + host: registry + port: 8500 rabbitmq: host: rabbitmq sleuth: diff --git a/config-repo/auth-service.yml b/config-repo/auth-service.yml index 63d49110..b78c921a 100644 --- a/config-repo/auth-service.yml +++ b/config-repo/auth-service.yml @@ -7,12 +7,12 @@ management: enabled: false context-path: /mgmt -eureka: - instance: - health-check-url-path: ${server.context-path}${management.context-path}/health - status-page-url-path: ${server.context-path}${management.context-path}/info - metadata-map: - management.context-path: ${server.context-path}${management.context-path} +#eureka: +# instance: +# health-check-url-path: ${server.context-path}${management.context-path}/health +# status-page-url-path: ${server.context-path}${management.context-path}/info +# metadata-map: +# management.context-path: ${server.context-path}${management.context-path} spring: datasource: diff --git a/config-repo/svca-service.yml b/config-repo/svca-service.yml index aee0998d..0332fe6d 100644 --- a/config-repo/svca-service.yml +++ b/config-repo/svca-service.yml @@ -3,11 +3,11 @@ server: name: zhangxd -eureka: - instance: - metadata-map: - user.name: ${security.user.name} - user.password: ${security.user.password} +#eureka: +# instance: +# metadata-map: +# user.name: ${security.user.name} +# user.password: ${security.user.password} security: user: diff --git a/config-repo/svcb-service.yml b/config-repo/svcb-service.yml index 337fca95..372710b4 100644 --- a/config-repo/svcb-service.yml +++ b/config-repo/svcb-service.yml @@ -3,11 +3,11 @@ server: msg: Hello -eureka: - instance: - metadata-map: - user.name: ${security.user.name} - user.password: ${security.user.password} +#eureka: +# instance: +# metadata-map: +# user.name: ${security.user.name} +# user.password: ${security.user.password} security: user: diff --git a/config/pom.xml b/config/pom.xml index 3cc4574c..3ec4e5e3 100644 --- a/config/pom.xml +++ b/config/pom.xml @@ -30,7 +30,7 @@ org.springframework.cloud - spring-cloud-starter-eureka + spring-cloud-starter-consul-all org.springframework.boot diff --git a/config/src/main/resources/application.yml b/config/src/main/resources/application.yml index 373c2a87..3f2a2bec 100644 --- a/config/src/main/resources/application.yml +++ b/config/src/main/resources/application.yml @@ -1,24 +1,19 @@ server: port: 8888 -eureka: - instance: - hostname: registry - prefer-ip-address: true - metadata-map: - user.name: ${security.user.name} - user.password: ${security.user.password} - client: - service-url: - defaultZone: http://user:${REGISTRY_SERVER_PASSWORD:password}@registry:8761/eureka/ - spring: cloud: + consul: + discovery: + prefer-ip-address: true + host: registry + port: 8500 config: server: git: uri: https://github.com/zhangxd1989/spring-boot-cloud search-paths: config-repo + default-label: consul rabbitmq: host: rabbitmq diff --git a/docker-compose.yml b/docker-compose.yml index ab328554..2b22f866 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,14 +1,16 @@ version: '2' services: rabbitmq: - image: rabbitmq:3-management - restart: always - ports: - - 15673:15672 - registry: - image: spring-boot-cloud/registry + image: rabbitmq:3-management + restart: always ports: - - "8761:8761" + - "15673:15672" + consul: + image: consul + ports: + - "8400:8400" + - "8500:8500" + - "8600:8600" config: image: spring-boot-cloud/config ports: diff --git a/gateway/pom.xml b/gateway/pom.xml index dc76a1ec..1313adc7 100644 --- a/gateway/pom.xml +++ b/gateway/pom.xml @@ -26,7 +26,7 @@ org.springframework.cloud - spring-cloud-starter-eureka + spring-cloud-starter-consul-all org.springframework.cloud diff --git a/monitor/pom.xml b/monitor/pom.xml index 95d434bf..507cf619 100644 --- a/monitor/pom.xml +++ b/monitor/pom.xml @@ -56,7 +56,7 @@ org.springframework.cloud - spring-cloud-starter-eureka + spring-cloud-starter-consul-all org.springframework.boot diff --git a/monitor/src/main/resources/application.yml b/monitor/src/main/resources/application.yml index f4b16fd2..b7408294 100644 --- a/monitor/src/main/resources/application.yml +++ b/monitor/src/main/resources/application.yml @@ -9,18 +9,13 @@ turbine: stream: port: 8041 -eureka: - instance: - hostname: registry - prefer-ip-address: true - metadata-map: - user.name: ${security.user.name} - user.password: ${security.user.password} - client: - service-url: - defaultZone: http://user:${REGISTRY_SERVER_PASSWORD:password}@registry:8761/eureka/ - spring: + cloud: + consul: + discovery: + prefer-ip-address: true + host: registry + port: 8500 rabbitmq: host: rabbitmq boot: diff --git a/pom.xml b/pom.xml index 9e5de967..644b1e6d 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,6 @@ config - registry gateway monitor auth-service @@ -33,7 +32,7 @@ 1.8 0.4.13 spring-boot-cloud - Dalston.RELEASE + Dalston.SR1 1.5.0 diff --git a/registry/Dockerfile b/registry/Dockerfile deleted file mode 100644 index 9a6f58f1..00000000 --- a/registry/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM java:8 -VOLUME /tmp -ADD ./target/registry.jar /app.jar -RUN bash -c 'touch /app.jar' -EXPOSE 8761 -ENTRYPOINT ["java","-jar","/app.jar"] \ No newline at end of file diff --git a/registry/pom.xml b/registry/pom.xml deleted file mode 100644 index 8c62482b..00000000 --- a/registry/pom.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - 4.0.0 - - - cn.zhangxd - spring-boot-cloud - 1.0-SNAPSHOT - - - registry - 1.0-SNAPSHOT - jar - ${project.artifactId} - - - - org.springframework.cloud - spring-cloud-starter-eureka-server - - - org.springframework.boot - spring-boot-starter-security - - - - - ${project.artifactId} - - - org.springframework.boot - spring-boot-maven-plugin - - - com.spotify - docker-maven-plugin - - - - \ No newline at end of file diff --git a/registry/src/main/java/cn/zhangxd/registry/RegistryApplication.java b/registry/src/main/java/cn/zhangxd/registry/RegistryApplication.java deleted file mode 100644 index a3b9e847..00000000 --- a/registry/src/main/java/cn/zhangxd/registry/RegistryApplication.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.zhangxd.registry; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; - -@SpringBootApplication -@EnableEurekaServer -public class RegistryApplication { - - public static void main(String[] args) { - SpringApplication.run(RegistryApplication.class, args); - } -} diff --git a/registry/src/main/resources/application.yml b/registry/src/main/resources/application.yml deleted file mode 100644 index 4927b884..00000000 --- a/registry/src/main/resources/application.yml +++ /dev/null @@ -1,17 +0,0 @@ -server: - port: 8761 - -eureka: - instance: - hostname: registry - prefer-ip-address: true - client: - registerWithEureka: false - fetchRegistry: false - service-url: - defaultZone: http://${security.user.name}:${security.user.password}@${eureka.instance.hostname}:${server.port}/eureka/ - -security: - user: - name: user - password: ${REGISTRY_SERVER_PASSWORD:password} diff --git a/registry/src/main/resources/bootstrap.yml b/registry/src/main/resources/bootstrap.yml deleted file mode 100644 index a65daee8..00000000 --- a/registry/src/main/resources/bootstrap.yml +++ /dev/null @@ -1,3 +0,0 @@ -spring: - application: - name: registry \ No newline at end of file diff --git a/registry/src/test/java/cn/zhangxd/registry/ApplicationTests.java b/registry/src/test/java/cn/zhangxd/registry/ApplicationTests.java deleted file mode 100644 index 369fd5e3..00000000 --- a/registry/src/test/java/cn/zhangxd/registry/ApplicationTests.java +++ /dev/null @@ -1,49 +0,0 @@ -package cn.zhangxd.registry; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT; - -@RunWith(SpringJUnit4ClassRunner.class) -@SpringBootTest(webEnvironment = RANDOM_PORT) -public class ApplicationTests { - - @Autowired - private TestRestTemplate testRestTemplate; - @Value("${security.user.name}") - private String username; - @Value("${security.user.password}") - private String password; - - @Test - public void catalogLoads() { - @SuppressWarnings("rawtypes") - ResponseEntity entity = - testRestTemplate - .withBasicAuth(username, password) - .getForEntity("/eureka/apps", Map.class); - assertEquals(HttpStatus.OK, entity.getStatusCode()); - } - - @Test - public void adminLoads() { - @SuppressWarnings("rawtypes") - ResponseEntity entity = - testRestTemplate - .withBasicAuth(username, password) - .getForEntity("/env", Map.class); - assertEquals(HttpStatus.OK, entity.getStatusCode()); - } - -} \ No newline at end of file diff --git a/svca-service/pom.xml b/svca-service/pom.xml index 4924cd65..23ed0d76 100644 --- a/svca-service/pom.xml +++ b/svca-service/pom.xml @@ -23,7 +23,7 @@ org.springframework.cloud - spring-cloud-starter-eureka + spring-cloud-starter-consul-all diff --git a/svcb-service/pom.xml b/svcb-service/pom.xml index a11c72a2..9ae9ece5 100644 --- a/svcb-service/pom.xml +++ b/svcb-service/pom.xml @@ -23,7 +23,7 @@ org.springframework.cloud - spring-cloud-starter-eureka + spring-cloud-starter-consul-all From 4b1557e082cfced66657775b5849a8efd5989452 Mon Sep 17 00:00:00 2001 From: zhangxd1989 Date: Thu, 22 Jun 2017 12:27:55 +0800 Subject: [PATCH 02/10] add consul --- config-repo/auth-service.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config-repo/auth-service.yml b/config-repo/auth-service.yml index b78c921a..b97c966b 100644 --- a/config-repo/auth-service.yml +++ b/config-repo/auth-service.yml @@ -15,6 +15,11 @@ management: # management.context-path: ${server.context-path}${management.context-path} spring: + cloud: + consul: + discovery: + health-check-path: ${server.context-path}${management.context-path}/health + tags: management.context-path=${server.context-path}${management.context-path} datasource: url: jdbc:h2:mem:user driver-class-name: org.h2.Driver From 7e02d8a5507483612298053d28915b556d67ccf1 Mon Sep 17 00:00:00 2001 From: zhangxd1989 Date: Thu, 22 Jun 2017 13:04:55 +0800 Subject: [PATCH 03/10] add consul --- config-repo/auth-service.yml | 7 ------- config-repo/svca-service.yml | 10 +++++----- config-repo/svcb-service.yml | 10 +++++----- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/config-repo/auth-service.yml b/config-repo/auth-service.yml index b97c966b..f36efea6 100644 --- a/config-repo/auth-service.yml +++ b/config-repo/auth-service.yml @@ -7,13 +7,6 @@ management: enabled: false context-path: /mgmt -#eureka: -# instance: -# health-check-url-path: ${server.context-path}${management.context-path}/health -# status-page-url-path: ${server.context-path}${management.context-path}/info -# metadata-map: -# management.context-path: ${server.context-path}${management.context-path} - spring: cloud: consul: diff --git a/config-repo/svca-service.yml b/config-repo/svca-service.yml index 0332fe6d..dc0e009b 100644 --- a/config-repo/svca-service.yml +++ b/config-repo/svca-service.yml @@ -3,11 +3,11 @@ server: name: zhangxd -#eureka: -# instance: -# metadata-map: -# user.name: ${security.user.name} -# user.password: ${security.user.password} +spring: + cloud: + consul: + discovery: + tags: user.name=${security.user.name}, user.password=${security.user.password} security: user: diff --git a/config-repo/svcb-service.yml b/config-repo/svcb-service.yml index 372710b4..e3dc5e51 100644 --- a/config-repo/svcb-service.yml +++ b/config-repo/svcb-service.yml @@ -3,11 +3,11 @@ server: msg: Hello -#eureka: -# instance: -# metadata-map: -# user.name: ${security.user.name} -# user.password: ${security.user.password} +spring: + cloud: + consul: + discovery: + tags: user.name=${security.user.name}, user.password=${security.user.password} security: user: From 59c48ca53113be6ba21ae6230b488814cb29dc12 Mon Sep 17 00:00:00 2001 From: zhangxd1989 Date: Thu, 22 Jun 2017 13:12:51 +0800 Subject: [PATCH 04/10] add consul --- auth-service/pom.xml | 2 +- config/pom.xml | 2 +- gateway/pom.xml | 2 +- monitor/pom.xml | 6 +++++- monitor/src/main/resources/application.yml | 3 +++ svca-service/pom.xml | 2 +- .../java/cn/zhangxd/svca/controller/ServiceAController.java | 5 +++-- svcb-service/pom.xml | 2 +- .../java/cn/zhangxd/svcb/controller/ServiceBController.java | 4 ++-- 9 files changed, 18 insertions(+), 10 deletions(-) diff --git a/auth-service/pom.xml b/auth-service/pom.xml index cfa31333..e2f71e90 100644 --- a/auth-service/pom.xml +++ b/auth-service/pom.xml @@ -33,7 +33,7 @@ org.springframework.cloud - spring-cloud-starter-consul-all + spring-cloud-starter-consul-discovery diff --git a/config/pom.xml b/config/pom.xml index 3ec4e5e3..d1594395 100644 --- a/config/pom.xml +++ b/config/pom.xml @@ -30,7 +30,7 @@ org.springframework.cloud - spring-cloud-starter-consul-all + spring-cloud-starter-consul-discovery org.springframework.boot diff --git a/gateway/pom.xml b/gateway/pom.xml index 1313adc7..bc123f1c 100644 --- a/gateway/pom.xml +++ b/gateway/pom.xml @@ -26,7 +26,7 @@ org.springframework.cloud - spring-cloud-starter-consul-all + spring-cloud-starter-consul-discovery org.springframework.cloud diff --git a/monitor/pom.xml b/monitor/pom.xml index 507cf619..f9859b35 100644 --- a/monitor/pom.xml +++ b/monitor/pom.xml @@ -40,6 +40,10 @@ org.springframework.cloud spring-cloud-starter-turbine-stream + + org.springframework.cloud + spring-cloud-starter-eureka + netty-transport-native-epoll io.netty @@ -56,7 +60,7 @@ org.springframework.cloud - spring-cloud-starter-consul-all + spring-cloud-starter-consul-discovery org.springframework.boot diff --git a/monitor/src/main/resources/application.yml b/monitor/src/main/resources/application.yml index b7408294..c51e5c67 100644 --- a/monitor/src/main/resources/application.yml +++ b/monitor/src/main/resources/application.yml @@ -14,6 +14,7 @@ spring: consul: discovery: prefer-ip-address: true + tags: user.name=${security.user.name}, user.password=${security.user.password} host: registry port: 8500 rabbitmq: @@ -25,6 +26,8 @@ spring: turbine: clusters: default location: http://monitor:${turbine.stream.port} + discovery: + ignored-services: consul security: user: diff --git a/svca-service/pom.xml b/svca-service/pom.xml index 23ed0d76..539cccfc 100644 --- a/svca-service/pom.xml +++ b/svca-service/pom.xml @@ -23,7 +23,7 @@ org.springframework.cloud - spring-cloud-starter-consul-all + spring-cloud-starter-consul-discovery diff --git a/svca-service/src/main/java/cn/zhangxd/svca/controller/ServiceAController.java b/svca-service/src/main/java/cn/zhangxd/svca/controller/ServiceAController.java index 5ca6c56a..99e13d72 100644 --- a/svca-service/src/main/java/cn/zhangxd/svca/controller/ServiceAController.java +++ b/svca-service/src/main/java/cn/zhangxd/svca/controller/ServiceAController.java @@ -4,8 +4,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.cloud.client.ServiceInstance; +import org.springframework.cloud.consul.discovery.ConsulDiscoveryClient; import org.springframework.cloud.context.config.annotation.RefreshScope; -import org.springframework.cloud.netflix.eureka.EurekaDiscoveryClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @@ -19,7 +19,8 @@ public class ServiceAController { private String name; @Autowired - EurekaDiscoveryClient discoveryClient; + ConsulDiscoveryClient discoveryClient; + @Autowired private ServiceBClient serviceBClient; diff --git a/svcb-service/pom.xml b/svcb-service/pom.xml index 9ae9ece5..918959bd 100644 --- a/svcb-service/pom.xml +++ b/svcb-service/pom.xml @@ -23,7 +23,7 @@ org.springframework.cloud - spring-cloud-starter-consul-all + spring-cloud-starter-consul-discovery diff --git a/svcb-service/src/main/java/cn/zhangxd/svcb/controller/ServiceBController.java b/svcb-service/src/main/java/cn/zhangxd/svcb/controller/ServiceBController.java index 573a8cf4..e8891564 100644 --- a/svcb-service/src/main/java/cn/zhangxd/svcb/controller/ServiceBController.java +++ b/svcb-service/src/main/java/cn/zhangxd/svcb/controller/ServiceBController.java @@ -3,8 +3,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.cloud.client.ServiceInstance; +import org.springframework.cloud.consul.discovery.ConsulDiscoveryClient; import org.springframework.cloud.context.config.annotation.RefreshScope; -import org.springframework.cloud.netflix.eureka.EurekaDiscoveryClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @@ -13,7 +13,7 @@ public class ServiceBController { @Autowired - EurekaDiscoveryClient discoveryClient; + ConsulDiscoveryClient discoveryClient; @Value("${msg:unknown}") private String msg; From d5eef304c4261cc77946a21f6f5416907a8ff33d Mon Sep 17 00:00:00 2001 From: zhangxd1989 Date: Thu, 22 Jun 2017 17:32:25 +0800 Subject: [PATCH 05/10] add consul --- config/src/main/resources/application.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/src/main/resources/application.yml b/config/src/main/resources/application.yml index 3f2a2bec..75eca7c2 100644 --- a/config/src/main/resources/application.yml +++ b/config/src/main/resources/application.yml @@ -6,6 +6,7 @@ spring: consul: discovery: prefer-ip-address: true + instance-id: ${spring.application.name}:comma,separated,profiles:${server.port}:${random.value} host: registry port: 8500 config: From 0bf2864af0114877f39b5e58f36695bc38d1a9f3 Mon Sep 17 00:00:00 2001 From: zhangxd1989 Date: Thu, 22 Jun 2017 17:45:57 +0800 Subject: [PATCH 06/10] add consul --- config-repo/application.yml | 1 + config/src/main/resources/application.yml | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/config-repo/application.yml b/config-repo/application.yml index 7f9f14e8..1db11ceb 100644 --- a/config-repo/application.yml +++ b/config-repo/application.yml @@ -15,6 +15,7 @@ spring: consul: discovery: prefer-ip-address: true + instance-id: ${spring.application.name}:comma,separated,profiles:${server.port}:${random.value} host: registry port: 8500 rabbitmq: diff --git a/config/src/main/resources/application.yml b/config/src/main/resources/application.yml index 75eca7c2..3f2a2bec 100644 --- a/config/src/main/resources/application.yml +++ b/config/src/main/resources/application.yml @@ -6,7 +6,6 @@ spring: consul: discovery: prefer-ip-address: true - instance-id: ${spring.application.name}:comma,separated,profiles:${server.port}:${random.value} host: registry port: 8500 config: From 4b8f381444f17084b24675f8d9cfc88df412de24 Mon Sep 17 00:00:00 2001 From: zhangxd1989 Date: Thu, 22 Jun 2017 17:47:07 +0800 Subject: [PATCH 07/10] add consul --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2b22f866..e6bc539c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: restart: always ports: - "15673:15672" - consul: + registry: image: consul ports: - "8400:8400" From 1511472b7cd56cf96d5a0bca95f18d0fc1c99e9b Mon Sep 17 00:00:00 2001 From: zhangxd1989 Date: Thu, 22 Jun 2017 18:02:00 +0800 Subject: [PATCH 08/10] add consul --- config-repo/application.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config-repo/application.yml b/config-repo/application.yml index 1db11ceb..d64bd8f9 100644 --- a/config-repo/application.yml +++ b/config-repo/application.yml @@ -15,7 +15,7 @@ spring: consul: discovery: prefer-ip-address: true - instance-id: ${spring.application.name}:comma,separated,profiles:${server.port}:${random.value} + instance-id: ${spring.application.name}:${server.port}:${random.value} host: registry port: 8500 rabbitmq: From 0428c520062e9f9d692012f11df723f0a877e6f2 Mon Sep 17 00:00:00 2001 From: zhangxd1989 Date: Thu, 22 Jun 2017 19:26:43 +0800 Subject: [PATCH 09/10] add consul --- config/src/main/resources/application.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/src/main/resources/application.yml b/config/src/main/resources/application.yml index 3f2a2bec..c9333630 100644 --- a/config/src/main/resources/application.yml +++ b/config/src/main/resources/application.yml @@ -6,6 +6,7 @@ spring: consul: discovery: prefer-ip-address: true + tags: user.name=${security.user.name}, user.password=${security.user.password} host: registry port: 8500 config: From 6985e502dbae610b9853dd8e64939bf0701c913a Mon Sep 17 00:00:00 2001 From: zhangxd1989 Date: Fri, 23 Jun 2017 18:20:15 +0800 Subject: [PATCH 10/10] add consul --- config-repo/application.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config-repo/application.yml b/config-repo/application.yml index d64bd8f9..c57b2edf 100644 --- a/config-repo/application.yml +++ b/config-repo/application.yml @@ -29,9 +29,9 @@ spring: skip-pattern: "^org.*HystrixStreamTask$" authserver: - hostname: auth-service - port: 5000 - contextPath: /uaa + hostname: auth-service + port: 5000 + contextPath: /uaa security: oauth2: