-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from alibaba/develop
- Loading branch information
Showing
589 changed files
with
58,860 additions
and
10,214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
notifications: | ||
email: | ||
recipients: | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
on_success: change | ||
|
@@ -12,21 +10,25 @@ language: java | |
|
||
matrix: | ||
include: | ||
# On OSX, run with default JDK only. | ||
# - os: osx | ||
# On Linux, run with specific JDKs only. | ||
- os: linux | ||
env: CUSTOM_JDK="oraclejdk8" | ||
# On OSX, run with default JDK only. | ||
# - os: osx | ||
# On Linux, run with specific JDKs only. | ||
- os: linux | ||
env: CUSTOM_JDK="oraclejdk8" | ||
|
||
jdk: | ||
- openjdk11 | ||
- openjdk8 | ||
|
||
before_install: | ||
- echo 'MAVEN_OPTS="$MAVEN_OPTS -Xmx1024m -XX:MaxPermSize=512m -XX:+BytecodeVerificationLocal"' >> ~/.mavenrc | ||
- cat ~/.mavenrc | ||
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then export JAVA_HOME=$(/usr/libexec/java_home); fi | ||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then jdk_switcher use "$CUSTOM_JDK"; fi | ||
# - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export JAVA_HOME=$(/usr/libexec/java_home); fi | ||
# - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then jdk_switcher use "$CUSTOM_JDK"; fi | ||
|
||
script: | ||
- mvn -B clean package apache-rat:check findbugs:findbugs -Dmaven.test.skip=true | ||
- mvn -Prelease-nacos clean install -U | ||
- mvn -Prelease-nacos -Dmaven.test.skip=true clean install -U | ||
- mvn clean package -Pit-test | ||
after_success: | ||
- mvn clean package -Pit-test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,9 +40,9 @@ It is super easy to get started with your first project. | |
|
||
You can download the package from the [latest stable release](https://github.com/alibaba/nacos/releases). | ||
|
||
Take release nacos-server-0.9.0.zip for example. | ||
Take release nacos-server-1.0.0.zip for example. | ||
``` | ||
unzip nacos-server-0.9.0.zip | ||
unzip nacos-server-1.0.0.zip | ||
cd nacos/bin | ||
``` | ||
|
||
|
@@ -97,9 +97,12 @@ Contributors are welcomed to join Nacos project. Please check [CONTRIBUTING](./C | |
* [email protected]: Nacos usage general discussion. | ||
* [email protected]: Nacos developer discussion (APIs, feature design, etc). | ||
* [email protected]: Commits notice, very high frequency. | ||
* Join us from wechat. Welcome words: Nacos. | ||
* Join us from DingDing(Group 1: 21708933, Group 2: 30438813). | ||
|
||
![cwex](http://acm-public.oss-cn-hangzhou.aliyuncs.com/xuc.png) | ||
## Download | ||
|
||
- [Github Release](https://github.com/alibaba/nacos/releases) | ||
- [Baidu Netdisk](https://pan.baidu.com/s/1186nmlqPGows9gUZKAx8Zw) Fetch Code : `rest` | ||
|
||
|
||
## Who is using | ||
|
@@ -163,7 +166,6 @@ These are only part of the companies using Nacos, for reference only. If you are | |
![时代光华](https://img.alicdn.com/tfs/TB1UzuyNhTpK1RjSZR0XXbEwXXa-201-86.jpg) | ||
![康美](https://img.alicdn.com/tfs/TB19RCANgHqK1RjSZFPXXcwapXa-180-180.jpg) | ||
![环球易购](https://img.alicdn.com/tfs/TB1iCGyNb2pK1RjSZFsXXaNlXXa-143-143.jpg) | ||
![海格管家](https://img.alicdn.com/tfs/TB1FNq4EwHqK1RjSZFgXXa7JXXa-232-232.jpg) | ||
![Nepxion](https://avatars0.githubusercontent.com/u/16344119?s=200&v=4) | ||
![东莞最佳拍档](https://img.alicdn.com/tfs/TB11ugsDzTpK1RjSZKPXXa3UpXa-300-300.png) | ||
![chigua](https://img.alicdn.com/tfs/TB1aUe5EpzqK1RjSZSgXXcpAVXa-248-124.png) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright 1999-2018 Alibaba Group Holding Ltd. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>nacos-all</artifactId> | ||
<groupId>com.alibaba.nacos</groupId> | ||
<version>1.2.0</version> | ||
</parent> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>nacos-address</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<name>nacos-address ${project.version}</name> | ||
<url>http://maven.apache.org</url> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-lang3</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>nacos-naming</artifactId> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>com.alibaba.nacos</groupId> | ||
<artifactId>nacos-cmdb</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-all</artifactId> | ||
<version>1.10.19</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.hamcrest</groupId> | ||
<artifactId>hamcrest-all</artifactId> | ||
<version>1.3</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<resources> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
</resource> | ||
</resources> | ||
</build> | ||
|
||
<reporting> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>findbugs-maven-plugin</artifactId> | ||
<version>3.0.4</version> | ||
</plugin> | ||
</plugins> | ||
</reporting> | ||
|
||
<profiles> | ||
<profile> | ||
<id>release-address</id> | ||
<build> | ||
<finalName>nacos-address</finalName> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<configuration> | ||
<archive> | ||
<manifest> | ||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries> | ||
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries> | ||
</manifest> | ||
</archive> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
<configuration> | ||
<mainClass>com.alibaba.nacos.address.AddressServer</mainClass> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>repackage</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
</project> |
33 changes: 33 additions & 0 deletions
33
address/src/main/java/com/alibaba/nacos/address/AddressServer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright 1999-2018 Alibaba Group Holding Ltd. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.alibaba.nacos.address; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
/** | ||
* support address server. | ||
* | ||
* @author nacos | ||
* @since 1.1.0 | ||
*/ | ||
@SpringBootApplication(scanBasePackages = "com.alibaba.nacos") | ||
public class AddressServer { | ||
public static void main(String[] args) { | ||
|
||
SpringApplication.run(AddressServer.class, args); | ||
} | ||
} |
118 changes: 118 additions & 0 deletions
118
address/src/main/java/com/alibaba/nacos/address/component/AddressServerGeneratorManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
/* | ||
* Copyright (C) 2019 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.alibaba.nacos.address.component; | ||
|
||
import com.alibaba.nacos.address.constant.AddressServerConstants; | ||
import com.alibaba.nacos.api.common.Constants; | ||
import com.alibaba.nacos.naming.core.Instance; | ||
import org.apache.commons.lang3.StringUtils; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
/** | ||
* will generator some result by the input parameter. | ||
* | ||
* @author pbting | ||
* @date 2019-07-01 8:53 PM | ||
* @since 1.1.0 | ||
*/ | ||
@Component | ||
public class AddressServerGeneratorManager { | ||
|
||
public String generateProductName(String name) { | ||
|
||
if (StringUtils.isBlank(name) || AddressServerConstants.DEFAULT_PRODUCT.equals(name)) { | ||
|
||
return AddressServerConstants.ALIWARE_NACOS_DEFAULT_PRODUCT_NAME; | ||
} | ||
|
||
return String.format(AddressServerConstants.ALIWARE_NACOS_PRODUCT_DOM_TEMPLATE, name); | ||
} | ||
|
||
/** | ||
* Note: if the parameter inputted is empty then will return the empty list. | ||
* | ||
* @param serviceName | ||
* @param clusterName | ||
* @param ipArray | ||
* @return | ||
*/ | ||
public List<Instance> generateInstancesByIps(String serviceName, String rawProductName, String clusterName, String[] ipArray) { | ||
if (StringUtils.isEmpty(serviceName) | ||
|| StringUtils.isEmpty(clusterName) | ||
|| ipArray == null || ipArray.length == 0) { | ||
return Collections.emptyList(); | ||
} | ||
|
||
List<Instance> instanceList = new ArrayList<>(ipArray.length); | ||
for (String ip : ipArray) { | ||
String[] ipAndPort = generateIpAndPort(ip); | ||
Instance instance = new Instance(); | ||
instance.setIp(ipAndPort[0]); | ||
instance.setPort(Integer.parseInt(ipAndPort[1])); | ||
instance.setClusterName(clusterName); | ||
instance.setServiceName(serviceName); | ||
instance.setTenant(Constants.DEFAULT_NAMESPACE_ID); | ||
instance.setApp(rawProductName); | ||
instance.setEphemeral(false); | ||
instanceList.add(instance); | ||
} | ||
|
||
return instanceList; | ||
} | ||
|
||
public String[] generateIpAndPort(String ip) { | ||
|
||
int index = ip.indexOf(AddressServerConstants.IP_PORT_SEPARATOR); | ||
if (index != -1) { | ||
|
||
return new String[]{ip.substring(0, index), ip.substring(index + 1)}; | ||
} | ||
|
||
return new String[]{ip, String.valueOf(AddressServerConstants.DEFAULT_SERVER_PORT)}; | ||
} | ||
|
||
/** | ||
* @param instanceList a instance set will generate string response to client. | ||
* @return the result of response to client | ||
*/ | ||
public String generateResponseIps(List<Instance> instanceList) { | ||
|
||
StringBuilder ips = new StringBuilder(); | ||
instanceList.forEach(instance -> { | ||
ips.append(instance.getIp() + ":" + instance.getPort()); | ||
ips.append("\n"); | ||
}); | ||
|
||
return ips.toString(); | ||
} | ||
|
||
/** | ||
* @param rawServiceName the raw service name will not contains the {@Constans.DEFAULT_GROUP} | ||
* @return the nacos service name | ||
*/ | ||
public String generateNacosServiceName(String rawServiceName) { | ||
|
||
if (rawServiceName.indexOf(Constants.DEFAULT_GROUP) != -1) { | ||
return rawServiceName; | ||
} | ||
|
||
return Constants.DEFAULT_GROUP + AddressServerConstants.GROUP_SERVICE_NAME_SEP + rawServiceName; | ||
} | ||
} |
Oops, something went wrong.