Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide Apollo dynamic configuration center implementation. fixes #2825 #2826

Merged
merged 44 commits into from
Jun 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
4cdedda
Provide Apollo dynamic configuration center implementation. fixes #2825
kezhenxu94 Jun 5, 2019
be21027
Revert unrelated changes
kezhenxu94 Jun 5, 2019
4151d00
Add docker test environment
kezhenxu94 Jun 6, 2019
eb1808f
Sync
kezhenxu94 Jun 6, 2019
59378de
Sync
kezhenxu94 Jun 7, 2019
ee57af4
Fix checkstyle
kezhenxu94 Jun 7, 2019
2002bf5
Fix address
kezhenxu94 Jun 7, 2019
635e70d
Merge remote-tracking branch 'apache/master' into gh/2825
kezhenxu94 Jun 7, 2019
5f6b645
Add license headers
kezhenxu94 Jun 7, 2019
e23b591
Trigger CI
kezhenxu94 Jun 7, 2019
c61ff7b
Add licenses description
kezhenxu94 Jun 7, 2019
88213a2
Trigger CI
kezhenxu94 Jun 8, 2019
b524598
Add missing license and notice
kezhenxu94 Jun 9, 2019
fb60f37
Merge branch 'master' into gh/2825
kezhenxu94 Jun 9, 2019
4416211
Merge branch 'master' into gh/2825
kezhenxu94 Jun 13, 2019
56ca15d
Merge branch 'master' into gh/2825
kezhenxu94 Jun 15, 2019
f37a3ad
Add Integration Tests
kezhenxu94 Jun 15, 2019
ea7a161
Merge branch 'master' into gh/2825
kezhenxu94 Jun 15, 2019
498fc1a
Remove merged license
kezhenxu94 Jun 15, 2019
f8c8cce
Remove duplicated and add new license
kezhenxu94 Jun 15, 2019
c429857
Update LICENSE
kezhenxu94 Jun 15, 2019
99a5f3d
Add public domain section
kezhenxu94 Jun 15, 2019
46a0cec
Remove public domain section
kezhenxu94 Jun 15, 2019
dc44a34
Fix CI
kezhenxu94 Jun 15, 2019
19c5206
Fix CI
kezhenxu94 Jun 15, 2019
5c7fde2
Fix CI
kezhenxu94 Jun 15, 2019
e28b653
Trigger CI testing stability
kezhenxu94 Jun 15, 2019
f5044cd
Trigger CI testing stability
kezhenxu94 Jun 15, 2019
62c10cc
Trigger CI testing stability
kezhenxu94 Jun 15, 2019
0dcdf5d
Trigger CI testing stability
kezhenxu94 Jun 15, 2019
62f8ef4
Fix bad file dexcriptor problem
kezhenxu94 Jun 15, 2019
9047221
Trigger multiple CI Job
kezhenxu94 Jun 15, 2019
0838a9d
Trigger multiple CI Job
kezhenxu94 Jun 15, 2019
f31b53e
Fix file busy problem
kezhenxu94 Jun 15, 2019
33b380b
Trigger multiple Job
kezhenxu94 Jun 15, 2019
f2276aa
Trigger multiple Job
kezhenxu94 Jun 15, 2019
2995028
Trigger multiple Job
kezhenxu94 Jun 15, 2019
c771941
Fix file busy problem
kezhenxu94 Jun 15, 2019
180beec
Trigger multiple Job
kezhenxu94 Jun 15, 2019
49b2e7b
Trigger multiple Job
kezhenxu94 Jun 15, 2019
a123f59
Change docker image pull policy
kezhenxu94 Jun 15, 2019
c9b4139
Update dynamic-config.md
kezhenxu94 Jun 16, 2019
a9befa5
Update apolloconfigdb.sql
kezhenxu94 Jun 16, 2019
755132e
Merge branch 'master' into gh/2825
kezhenxu94 Jun 16, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions apm-dist/release-docs/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ The text of each license is the standard Apache 2.0 license.
Google: gprc-java 1.14.0: https://github.com/grpc/grpc-java, Apache 2.0
Google: gprc-java 1.15.1: https://github.com/grpc/grpc-java, Apache 2.0
Google: guava 20.0: https://github.com/google/guava , Apache 2.0
Google: guice 4.1.0: https://github.com/google/guice , Apache 2.0
Google: gson 2.8.1: https://github.com/google/gson , Apache 2.0
Google: opencensus-java 0.12.3: https://github.com/census-instrumentation/opencensus-java , Apache 2.0
Google: proto-google-common-protos 0.1.9: https://github.com/googleapis/googleapis , Apache 2.0
Expand Down Expand Up @@ -318,6 +319,7 @@ The text of each license is the standard Apache 2.0 license.
proto files from lyft/protoc-gen-validate: https://github.com/lyft/protoc-gen-validate Apache 2.0
proto files from gogo/googleapis: https://github.com/gogo/googleapis Apache 2.0
sundrio 0.9.2: https://github.com/sundrio/sundrio Apache 2.0
Ctripcorp: apollo 1.4.0: https://github.com/ctripcorp/apollo Apache 2.0

========================================================================
MIT licenses
Expand Down Expand Up @@ -452,3 +454,9 @@ d3-voronoi 1.1.4: https://github.com/d3/d3-voronoi BSD-3-Clause
d3-zoom 1.7.3: https://github.com/d3/d3-zoom BSD-3-Clause
zrender 4.0.4: https://github.com/ecomfe/zrender BSD-3-Clause
vue-i18n 8.10.0: https://github.com/kazupon/vue-i18n MIT

