[jira] [Commented] (SCB-210) Use map feature to design microservice yaml file to support control flag of config center
[ https://issues.apache.org/jira/browse/SCB-210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16396700#comment-16396700 ] ASF GitHub Bot commented on SCB-210: WillemJiang closed pull request #41: [SCB-210] update document for apollo configuration item URL: https://github.com/apache/incubator-servicecomb-website/pull/41 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/_users/cn/dynamic-config.md b/_users/cn/dynamic-config.md index 719854e..8a32b34 100644 --- a/_users/cn/dynamic-config.md +++ b/_users/cn/dynamic-config.md @@ -24,7 +24,7 @@ redirect_from: git clone https://github.com/lijasonvip/apollo-image-for-servicecomb.git cd apollo-image-for-servicecomb && docker-compose up ``` -等待出现 `Portal started. You can visit http://localhost:8070 now!` 后表示系统启动完成,可以在浏览器中访问`http://localhost:8070`进入配置中心页面。 `docker-compose`安装请参考[文档](https://docs.docker.com/compose/install/)。 +等待出现 `Portal started. You can visit http://localhost:8070 now!` 后表示系统启动完成(启动时间基于机器性能可能需要1-3分钟),可以在浏览器中访问`http://localhost:8070`进入配置中心页面。 `docker-compose`安装请参考[文档](https://docs.docker.com/compose/install/)。 ### 通过Apollo界面配置应用获取TOKEN @@ -58,21 +58,13 @@ redirect_from: ```xml - com.netflix.archaius - archaius-core - - - io.servicecomb + org.apache.servicecomb config-apollo ``` ### 添加配置项 ```yaml - cse: - config: - client: - serverUri: http://127.0.0.1:8070 apollo: config: serverUri: http://127.0.0.1:8070 @@ -83,7 +75,8 @@ redirect_from: token: testtoken refreshInterval: 10 ``` - `cse.config.client.serverUri`配置项填写Apollo配置中心portal服务地址,只是表示对接配置中心,`apollo.config`下的配置项是用户创建的应用参数,包括服务地址,用户名,集群,namespace,token等参数。这些参数可以在配置中心页面项目信息栏中查到。需要注意的是`refreshInterval: 10`表示应用会每隔10秒去配置中心查询一次最新的配置信息,不配置此项默认刷新周期为30秒。 + `apollo.config`下的配置项是用户创建的应用参数,包括服务地址,用户名,集群,namespace,token等参数。这些参数可以在配置中心页面项目信息栏中查到。需要注意的是`refreshInterval: 10`表示应用会每隔10秒去配置中心查询一次最新的配置信息,不配置此项默认刷新周期为30秒。 + `serviceName`对应Apollo中的第三发应用ID: `AppId`. ### 获取动态属性 diff --git a/_users/dynamic-config.md b/_users/dynamic-config.md index 2d61f7e..d5a0b84 100644 --- a/_users/dynamic-config.md +++ b/_users/dynamic-config.md @@ -24,7 +24,7 @@ Apollo services can be easily deployed and started step by step following its [o git clone https://github.com/lijasonvip/apollo-image-for-servicecomb.git cd apollo-image-for-servicecomb && docker-compose up ``` -When your console shows `Portal started. You can visit http://localhost:8070 now!` , it means the service is started and ready for use. Visit Apollo configuration pages at `http://localhost:8070` in a browser. Please refer to [Docker document](https://docs.docker.com/compose/install/) about `docker-compose`. +When your console shows `Portal started. You can visit http://localhost:8070 now!` , it means the service is started and ready for use(It could take serval minutes which depends on machines). Visit Apollo configuration pages at `http://localhost:8070` in a browser. Please refer to [Docker document](https://docs.docker.com/compose/install/) about `docker-compose`. ### Configure services and get a token @@ -58,21 +58,13 @@ Visit `http://192.168.199.1:8070/open/manage.html` and fill in application ID an ```xml - com.netflix.archaius - archaius-core - - - io.servicecomb + org.apache.servicecomb config-apollo ``` ### Add configurations in microservice.yaml ```yaml - cse: - config: - client: - serverUri: http://127.0.0.1:8070 apollo: config: serverUri: http://127.0.0.1:8070 @@ -83,7 +75,8 @@ Visit `http://192.168.199.1:8070/open/manage.html` and fill in application ID an token: testtoken refreshInterval: 10 ``` - Configuration `cse.config.client.serverUri` is the portal address of Apollo configuration center just the same as `apollo.config.serverUri`. Configurations under `apollo.config` are parameters of the project that users created above, including serviceName, env, clusters, namespace, token and refreshInterval. Pay attention to `refreshInterval: 10`, it means service will fetch latest configuration items every each 10 seconds, default refresh cycle is 30 second if no value is configured here. + Configurations under `apollo.config` are parameters of the project that users created above, including serviceName, env, clusters, namespace, token and refreshInterval. Pay attention to `refreshInterval: 10`, it means service will fetch latest configuration items every each 10 seconds, default refresh cycle
[jira] [Commented] (SCB-210) Use map feature to design microservice yaml file to support control flag of config center
[ https://issues.apache.org/jira/browse/SCB-210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16390952#comment-16390952 ] ASF GitHub Bot commented on SCB-210: lijasonvip opened a new pull request #41: [SCB-210] update document for apollo configuration item URL: https://github.com/apache/incubator-servicecomb-website/pull/41 Signed-off-by: lijasonvipThis 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: us...@infra.apache.org > Use map feature to design microservice yaml file to support control flag of > config center > - > > Key: SCB-210 > URL: https://issues.apache.org/jira/browse/SCB-210 > Project: Apache ServiceComb > Issue Type: Sub-task > Components: Java-Chassis >Reporter: Bo Li >Assignee: Bo Li >Priority: Major > > check comment of wujimin at: > https://github.com/apache/incubator-servicecomb-java-chassis/pull/489/ -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-210) Use map feature to design microservice yaml file to support control flag of config center
[ https://issues.apache.org/jira/browse/SCB-210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16388927#comment-16388927 ] ASF GitHub Bot commented on SCB-210: WillemJiang closed pull request #569: SCB-210 remove extra useless config item URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/569 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/dynamic-config/config-apollo/src/main/java/org/apache/servicecomb/config/archaius/sources/ApolloConfigurationSourceImpl.java b/dynamic-config/config-apollo/src/main/java/org/apache/servicecomb/config/archaius/sources/ApolloConfigurationSourceImpl.java index 4dc193186..0093c80c2 100644 --- a/dynamic-config/config-apollo/src/main/java/org/apache/servicecomb/config/archaius/sources/ApolloConfigurationSourceImpl.java +++ b/dynamic-config/config-apollo/src/main/java/org/apache/servicecomb/config/archaius/sources/ApolloConfigurationSourceImpl.java @@ -49,11 +49,22 @@ private List listeners = new CopyOnWriteArrayList<>(); + private static final String APOLLO_CONFIG_URL_KEY = "apollo.config.serverUri"; + public ApolloConfigurationSourceImpl() { } private final UpdateHandler updateHandler = new UpdateHandler(); + @Override + public boolean isValidSource(Configuration localConfiguration) { +if (localConfiguration.getProperty(APOLLO_CONFIG_URL_KEY) == null){ + LOGGER.warn("Apollo configuration source is not configured!"); + return false; +} +return true; + } + @Override public void init(Configuration localConfiguration) { ApolloConfig.setConcurrentCompositeConfiguration(localConfiguration); diff --git a/dynamic-config/config-apollo/src/test/resources/microservice.yaml b/dynamic-config/config-apollo/src/test/resources/microservice.yaml index f050218a5..6c8b496fa 100644 --- a/dynamic-config/config-apollo/src/test/resources/microservice.yaml +++ b/dynamic-config/config-apollo/src/test/resources/microservice.yaml @@ -16,7 +16,7 @@ ## limitations under the License. ## --- -APPLICATION_ID: pojotest +APPLICATION_ID: apollotest service_description: name: apollo-test version: 1.0.1 @@ -33,9 +33,6 @@ apollo: firstRefreshInterval: 0 cse: - config: -client: - serverUri: http://127.0.0.1:8070 service: registry: address: http://127.0.0.1:30100 diff --git a/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/archaius/sources/ConfigCenterConfigurationSourceImpl.java b/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/archaius/sources/ConfigCenterConfigurationSourceImpl.java index 74a7d90a2..d4392994f 100644 --- a/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/archaius/sources/ConfigCenterConfigurationSourceImpl.java +++ b/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/archaius/sources/ConfigCenterConfigurationSourceImpl.java @@ -49,9 +49,20 @@ private UpdateHandler updateHandler = new UpdateHandler(); + private static final String CONFIG_CENTER_URL_KEY = "cse.config.client.serverUri"; + public ConfigCenterConfigurationSourceImpl() { } + @Override + public boolean isValidSource(Configuration localConfiguration) { +if (localConfiguration.getProperty(CONFIG_CENTER_URL_KEY) == null) { + LOGGER.warn("Config Center configuration source is not configured!"); + return false; +} +return true; + } + private void init() { ConfigCenterClient configCenterClient = new ConfigCenterClient(updateHandler); configCenterClient.connectServer(); diff --git a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigUtil.java b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigUtil.java index 28e285512..fbef8a9a1 100644 --- a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigUtil.java +++ b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigUtil.java @@ -50,8 +50,6 @@ public final class ConfigUtil { private static final Logger LOGGER = LoggerFactory.getLogger(ConfigUtil.class); - protected static final String configCenterUrlKey = "cse.config.client.serverUri"; - private static final String MICROSERVICE_CONFIG_LOADER_KEY = "cse-microservice-config-loader"; private ConfigUtil() { @@ -150,11 +148,6 @@ private static void duplicateServiceCombConfigToCse(ConcurrentCompositeConfigura } public static DynamicWatchedConfiguration createConfigFromConfigCenter(Configuration localConfiguration) { -if
[jira] [Commented] (SCB-210) Use map feature to design microservice yaml file to support control flag of config center
[ https://issues.apache.org/jira/browse/SCB-210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16388896#comment-16388896 ] ASF GitHub Bot commented on SCB-210: lijasonvip commented on a change in pull request #569: SCB-210 remove extra useless config item URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/569#discussion_r172722352 ## File path: dynamic-config/config-apollo/src/main/java/org/apache/servicecomb/config/archaius/sources/ApolloConfigurationSourceImpl.java ## @@ -49,11 +49,21 @@ private List listeners = new CopyOnWriteArrayList<>(); + private static final String APOLLO_CONFIG_URL_KEY = "apollo.config.serverUri"; + public ApolloConfigurationSourceImpl() { } private final UpdateHandler updateHandler = new UpdateHandler(); + @Override + public boolean isValidSource(Configuration localConfiguration) { +if (localConfiguration.getProperty(APOLLO_CONFIG_URL_KEY) == null){ Review comment: Fixed. 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: us...@infra.apache.org > Use map feature to design microservice yaml file to support control flag of > config center > - > > Key: SCB-210 > URL: https://issues.apache.org/jira/browse/SCB-210 > Project: Apache ServiceComb > Issue Type: Sub-task > Components: Java-Chassis >Reporter: Bo Li >Assignee: Bo Li >Priority: Major > > check comment of wujimin at: > https://github.com/apache/incubator-servicecomb-java-chassis/pull/489/ -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-210) Use map feature to design microservice yaml file to support control flag of config center
[ https://issues.apache.org/jira/browse/SCB-210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=1632#comment-1632 ] ASF GitHub Bot commented on SCB-210: WillemJiang commented on a change in pull request #569: SCB-210 remove extra useless config item URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/569#discussion_r172721105 ## File path: dynamic-config/config-apollo/src/main/java/org/apache/servicecomb/config/archaius/sources/ApolloConfigurationSourceImpl.java ## @@ -49,11 +49,21 @@ private List listeners = new CopyOnWriteArrayList<>(); + private static final String APOLLO_CONFIG_URL_KEY = "apollo.config.serverUri"; + public ApolloConfigurationSourceImpl() { } private final UpdateHandler updateHandler = new UpdateHandler(); + @Override + public boolean isValidSource(Configuration localConfiguration) { +if (localConfiguration.getProperty(APOLLO_CONFIG_URL_KEY) == null){ Review comment: It's better to write the Log here (to let the user know about which configure is wrong). 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: us...@infra.apache.org > Use map feature to design microservice yaml file to support control flag of > config center > - > > Key: SCB-210 > URL: https://issues.apache.org/jira/browse/SCB-210 > Project: Apache ServiceComb > Issue Type: Sub-task > Components: Java-Chassis >Reporter: Bo Li >Assignee: Bo Li >Priority: Major > > check comment of wujimin at: > https://github.com/apache/incubator-servicecomb-java-chassis/pull/489/ -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-210) Use map feature to design microservice yaml file to support control flag of config center
[ https://issues.apache.org/jira/browse/SCB-210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16388868#comment-16388868 ] ASF GitHub Bot commented on SCB-210: liubao68 commented on a change in pull request #569: SCB-210 remove extra useless config item URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/569#discussion_r172719593 ## File path: foundations/foundation-config/src/main/java/org/apache/servicecomb/config/spi/ConfigCenterConfigurationSource.java ## @@ -22,5 +22,6 @@ import com.netflix.config.WatchedConfigurationSource; public interface ConfigCenterConfigurationSource extends WatchedConfigurationSource { + boolean isValidSource(Configuration localConfiguration); Review comment: For compatibility, this method should give default implementation. But it's fine now , this is not known implementations. 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: us...@infra.apache.org > Use map feature to design microservice yaml file to support control flag of > config center > - > > Key: SCB-210 > URL: https://issues.apache.org/jira/browse/SCB-210 > Project: Apache ServiceComb > Issue Type: Sub-task > Components: Java-Chassis >Reporter: Bo Li >Assignee: Bo Li >Priority: Major > > check comment of wujimin at: > https://github.com/apache/incubator-servicecomb-java-chassis/pull/489/ -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-210) Use map feature to design microservice yaml file to support control flag of config center
[ https://issues.apache.org/jira/browse/SCB-210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16388867#comment-16388867 ] ASF GitHub Bot commented on SCB-210: liubao68 commented on a change in pull request #569: SCB-210 remove extra useless config item URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/569#discussion_r172183864 ## File path: foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigUtil.java ## @@ -150,7 +151,7 @@ private static void duplicateServiceCombConfigToCse(ConcurrentCompositeConfigura } public static DynamicWatchedConfiguration createConfigFromConfigCenter(Configuration localConfiguration) { -if (localConfiguration.getProperty(configCenterUrlKey) == null) { +if ((localConfiguration.getProperty(configCenterUrlKey) == null) && (localConfiguration.getProperties((configApolloUrlKey)) == null )) { Review comment: This code should be implementation independent. Can you find a better solution if possible? 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: us...@infra.apache.org > Use map feature to design microservice yaml file to support control flag of > config center > - > > Key: SCB-210 > URL: https://issues.apache.org/jira/browse/SCB-210 > Project: Apache ServiceComb > Issue Type: Sub-task > Components: Java-Chassis >Reporter: Bo Li >Assignee: Bo Li >Priority: Major > > check comment of wujimin at: > https://github.com/apache/incubator-servicecomb-java-chassis/pull/489/ -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-210) Use map feature to design microservice yaml file to support control flag of config center
[ https://issues.apache.org/jira/browse/SCB-210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16387380#comment-16387380 ] ASF GitHub Bot commented on SCB-210: lijasonvip commented on a change in pull request #569: SCB-210 remove extra useless config item URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/569#discussion_r172424150 ## File path: foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigUtil.java ## @@ -150,7 +151,7 @@ private static void duplicateServiceCombConfigToCse(ConcurrentCompositeConfigura } public static DynamicWatchedConfiguration createConfigFromConfigCenter(Configuration localConfiguration) { -if (localConfiguration.getProperty(configCenterUrlKey) == null) { +if ((localConfiguration.getProperty(configCenterUrlKey) == null) && (localConfiguration.getProperties((configApolloUrlKey)) == null )) { Review comment: OK, lets remove this check here and do the check after we get the configCenterSource. 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: us...@infra.apache.org > Use map feature to design microservice yaml file to support control flag of > config center > - > > Key: SCB-210 > URL: https://issues.apache.org/jira/browse/SCB-210 > Project: Apache ServiceComb > Issue Type: Sub-task > Components: Java-Chassis >Reporter: Bo Li >Assignee: Bo Li >Priority: Major > > check comment of wujimin at: > https://github.com/apache/incubator-servicecomb-java-chassis/pull/489/ -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-210) Use map feature to design microservice yaml file to support control flag of config center
[ https://issues.apache.org/jira/browse/SCB-210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16387157#comment-16387157 ] ASF GitHub Bot commented on SCB-210: wujimin commented on a change in pull request #569: SCB-210 remove extra useless config item URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/569#discussion_r172390924 ## File path: foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigUtil.java ## @@ -150,7 +151,7 @@ private static void duplicateServiceCombConfigToCse(ConcurrentCompositeConfigura } public static DynamicWatchedConfiguration createConfigFromConfigCenter(Configuration localConfiguration) { -if (localConfiguration.getProperty(configCenterUrlKey) == null) { +if ((localConfiguration.getProperty(configCenterUrlKey) == null) && (localConfiguration.getProperties((configApolloUrlKey)) == null )) { Review comment: each time, we add a new IMPL. we need to modify this place. it's very bad. 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: us...@infra.apache.org > Use map feature to design microservice yaml file to support control flag of > config center > - > > Key: SCB-210 > URL: https://issues.apache.org/jira/browse/SCB-210 > Project: Apache ServiceComb > Issue Type: Sub-task > Components: Java-Chassis >Reporter: Bo Li >Assignee: Bo Li >Priority: Major > > check comment of wujimin at: > https://github.com/apache/incubator-servicecomb-java-chassis/pull/489/ -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-210) Use map feature to design microservice yaml file to support control flag of config center
[ https://issues.apache.org/jira/browse/SCB-210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16385838#comment-16385838 ] ASF GitHub Bot commented on SCB-210: lijasonvip opened a new pull request #569: SCB-210 remove extra useless config item URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/569 Signed-off-by: lijasonvipFollow this checklist to help us incorporate your contribution quickly and easily: - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes. - [ ] Each commit in the pull request should have a meaningful subject line and body. - [ ] Format the pull request title like `[SCB-XXX] Fixes bug in ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA issue. - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [ ] Run `mvn clean install` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically. - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). --- Use apollo.config.serverUri to note address of Apollo configuration. Remove cse.config.client.serverUri which is useless. 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: us...@infra.apache.org > Use map feature to design microservice yaml file to support control flag of > config center > - > > Key: SCB-210 > URL: https://issues.apache.org/jira/browse/SCB-210 > Project: Apache ServiceComb > Issue Type: Sub-task > Components: Java-Chassis >Reporter: Bo Li >Assignee: Bo Li >Priority: Major > > check comment of wujimin at: > https://github.com/apache/incubator-servicecomb-java-chassis/pull/489/ -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-210) Use map feature to design microservice yaml file to support control flag of config center
[ https://issues.apache.org/jira/browse/SCB-210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16317995#comment-16317995 ] Bo Li commented on SCB-210: --- Need to ask some help from ZhangQi about how to use the feature of mapping a key to another. > Use map feature to design microservice yaml file to support control flag of > config center > - > > Key: SCB-210 > URL: https://issues.apache.org/jira/browse/SCB-210 > Project: Apache ServiceComb > Issue Type: Sub-task > Components: Java-Chassis >Reporter: Bo Li >Assignee: Bo Li > > check comment of wujimin at: > https://github.com/apache/incubator-servicecomb-java-chassis/pull/489/ -- This message was sent by Atlassian JIRA (v6.4.14#64029)