Browse Source

docker打包和容器编排

gaodm 6 years ago
parent
commit
2bd45716bc

+ 4 - 2
admin-service/src/main/resources/bootstrap.yml

@@ -3,10 +3,12 @@ spring:
     name: admin-service
     name: admin-service
   cloud:
   cloud:
     config:
     config:
-      uri: http://localhost:8769
+      uri: http://${myuri}:8769
       fail-fast: true
       fail-fast: true
   profiles:
   profiles:
-    active: local
+      active: local
+
+myuri: localhost
 
 
 
 
 
 

+ 4 - 2
bi-service/src/main/resources/bootstrap.yml

@@ -3,7 +3,9 @@ spring:
     name: bi-service
     name: bi-service
   cloud:
   cloud:
     config:
     config:
-      uri: http://localhost:8769
+      uri: http://${myuri}:8769
       fail-fast: true
       fail-fast: true
   profiles:
   profiles:
-    active: local
+      active: local
+
+myuri: localhost

+ 5 - 0
config-server/pom.xml

@@ -36,6 +36,11 @@
             <groupId>org.springframework.cloud</groupId>
             <groupId>org.springframework.cloud</groupId>
             <artifactId>spring-cloud-starter-bus-amqp</artifactId>
             <artifactId>spring-cloud-starter-bus-amqp</artifactId>
         </dependency>
         </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
+        </dependency>
+
 
 
 
 
         <dependency>
         <dependency>

+ 2 - 0
config-server/src/main/java/com/diagbot/ConfigServerApplication.java

@@ -3,6 +3,7 @@ package com.diagbot;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.cloud.config.server.EnableConfigServer;
 import org.springframework.cloud.config.server.EnableConfigServer;
+import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
 
 
 /**
 /**
  * @Description: 配置中心启动文件
  * @Description: 配置中心启动文件
@@ -11,6 +12,7 @@ import org.springframework.cloud.config.server.EnableConfigServer;
  */
  */
 @SpringBootApplication
 @SpringBootApplication
 @EnableConfigServer
 @EnableConfigServer
+@EnableEurekaClient
 public class ConfigServerApplication {
 public class ConfigServerApplication {
 
 
     public static void main(String[] args) {
     public static void main(String[] args) {

+ 6 - 0
config-server/src/main/resources/application.yml

@@ -26,9 +26,15 @@ spring:
 server:
 server:
   port: 8769
   port: 8769
 
 
+eureka:
+  client:
+    serviceUrl:
+      defaultZone: http://${myuri}:8761/eureka/
+
 management:
 management:
   security:
   security:
     enabled: false
     enabled: false
 
 
+myuri: localhost
 
 
 
 

+ 4 - 2
diagbotman-service/src/main/resources/bootstrap.yml

@@ -3,7 +3,9 @@ spring:
     name: diagbotman-service
     name: diagbotman-service
   cloud:
   cloud:
     config:
     config:
-      uri: http://localhost:8769
+      uri: http://${myuri}:8769
       fail-fast: true
       fail-fast: true
   profiles:
   profiles:
-    active: local
+      active: local
+
+myuri: localhost

+ 7 - 1
docker-compose.yml

@@ -18,6 +18,7 @@ services:
 #      - "data/diagbotcloud/logs:/logs"
 #      - "data/diagbotcloud/logs:/logs"
     environment:
     environment:
       - spring.profiles.active=dev
       - spring.profiles.active=dev
+      - myuri=eureka1
   uaa-service:
   uaa-service:
     image: 192.168.2.236:5000/diagbotcloud/uaa-service:0.0.1-SNAPSHOT
     image: 192.168.2.236:5000/diagbotcloud/uaa-service:0.0.1-SNAPSHOT
     depends_on:
     depends_on:
@@ -26,6 +27,7 @@ services:
 #      - "data/diagbotcloud/logs:/logs"
 #      - "data/diagbotcloud/logs:/logs"
     environment:
     environment:
       - spring.profiles.active=dev
       - spring.profiles.active=dev
+      - myuri=config1
   user-service:
   user-service:
     image: 192.168.2.236:5000/diagbotcloud/user-service:0.0.1-SNAPSHOT
     image: 192.168.2.236:5000/diagbotcloud/user-service:0.0.1-SNAPSHOT
     depends_on:
     depends_on:
@@ -34,6 +36,7 @@ services:
 #      - "data/diagbotcloud/logs:/logs"
 #      - "data/diagbotcloud/logs:/logs"
     environment:
     environment:
       - spring.profiles.active=dev
       - spring.profiles.active=dev
+      - myuri=config1
   log-service:
   log-service:
     image: 192.168.2.236:5000/diagbotcloud/log-service:0.0.1-SNAPSHOT
     image: 192.168.2.236:5000/diagbotcloud/log-service:0.0.1-SNAPSHOT
     depends_on:
     depends_on:
@@ -54,6 +57,7 @@ services:
       - "8766:8766"
       - "8766:8766"
     environment:
     environment:
       - spring.profiles.active=dev
       - spring.profiles.active=dev
+      - myuri=config1
   admin-service:
   admin-service:
     image: 192.168.2.236:5000/diagbotcloud/admin-service:0.0.1-SNAPSHOT
     image: 192.168.2.236:5000/diagbotcloud/admin-service:0.0.1-SNAPSHOT
     depends_on:
     depends_on:
@@ -64,6 +68,7 @@ services:
       - "9998:9998"
       - "9998:9998"
     environment:
     environment:
       - spring.profiles.active=dev
       - spring.profiles.active=dev
+      - myuri=config1
   gateway-service:
   gateway-service:
     image: 192.168.2.236:5000/diagbotcloud/gateway-service:0.0.1-SNAPSHOT
     image: 192.168.2.236:5000/diagbotcloud/gateway-service:0.0.1-SNAPSHOT
     depends_on:
     depends_on:
@@ -73,4 +78,5 @@ services:
     ports:
     ports:
       - "5050:5050"
       - "5050:5050"
     environment:
     environment:
-      - spring.profiles.active=dev
+      - spring.profiles.active=dev
+      - myuri=config1

+ 0 - 7
eureka-server/src/main/resources/bootstrap.yml

@@ -1,10 +1,3 @@
 spring:
 spring:
   profiles:
   profiles:
     active: local
     active: local
-
-
-
-
-
-
-

+ 4 - 2
feedback-service/src/main/resources/bootstrap.yml

@@ -3,7 +3,9 @@ spring:
     name: feedback-service
     name: feedback-service
   cloud:
   cloud:
     config:
     config:
-      uri: http://localhost:8769
+      uri: http://${myuri}:8769
       fail-fast: true
       fail-fast: true
   profiles:
   profiles:
-    active: local
+      active: local
+
+myuri: localhost

+ 4 - 2
gateway-service/src/main/resources/bootstrap.yml

@@ -3,10 +3,12 @@ spring:
     name: gateway-service
     name: gateway-service
   cloud:
   cloud:
     config:
     config:
-      uri: http://localhost:8769
+      uri: http://${myuri}:8769
       fail-fast: true
       fail-fast: true
   profiles:
   profiles:
-    active: local
+      active: local
+
+myuri: localhost
 
 
 
 
 
 

+ 4 - 2
knowledge-service/src/main/resources/bootstrap.yml

@@ -3,7 +3,9 @@ spring:
     name: knowledge-service
     name: knowledge-service
   cloud:
   cloud:
     config:
     config:
-      uri: http://localhost:8769
+      uri: http://${myuri}:8769
       fail-fast: true
       fail-fast: true
   profiles:
   profiles:
-    active: local
+      active: local
+
+myuri: localhost

+ 4 - 2
log-service/src/main/resources/bootstrap.yml

@@ -3,7 +3,9 @@ spring:
     name: logger-service
     name: logger-service
   cloud:
   cloud:
     config:
     config:
-      uri: http://localhost:8769
+      uri: http://${myuri}:8769
       fail-fast: true
       fail-fast: true
   profiles:
   profiles:
-    active: local
+      active: local
+
+myuri: localhost

+ 4 - 2
monitor-service/src/main/resources/bootstrap.yml

@@ -3,7 +3,9 @@ spring:
     name: monitor-service
     name: monitor-service
   cloud:
   cloud:
     config:
     config:
-      uri: http://localhost:8769
+      uri: http://${myuri}:8769
       fail-fast: true
       fail-fast: true
   profiles:
   profiles:
-      active: local
+      active: local
+
+myuri: localhost

+ 4 - 1
uaa-service/src/main/resources/bootstrap.yml

@@ -3,10 +3,13 @@ spring:
     name: uaa-service
     name: uaa-service
   cloud:
   cloud:
     config:
     config:
-      uri: http://localhost:8769
+      uri: http://${myuri}:8769
       fail-fast: true
       fail-fast: true
   profiles:
   profiles:
       active: local
       active: local
+
+myuri: localhost
+
 management:
 management:
   security:
   security:
     enabled: false
     enabled: false

+ 4 - 2
user-service/src/main/resources/bootstrap.yml

@@ -3,7 +3,9 @@ spring:
     name: user-service
     name: user-service
   cloud:
   cloud:
     config:
     config:
-      uri: http://localhost:8769
+      uri: http://${myuri}:8769
       fail-fast: true
       fail-fast: true
   profiles:
   profiles:
-    active: local
+      active: local
+
+myuri: localhost