========================================
Public Domain licenses
========================================
aopalliance 1.0: http://aopalliance.sourceforge.net Public Domain

16 changes: 15 additions & 1 deletion docs/en/setup/backend/dynamic-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,21 @@ configuration:
#clusterName: "default" # the name of current cluster, set the name if you want to upstream system known.
```

## Nacos DCS
## Dynamic Configuration Apollo Implementation

[Apollo](https://github.com/ctripcorp/apollo/) is also supported in DCS, to use it, just configured as follows:

```yaml
configuration:
apollo:
apolloMeta: <your apollo meta address>
apolloCluster: default
# apolloEnv: # defaults to null
appId: skywalking
period: 5
```

## Dynamic Configuration Nacos Implementation

[Nacos](https://github.com/alibaba/nacos) is also supported in DCS, to use it, please configure as follows:

Expand Down
8 changes: 7 additions & 1 deletion oap-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
<commons-codec.version>1.11</commons-codec.version>
<commons-lang3.version>3.7</commons-lang3.version>
<simpleclient.version>0.6.0</simpleclient.version>

<apollo.version>1.4.0</apollo.version>
<maven-docker-plugin.version>0.30.0</maven-docker-plugin.version>
<nacos.version>1.0.0</nacos.version>
</properties>
Expand Down Expand Up @@ -360,6 +360,12 @@
<artifactId>simpleclient</artifactId>
<version>${simpleclient.version}</version>
</dependency>

<dependency>
<groupId>com.ctrip.framework.apollo</groupId>
<artifactId>apollo-client</artifactId>
<version>${apollo.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-client</artifactId>
Expand Down
173 changes: 173 additions & 0 deletions oap-server/server-configuration/configuration-apollo/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You 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>server-configuration</artifactId>
<groupId>org.apache.skywalking</groupId>
<version>6.2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>configuration-apollo</artifactId>

<dependencies>
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>configuration-api</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>library-client</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>com.ctrip.framework.apollo</groupId>
<artifactId>apollo-client</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<profiles>
<profile>
<id>CI-with-IT</id>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<sourceMode>all</sourceMode>
<showLogs>true</showLogs>
<logDate>default</logDate>
<verbose>true</verbose>
<imagePullPolicy>IfNotPresent</imagePullPolicy>
<images>
<image>
<name>mysql:5.7</name>
<alias>apollo-db</alias>
<run>
<env>
<TZ>Asia/Shanghai</TZ>
<MYSQL_ALLOW_EMPTY_PASSWORD>yes</MYSQL_ALLOW_EMPTY_PASSWORD>
</env>
<namingStrategy>none</namingStrategy>
<volumes>
<bind>
<volume>
src/test/resources/docker/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
</volume>
</bind>
</volumes>
<wait>
<log>ready for connections</log>
<time>600000</time>
</wait>
</run>
</image>
<image>
<name>kezhenxu94/apollo:1.2</name>
<alias>apollo-config-and-portal</alias>
<run>
<namingStrategy>none</namingStrategy>
<dependsOn>
<container>apollo-db</container>
</dependsOn>
<links>
<link>apollo-db</link>
</links>
<ports>
<port>+apollo.portal.host:apollo.portal.port:8070</port>
<port>+apollo.meta.host:apollo.meta.port:8080</port>
</ports>
<wait>
<log>Portal started. You can visit</log>
<time>2400000</time>
</wait>
</run>
</image>
</images>
</configuration>
<executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<apollo.portal.host>
${apollo.portal.host}
</apollo.portal.host>
<apollo.portal.port>
${apollo.portal.port}
</apollo.portal.port>
<apollo.meta.host>
${apollo.meta.host}
</apollo.meta.host>
<apollo.meta.port>
${apollo.meta.port}
</apollo.meta.port>
<apollo.configService>
http://${apollo.meta.host}:${apollo.meta.port}
</apollo.configService>
</systemPropertyVariables>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.skywalking.oap.server.configuration.apollo;

import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.ConfigService;
import com.google.common.base.Strings;
import org.apache.skywalking.oap.server.configuration.api.ConfigTable;
import org.apache.skywalking.oap.server.configuration.api.ConfigWatcherRegister;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Set;

/**
* @author kezhenxu94
*/
public class ApolloConfigWatcherRegister extends ConfigWatcherRegister {
private static final Logger LOGGER = LoggerFactory.getLogger(ApolloConfigWatcherRegister.class);

private final Config configReader;

public ApolloConfigWatcherRegister(ApolloConfigurationCenterSettings settings) {
super(settings.getPeriod());

final String namespace = settings.getNamespace();

final boolean isDefaultNamespace = Strings.isNullOrEmpty(namespace);

if (isDefaultNamespace) {
this.configReader = ConfigService.getAppConfig();
if (LOGGER.isInfoEnabled()) {
LOGGER.info("Read dynamic configs from Apollo default namespace");
}
} else {
this.configReader = ConfigService.getConfig(namespace);
if (LOGGER.isInfoEnabled()) {
LOGGER.info("Read dynamic configs from Apollo namespace: {}", namespace);
}
}
}

@Override
public ConfigTable readConfig(Set<String> keys) {
final ConfigTable configTable = new ConfigTable();

for (final String name : keys) {
final String value = configReader.getProperty(name, null);
configTable.add(new ConfigTable.ConfigItem(name, value));
}

return configTable;
}
}
Loading