coolbeevip commented on a change in pull request #392: [SCB-1127] Support alpha 
server registering to Spring Cloud Eureka
URL: https://github.com/apache/servicecomb-pack/pull/392#discussion_r250046706
 
 

 ##########
 File path: alpha/alpha-server/pom.xml
 ##########
 @@ -162,6 +162,14 @@
       <groupId>io.netty</groupId>
       <artifactId>netty-tcnative-boringssl-static</artifactId>
     </dependency>
+
+    <!-- spring cloud -->
+    <dependency>
+      <groupId>org.springframework.cloud</groupId>
+      <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
 
 Review comment:
   Eureka's dependency uses spring.profiles.active=spring-cloud-eureka 
activation
   
   ### Build Alpah Server
   * build with spring-boot1
   
   ```shell
   mvn clean package -DskipTests=true -Palpha,spring-cloud-eureka,spring-boot-1
   ```
   
   * build with spring-boot2
   
   ```shell
   mvn clean package -DskipTests=true -Palpha,spring-cloud-eureka,spring-boot-2
   ```
   ### Run Alpha Server
   
   ```shell
   java -jar alpha-server-0.4.0-SNAPSHOT-exec.jar \
   --spring.profiles.active=mysql \
   --spring.datasource.platform=mysql \
   --spring.datasource.dataSourceClassName=com.mysql.jdbc.Driver \
   
--spring.datasource.url="jdbc:mysql://127.0.0.1:3306/saga?useUnicode=true&characterEncoding=utf-8&autoReconnect=TRUE"
 \
   --spring.datasource.username=saga-user \
   --spring.datasource.password=saga-password \
   --spring.profiles.active=spring-cloud-eureka,mysql
   ```
   ### The following key information can be seen in the log file
   
   * Activate registration
   
   ```shell
   11:29:39.865 [main] INFO  
org.apache.servicecomb.pack.alpha.server.extension.SpringCloudEurekaConfiguration
 - registering to spring cloud eureka enabled
   ```
   * Registration completed
   
   ```shell
   11:29:45.716 [main] INFO  
org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceRegistry 
- Registering application SERVICECOMB-ALPHA-SERVER with eureka with status UP
   ```
   
   ### Get  Alpha Server info with Eureka
   
   ```
   curl http://127.0.0.1:8761/eureka/apps/
   ```
   output 
   
   ```xml
   <applications>
     <versions__delta>1</versions__delta>
     <apps__hashcode>UP_1_</apps__hashcode>
     <application>
       <name>SERVICECOMB-ALPHA-SERVER</name>
       <instance>
         <instanceId>10.50.7.15::servicecomb-alpha-server:8090</instanceId>
         <hostName>0.0.0.0</hostName>
         <app>SERVICECOMB-ALPHA-SERVER</app>
         <ipAddr>0.0.0.0</ipAddr>
         <status>UP</status>
         <overriddenstatus>UNKNOWN</overriddenstatus>
         <port enabled="true">8090</port>
         <securePort enabled="false">443</securePort>
         <countryId>1</countryId>
         <dataCenterInfo 
class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo">
           <name>MyOwn</name>
         </dataCenterInfo>
         <leaseInfo>
           <renewalIntervalInSecs>30</renewalIntervalInSecs>
           <durationInSecs>90</durationInSecs>
           <registrationTimestamp>1548214185871</registrationTimestamp>
           <lastRenewalTimestamp>1548214185871</lastRenewalTimestamp>
           <evictionTimestamp>0</evictionTimestamp>
           <serviceUpTimestamp>1548214185871</serviceUpTimestamp>
         </leaseInfo>
         <metadata>
           <management.port>8090</management.port>
           <servicecomb-alpha-server>0.0.0.0:8080</servicecomb-alpha-server>
         </metadata>
         <homePageUrl>http://0.0.0.0:8090</homePageUrl>
         <statusPageUrl>http://0.0.0.0:8090/info</statusPageUrl>
         <healthCheckUrl>http://0.0.0.0:8090/health</healthCheckUrl>
         <vipAddress>servicecomb-alpha-server</vipAddress>
         <secureVipAddress>servicecomb-alpha-server</secureVipAddress>
         <isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer>
         <lastUpdatedTimestamp>1548214185871</lastUpdatedTimestamp>
         <lastDirtyTimestamp>1548214185716</lastDirtyTimestamp>
         <actionType>ADDED</actionType>
       </instance>
     </application>
   </applications>
   ```
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to