This is an automated email from the ASF dual-hosted git repository.
xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new 6c9e7b2 [Task #2970] Add support multiple microservice yml(#2970)
(#2971)
6c9e7b2 is described below
commit 6c9e7b2a5f1398c36a3b1546315d3a7e9638c679
Author: Lisandro <[email protected]>
AuthorDate: Tue Mar 8 15:27:20 2022 +0800
[Task #2970] Add support multiple microservice yml(#2970) (#2971)
* [Task #2970] Add support multiple microservice yml(#2970)
* [Task #2970] Adjust support multiple microservice dependency.
* [Task #2970] Adjust pom properties version
* [Task #2970] Adjust bootstrap microservice active model.
* [Task #2970] Adjust eureka client pom version.
* [Task #2970] Adjust springcloud test retries times.
* [Task #2970] Adjust test docker-compose start_period.
* [Task #2970] Adjust test docker-compose start_period.
* [Task #2970] Add default profiles active in Dockerfile.
* [Task #2970] Add default profiles active in Dockerfile.
* [Task #2970] Add default profiles active in pom.
* [Task #2970] Add default profiles active in pom.
* [Task #2970] Adjust integrated-test ci config.
* [Task #2970] Adjust integrated-test ci example-springcloud config.
* [Task #2970] fix default profile.
Co-authored-by: lishuo <[email protected]>
---
.github/actions/skip-ci/action.yml | 2 +-
shenyu-bootstrap/pom.xml | 55 +++++++++++++++-------
.../src/main/resources/application-example.yml | 33 -------------
.../src/main/resources/application-nacos.yml | 44 ++---------------
.../src/main/resources/application.yml | 17 ++-----
.../shenyu-examples-springcloud/pom.xml | 33 ++++++++-----
.../{application.yml => application-example.yml} | 33 -------------
.../{application.yml => application-nacos.yml} | 44 ++---------------
.../src/main/resources/application.yml | 16 ++-----
.../docker-compose.yml | 4 +-
10 files changed, 78 insertions(+), 203 deletions(-)
diff --git a/.github/actions/skip-ci/action.yml
b/.github/actions/skip-ci/action.yml
index 272e3ec..3f1f5e3 100644
--- a/.github/actions/skip-ci/action.yml
+++ b/.github/actions/skip-ci/action.yml
@@ -43,7 +43,7 @@ runs:
fi
echo "Base sha is $BASE_SHA, head sha is $GITHUB_SHA"
-
+
if [[ "$BASE_SHA" == "0000000000000000000000000000000000000000" ]];
then
BASE_SHA="master"
fi
diff --git a/shenyu-bootstrap/pom.xml b/shenyu-bootstrap/pom.xml
index 76e0932..e27226e 100644
--- a/shenyu-bootstrap/pom.xml
+++ b/shenyu-bootstrap/pom.xml
@@ -27,6 +27,9 @@
<properties>
<curator.version>4.0.1</curator.version>
+ <spring-cloud.version>2.2.0.RELEASE</spring-cloud.version>
+ <nacos-discovery.version>2.2.6.RELEASE</nacos-discovery.version>
+ <eureka-client.version>2.1.2.RELEASE</eureka-client.version>
</properties>
<dependencies>
@@ -111,6 +114,14 @@
</dependency>
<!-- shenyu redirect plugin end-->
+ <!-- shenyu request plugin start-->
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-plugin-request</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <!-- shenyu request plugin end-->
+
<!--shenyu debug plugin start-->
<dependency>
<groupId>org.apache.shenyu</groupId>
@@ -209,7 +220,6 @@
</exclusion>
</exclusions>
</dependency>
-
<dependency>
<groupId>org.apache.shenyu</groupId>
<artifactId>shenyu-spring-boot-starter-plugin-sofa</artifactId>
@@ -235,20 +245,6 @@
<version>2.2.0.RELEASE</version>
</dependency>
- <!-- springCloud if you config register center is nacos please
dependency this-->
- <dependency>
- <groupId>com.alibaba.cloud</groupId>
-
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
- <version>2.1.0.RELEASE</version>
- </dependency>
-
- <!-- springCloud if you config register center is eureka please
dependency end-->
- <dependency>
- <groupId>org.springframework.cloud</groupId>
- <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
- <version>2.2.0.RELEASE</version>
- </dependency>
- <!--shenyu springCloud plugin start end-->
<!--shenyu apache dubbo plugin start-->
<dependency>
<groupId>org.apache.shenyu</groupId>
@@ -398,7 +394,6 @@
<artifactId>shenyu-spring-boot-starter-sync-data-consul</artifactId>
<version>${project.version}</version>
</dependency>
-
<!--shenyu instance start-->
<dependency>
<groupId>org.apache.shenyu</groupId>
@@ -407,9 +402,34 @@
</dependency>
<!--shenyu instance end-->
</dependencies>
-
<profiles>
<profile>
+ <id>nacos</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.alibaba.cloud</groupId>
+
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
+ <version>${nacos-discovery.version}</version>
+ </dependency>
+ </dependencies>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ </profile>
+ <profile>
+ <id>example</id>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.cloud</groupId>
+
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
+ <version>${eureka-client.version}</version>
+ </dependency>
+ </dependencies>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ </profile>
+ <profile>
<id>release</id>
<build>
<resources>
@@ -424,7 +444,6 @@
</build>
</profile>
</profiles>
-
<build>
<finalName>shenyu-bootstrap</finalName>
<plugins>
diff --git
a/shenyu-examples/shenyu-examples-springcloud/src/main/resources/application.yml
b/shenyu-bootstrap/src/main/resources/application-example.yml
similarity index 58%
copy from
shenyu-examples/shenyu-examples-springcloud/src/main/resources/application.yml
copy to shenyu-bootstrap/src/main/resources/application-example.yml
index 7ed8571..23351e6 100644
---
a/shenyu-examples/shenyu-examples-springcloud/src/main/resources/application.yml
+++ b/shenyu-bootstrap/src/main/resources/application-example.yml
@@ -13,22 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-server:
- port: 8884
- address: 0.0.0.0
-
-spring:
- application:
- name: springCloud-test
-# cloud:
-# nacos:
-# discovery:
-# server-addr: 127.0.0.1:8848
-
-
-springCloud-test:
- ribbon.NFLoadBalancerRuleClassName: com.netflix.loadbalancer.RandomRule
-
eureka:
client:
serviceUrl:
@@ -36,20 +20,3 @@ eureka:
instance:
prefer-ip-address: true
-shenyu:
- register:
- registerType: http #zookeeper #etcd #nacos #consul
- serverLists: http://localhost:9095 #localhost:2181 #http://localhost:2379
#localhost:8848
- props:
- username: admin
- password: 123456
- client:
- springCloud:
- props:
- contextPath: /springcloud
-# port: 8884
-
-logging:
- level:
- root: info
- org.apache.shenyu: debug
diff --git
a/shenyu-examples/shenyu-examples-springcloud/src/main/resources/application.yml
b/shenyu-bootstrap/src/main/resources/application-nacos.yml
similarity index 50%
copy from
shenyu-examples/shenyu-examples-springcloud/src/main/resources/application.yml
copy to shenyu-bootstrap/src/main/resources/application-nacos.yml
index 7ed8571..947d929 100644
---
a/shenyu-examples/shenyu-examples-springcloud/src/main/resources/application.yml
+++ b/shenyu-bootstrap/src/main/resources/application-nacos.yml
@@ -13,43 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-server:
- port: 8884
- address: 0.0.0.0
-
spring:
- application:
- name: springCloud-test
-# cloud:
-# nacos:
-# discovery:
-# server-addr: 127.0.0.1:8848
-
-
-springCloud-test:
- ribbon.NFLoadBalancerRuleClassName: com.netflix.loadbalancer.RandomRule
-
-eureka:
- client:
- serviceUrl:
- defaultZone: http://localhost:8761/eureka/
- instance:
- prefer-ip-address: true
-
-shenyu:
- register:
- registerType: http #zookeeper #etcd #nacos #consul
- serverLists: http://localhost:9095 #localhost:2181 #http://localhost:2379
#localhost:8848
- props:
- username: admin
- password: 123456
- client:
- springCloud:
- props:
- contextPath: /springcloud
-# port: 8884
-
-logging:
- level:
- root: info
- org.apache.shenyu: debug
+ cloud:
+ nacos:
+ discovery:
+ server-addr: 127.0.0.1:8848
+ namespace: SheyuRegisterCenter
diff --git a/shenyu-bootstrap/src/main/resources/application.yml
b/shenyu-bootstrap/src/main/resources/application.yml
index 8f11ddd..08e38fc 100644
--- a/shenyu-bootstrap/src/main/resources/application.yml
+++ b/shenyu-bootstrap/src/main/resources/application.yml
@@ -18,6 +18,8 @@ server:
address: 0.0.0.0
spring:
+ profiles:
+ active: example
main:
allow-bean-definition-overriding: true
application:
@@ -29,11 +31,7 @@ spring:
ribbon:
enabled: false
discovery:
- enabled: false
- nacos:
- discovery:
- server-addr: 127.0.0.1:8848 # Spring Cloud Alibaba Dubbo use this.
- enabled: false
+ enabled: true
# security:
# oauth2:
@@ -195,15 +193,6 @@ shenyu:
enabled: true
sha512Key:
"BA3253876AED6BC22D4A6FF53D8406C6AD864195ED144AB5C87621B6C233B548BAEAE6956DF346EC8C17F5EA10F35EE3CBC514797ED7DDD3145464E2A0BAB413"
-eureka:
- client:
- enabled: false
- serviceUrl:
- defaultZone: http://localhost:8761/eureka/
- instance:
- prefer-ip-address: true
-
-
logging:
level:
root: info
diff --git a/shenyu-examples/shenyu-examples-springcloud/pom.xml
b/shenyu-examples/shenyu-examples-springcloud/pom.xml
index e3146472..0fae1d5 100644
--- a/shenyu-examples/shenyu-examples-springcloud/pom.xml
+++ b/shenyu-examples/shenyu-examples-springcloud/pom.xml
@@ -29,6 +29,8 @@
<properties>
<spring-cloud.version>2.2.0.RELEASE</spring-cloud.version>
+ <nacos-discovery.version>2.2.6.RELEASE</nacos-discovery.version>
+ <eureka-client.version>2.1.2.RELEASE</eureka-client.version>
</properties>
<dependencies>
@@ -53,12 +55,6 @@
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
- <!-- <dependency>
- <groupId>com.alibaba.cloud</groupId>
-
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
- <version>2.4.3-SNAPSHOT.RELEASE</version>
- </dependency>-->
-
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-commons</artifactId>
@@ -70,11 +66,6 @@
</exclusion>
</exclusions>
</dependency>
- <dependency>
- <groupId>org.springframework.cloud</groupId>
- <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
- <version>${spring-cloud.version}</version>
- </dependency>
</dependencies>
<build>
<finalName>shenyu-examples-springcloud</finalName>
@@ -92,10 +83,30 @@
<profiles>
<profile>
+ <id>nacos</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.alibaba.cloud</groupId>
+
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
+ <version>${nacos-discovery.version}</version>
+ </dependency>
+ </dependencies>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ </profile>
+ <profile>
<id>example</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.cloud</groupId>
+
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
+ <version>${eureka-client.version}</version>
+ </dependency>
+ </dependencies>
<build>
<plugins>
<plugin>
diff --git
a/shenyu-examples/shenyu-examples-springcloud/src/main/resources/application.yml
b/shenyu-examples/shenyu-examples-springcloud/src/main/resources/application-example.yml
similarity index 58%
copy from
shenyu-examples/shenyu-examples-springcloud/src/main/resources/application.yml
copy to
shenyu-examples/shenyu-examples-springcloud/src/main/resources/application-example.yml
index 7ed8571..23351e6 100644
---
a/shenyu-examples/shenyu-examples-springcloud/src/main/resources/application.yml
+++
b/shenyu-examples/shenyu-examples-springcloud/src/main/resources/application-example.yml
@@ -13,22 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-server:
- port: 8884
- address: 0.0.0.0
-
-spring:
- application:
- name: springCloud-test
-# cloud:
-# nacos:
-# discovery:
-# server-addr: 127.0.0.1:8848
-
-
-springCloud-test:
- ribbon.NFLoadBalancerRuleClassName: com.netflix.loadbalancer.RandomRule
-
eureka:
client:
serviceUrl:
@@ -36,20 +20,3 @@ eureka:
instance:
prefer-ip-address: true
-shenyu:
- register:
- registerType: http #zookeeper #etcd #nacos #consul
- serverLists: http://localhost:9095 #localhost:2181 #http://localhost:2379
#localhost:8848
- props:
- username: admin
- password: 123456
- client:
- springCloud:
- props:
- contextPath: /springcloud
-# port: 8884
-
-logging:
- level:
- root: info
- org.apache.shenyu: debug
diff --git
a/shenyu-examples/shenyu-examples-springcloud/src/main/resources/application.yml
b/shenyu-examples/shenyu-examples-springcloud/src/main/resources/application-nacos.yml
similarity index 50%
copy from
shenyu-examples/shenyu-examples-springcloud/src/main/resources/application.yml
copy to
shenyu-examples/shenyu-examples-springcloud/src/main/resources/application-nacos.yml
index 7ed8571..947d929 100644
---
a/shenyu-examples/shenyu-examples-springcloud/src/main/resources/application.yml
+++
b/shenyu-examples/shenyu-examples-springcloud/src/main/resources/application-nacos.yml
@@ -13,43 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-server:
- port: 8884
- address: 0.0.0.0
-
spring:
- application:
- name: springCloud-test
-# cloud:
-# nacos:
-# discovery:
-# server-addr: 127.0.0.1:8848
-
-
-springCloud-test:
- ribbon.NFLoadBalancerRuleClassName: com.netflix.loadbalancer.RandomRule
-
-eureka:
- client:
- serviceUrl:
- defaultZone: http://localhost:8761/eureka/
- instance:
- prefer-ip-address: true
-
-shenyu:
- register:
- registerType: http #zookeeper #etcd #nacos #consul
- serverLists: http://localhost:9095 #localhost:2181 #http://localhost:2379
#localhost:8848
- props:
- username: admin
- password: 123456
- client:
- springCloud:
- props:
- contextPath: /springcloud
-# port: 8884
-
-logging:
- level:
- root: info
- org.apache.shenyu: debug
+ cloud:
+ nacos:
+ discovery:
+ server-addr: 127.0.0.1:8848
+ namespace: SheyuRegisterCenter
diff --git
a/shenyu-examples/shenyu-examples-springcloud/src/main/resources/application.yml
b/shenyu-examples/shenyu-examples-springcloud/src/main/resources/application.yml
index 7ed8571..abcd70c 100644
---
a/shenyu-examples/shenyu-examples-springcloud/src/main/resources/application.yml
+++
b/shenyu-examples/shenyu-examples-springcloud/src/main/resources/application.yml
@@ -18,24 +18,14 @@ server:
address: 0.0.0.0
spring:
+ profiles:
+ active: example
application:
name: springCloud-test
-# cloud:
-# nacos:
-# discovery:
-# server-addr: 127.0.0.1:8848
-
springCloud-test:
ribbon.NFLoadBalancerRuleClassName: com.netflix.loadbalancer.RandomRule
-eureka:
- client:
- serviceUrl:
- defaultZone: http://localhost:8761/eureka/
- instance:
- prefer-ip-address: true
-
shenyu:
register:
registerType: http #zookeeper #etcd #nacos #consul
@@ -47,7 +37,7 @@ shenyu:
springCloud:
props:
contextPath: /springcloud
-# port: 8884
+ port: 8884
logging:
level:
diff --git
a/shenyu-integrated-test/shenyu-integrated-test-spring-cloud/docker-compose.yml
b/shenyu-integrated-test/shenyu-integrated-test-spring-cloud/docker-compose.yml
index d074c21..6259f99 100644
---
a/shenyu-integrated-test/shenyu-integrated-test-spring-cloud/docker-compose.yml
+++
b/shenyu-integrated-test/shenyu-integrated-test-spring-cloud/docker-compose.yml
@@ -67,8 +67,8 @@ services:
healthcheck:
test: ["CMD-SHELL", "wget -q -O - http://localhost:8884/actuator/health
| grep UP || exit 1"]
timeout: 2s
- retries: 3
- start_period: 5s
+ retries: 5
+ start_period: 8s
ports:
- "8884:8884"
networks: