diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml index baae1af28..e635a1de9 100644 --- a/.github/workflows/e2e.istio.yaml +++ b/.github/workflows/e2e.istio.yaml @@ -30,6 +30,7 @@ env: TAG: ${{ github.sha }} SCRIPTS_DIR: test/e2e-mesh/e2e-istio/scripts SW_OAP_BASE_IMAGE: openjdk:11-jdk + SW_KUBERNETES_COMMIT_SHA: 6d5897616ce30ebb1706c0cf566ac36f733d93e0 concurrency: group: e2e-istio-${{ github.event.pull_request.number || github.ref }} @@ -95,7 +96,7 @@ jobs: run: | git clone https://github.com/apache/skywalking-kubernetes.git cd skywalking-kubernetes - git reset --hard 2fdcdc3bb39496bf49626755e8f60c998be5f587 + git reset --hard $SW_KUBERNETES_COMMIT_SHA cd chart mkdir -p skywalking/files/conf.d/oap/ && cp ../../test/e2e/e2e-test/src/test/resources/metadata-service-mapping.yaml skywalking/files/conf.d/oap/metadata-service-mapping.yaml helm dep up skywalking @@ -237,7 +238,7 @@ jobs: run: | git clone https://github.com/apache/skywalking-kubernetes.git cd skywalking-kubernetes - git reset --hard dd749f25913830c47a97430618cefc4167612e75 + git reset --hard $SW_KUBERNETES_COMMIT_SHA cd chart helm dep up skywalking helm -n istio-system install skywalking skywalking \ diff --git a/CHANGES.md b/CHANGES.md index eef73ea63..13e823541 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -71,6 +71,7 @@ Release Notes. rather than first time. This makes sure hot data never gets removed unexpectedly. * Support session expired threshold configurable. * Fix InfluxDB storage-plugin Metrics#multiGet issue. +* Replace zuul proxy with spring cloud gateway 2.x. in webapp module. #### UI diff --git a/apm-webapp/pom.xml b/apm-webapp/pom.xml index b2dade8fd..43c298424 100644 --- a/apm-webapp/pom.xml +++ b/apm-webapp/pom.xml @@ -17,7 +17,8 @@ ~ --> - + apm org.apache.skywalking @@ -29,18 +30,17 @@ jar + 1.8 UTF-8 - 1.5.22.RELEASE + 2.4.8 2.6.2 2.8.2 4.5.3 - Edgware.SR1 + 2020.0.3 1.11.0 1.2.3 2.12.2 1.28 - 4.1.65.Final - 8.5.66 ${project.parent.basedir}/skywalking-ui @@ -59,10 +59,15 @@ - org.springframework.boot - spring-boot-starter-web - ${spring.boot.version} + org.springframework.cloud + spring-cloud-starter-gateway + + + org.springframework.cloud + spring-cloud-starter-loadbalancer + + org.springframework.boot spring-boot-starter-actuator @@ -80,11 +85,6 @@ jackson-databind ${jackson-version} - - org.springframework.boot - spring-boot-configuration-processor - ${spring.boot.version} - com.google.code.gson gson @@ -95,10 +95,6 @@ httpclient ${apache-httpclient.version} - - org.springframework.cloud - spring-cloud-starter-netflix-zuul - ch.qos.logback logback-classic @@ -109,21 +105,6 @@ snakeyaml ${yaml.version} - - io.netty - netty-handler - ${netty.version} - - - org.apache.tomcat.embed - tomcat-embed-core - ${tomcat.version} - - - org.apache.tomcat.embed - tomcat-embed-websocket - ${tomcat.version} - org.springframework.boot spring-boot-starter-test @@ -212,7 +193,9 @@ - repackage + + repackage + diff --git a/apm-webapp/src/main/assembly/webapp.yml b/apm-webapp/src/main/assembly/webapp.yml index cb8e55824..301a3470e 100644 --- a/apm-webapp/src/main/assembly/webapp.yml +++ b/apm-webapp/src/main/assembly/webapp.yml @@ -1,10 +1,9 @@ -# 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 +# 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 # @@ -17,10 +16,30 @@ server: port: 8080 -collector: - path: /graphql - ribbon: - ReadTimeout: 10000 - # Point to all backend's restHost:restPort, split by , - listOfServers: 127.0.0.1:12800 +spring: + cloud: + gateway: + routes: + - id: oap-route + uri: lb://oap-service + predicates: + - Path=/graphql/** + discovery: + client: + simple: + instances: + oap-service: + - uri: http://127.0.0.1:12800 + # - uri: http://: + # - uri: http://: + mvc: + throw-exception-if-no-handler-found: true + + web: + resources: + add-mappings: true + +management: + server: + base-path: /manage diff --git a/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/ApplicationStartUp.java b/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/ApplicationStartUp.java index 875ee135b..cecf0cae7 100644 --- a/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/ApplicationStartUp.java +++ b/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/ApplicationStartUp.java @@ -20,15 +20,10 @@ package org.apache.skywalking.apm.webapp; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.web.support.SpringBootServletInitializer; -import org.springframework.cloud.netflix.zuul.EnableZuulProxy; @SpringBootApplication -@EnableZuulProxy -public class ApplicationStartUp extends SpringBootServletInitializer { - +public class ApplicationStartUp { public static void main(String[] args) { SpringApplication.run(ApplicationStartUp.class, args); } - } diff --git a/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/proxy/MvcConfig.java b/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/proxy/MvcConfig.java deleted file mode 100644 index 973d75071..000000000 --- a/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/proxy/MvcConfig.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.apm.webapp.proxy; - -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; - -/** - * Additional MVC Configuration. - */ -@Configuration -public class MvcConfig extends WebMvcConfigurerAdapter { - - @Override - public void addResourceHandlers(final ResourceHandlerRegistry registry) { - registry.addResourceHandler("/index.html").addResourceLocations("classpath:/public/index.html"); - registry.addResourceHandler("/css/**").addResourceLocations("classpath:/public/css/"); - registry.addResourceHandler("/img/**").addResourceLocations("classpath:/public/img/"); - registry.addResourceHandler("/js/**").addResourceLocations("classpath:/public/js/"); - registry.addResourceHandler("/favicon.ico").addResourceLocations("classpath:/public/favicon.ico"); - registry.addResourceHandler("/logo.png").addResourceLocations("classpath:/public/logo.png"); - } -} \ No newline at end of file diff --git a/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/proxy/NotFoundHandler.java b/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/proxy/NotFoundHandler.java deleted file mode 100644 index 2ac55c9ba..000000000 --- a/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/proxy/NotFoundHandler.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.apm.webapp.proxy; - -import java.io.IOException; -import java.nio.charset.Charset; -import org.slf4j.LoggerFactory; -import org.springframework.core.io.ClassPathResource; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.util.StreamUtils; -import org.springframework.web.bind.annotation.ControllerAdvice; -import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.servlet.NoHandlerFoundException; - -/** - * NotFoundHandler handles the single page application url routing. - */ -@ControllerAdvice -public class NotFoundHandler { - @ExceptionHandler(NoHandlerFoundException.class) - public ResponseEntity renderDefaultPage() { - try { - String body = StreamUtils.copyToString(new ClassPathResource("/public/index.html").getInputStream(), Charset - .defaultCharset()); - return ResponseEntity.ok().contentType(MediaType.TEXT_HTML).body(body); - } catch (final IOException e) { - LoggerFactory.getLogger(NotFoundHandler.class).error("err", e); - return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) - .body("There was an error completing the action."); - } - } -} diff --git a/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/proxy/RewritePathFilter.java b/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/proxy/RewritePathFilter.java deleted file mode 100644 index 24f0331a1..000000000 --- a/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/proxy/RewritePathFilter.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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.apm.webapp.proxy; - -import com.netflix.zuul.ZuulFilter; -import com.netflix.zuul.context.RequestContext; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; - -import static org.springframework.cloud.netflix.zuul.filters.support.FilterConstants.PRE_DECORATION_FILTER_ORDER; - -/** - * Rewrite url to rewritePath - */ -@Component -@ConfigurationProperties(prefix = "collector") -public class RewritePathFilter extends ZuulFilter { - - private static final String REQUEST_URI = "requestURI"; - - private static final int ORDER = PRE_DECORATION_FILTER_ORDER + 2; - - private String path; - - public String getPath() { - return path; - } - - public void setPath(String path) { - this.path = path; - } - - @Override - public int filterOrder() { - return ORDER; - } - - @Override - public String filterType() { - return "pre"; - } - - @Override - public boolean shouldFilter() { - RequestContext ctx = RequestContext.getCurrentContext(); - return ctx.containsKey(REQUEST_URI); - } - - @Override - public Object run() { - RequestContext ctx = RequestContext.getCurrentContext(); - ctx.set(REQUEST_URI, path); - return null; - } -} diff --git a/apm-webapp/src/main/resources/application.yml b/apm-webapp/src/main/resources/application.yml index b885b4816..c4b0b86a0 100755 --- a/apm-webapp/src/main/resources/application.yml +++ b/apm-webapp/src/main/resources/application.yml @@ -17,28 +17,30 @@ server: port: 8080 -zuul: - ignoredServices: '*' - routes: - api: - path: /graphql - serviceId: collector - login: - path: /login/account - serviceId: collector - -collector: - path: /graphql - ribbon: - # Point to all backend's restHost:restPort, split by , - listOfServers: 127.0.0.1:12800 - spring: - resources: - add-mappings: false + cloud: + gateway: + routes: + - id: oap-route + uri: lb://oap-service + predicates: + - Path=/graphql/** + discovery: + client: + simple: + instances: + oap-service: + - uri: http://127.0.0.1:12800 + # - uri: http://: + # - uri: http://: + mvc: throw-exception-if-no-handler-found: true - + + web: + resources: + add-mappings: true + management: - # Customizing the management endpoint paths - context-path: /manage + server: + base-path: /manage diff --git a/apm-webapp/src/test/java/org/apache/skywalking/apm/webapp/NotFoundHandlerTest.java b/apm-webapp/src/test/java/org/apache/skywalking/apm/webapp/NotFoundHandlerTest.java deleted file mode 100644 index 8a253cd56..000000000 --- a/apm-webapp/src/test/java/org/apache/skywalking/apm/webapp/NotFoundHandlerTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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.apm.webapp; - -import java.io.IOException; -import org.apache.skywalking.apm.webapp.proxy.NotFoundHandler; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; -import org.springframework.core.io.ClassPathResource; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -@RunWith(PowerMockRunner.class) -@PrepareForTest(value = { - NotFoundHandler.class, - ClassPathResource.class -}) -public class NotFoundHandlerTest { - @Mock - private NotFoundHandler notFoundHandler; - - @Before - public void setUp() { - MockitoAnnotations.initMocks(this); - } - - @Test - public void shouldInternalErrorWhenIndexPageIsMissing() throws Exception { - ClassPathResource mockIndexResource = mock(ClassPathResource.class); - when(mockIndexResource.getInputStream()).thenThrow(new IOException()); - - PowerMockito.whenNew(ClassPathResource.class).withArguments("/public/index.html").thenReturn(mockIndexResource); - - when(notFoundHandler.renderDefaultPage()).thenCallRealMethod(); - ResponseEntity response = notFoundHandler.renderDefaultPage(); - assertThat(response.getStatusCode()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR); - } -} diff --git a/apm-webapp/src/test/java/org/apache/skywalking/apm/webapp/WebAppTest.java b/apm-webapp/src/test/java/org/apache/skywalking/apm/webapp/WebAppTest.java deleted file mode 100644 index e0b1e1d5a..000000000 --- a/apm-webapp/src/test/java/org/apache/skywalking/apm/webapp/WebAppTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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.apm.webapp; - -import org.apache.skywalking.apm.webapp.proxy.NotFoundHandler; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.servlet.MockMvc; - -import static org.hamcrest.CoreMatchers.containsString; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.only; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -@WebMvcTest -@RunWith(SpringRunner.class) -public class WebAppTest { - @Autowired - private MockMvc mvc; - @MockBean - private NotFoundHandler notFoundHandler; - - @Test - public void shouldGetStaticResources() throws Exception { - when(notFoundHandler.renderDefaultPage()).thenCallRealMethod(); - - mvc.perform(get("/index.html")) - .andDo(print()) - .andExpect(status().isOk()) - .andExpect(content().string(containsString("SkyWalking"))); - - verify(notFoundHandler, never()).renderDefaultPage(); - } - - @Test - public void shouldRedirectToIndexWhenResourcesIsAbsent() throws Exception { - when(notFoundHandler.renderDefaultPage()).thenCallRealMethod(); - - mvc.perform(get("/absent.html")).andDo(print()).andExpect(status().isOk()); - - verify(notFoundHandler, only()).renderDefaultPage(); - } -} \ No newline at end of file diff --git a/dist-material/release-docs/LICENSE b/dist-material/release-docs/LICENSE index 8336e69b8..98a9dd856 100755 --- a/dist-material/release-docs/LICENSE +++ b/dist-material/release-docs/LICENSE @@ -251,7 +251,9 @@ The text of each license is the standard Apache 2.0 license. Joda-Time 2.10.5: http://www.joda.org/joda-time/ , Apache 2.0 Joda-Convert 2.2.1: http://www.joda.org/joda-convert/ , Apache 2.0 Spring Framework 4.3.14.RELEASE: https://github.com/spring-projects/spring-framework, Apache 2.0 - Spring Boot 1.5.22.RELEASE: https://spring.io/, Apache 2.0 + Spring Boot 2.4.8: https://spring.io/, Apache 2.0 + Spring Cloud Gateway 3.0.3: https://spring.io/projects/spring-cloud, Apache-2.0 + Spring Cloud Load Balancer 3.0.3: https://spring.io/projects/spring-cloud, Apache-2.0 Spring Cloud Config 1.4.1: https://github.com/spring-cloud/spring-cloud-config, Apache-2.0 Spring Cloud Netflix Zuul 1.3.0: https://github.com/spring-cloud/spring-cloud-netflix, Apache 2.0 Apache: commons-logging 1.1.3: https://github.com/apache/commons-logging, Apache 2.0 @@ -270,7 +272,6 @@ The text of each license is the standard Apache 2.0 license. Apache: commons-io 2.4: https://github.com/apache/commons-io, Apache 2.0 Apache: commons-compress 1.20: https://github.com/apache/commons-compress, Apache 2.0 Apache: commons-collections4 4.4: https://mvnrepository.com/artifact/org.apache.commons/commons-collections4, Apache 2.0 - Apache: tomcat 8.5.66: https://github.com/apache/tomcat/tree/trunk, Apache 2.0 Apache: freemarker 2.3.28: https://github.com/apache/freemarker, Apache 2.0 netty 4.1.65: https://github.com/netty/netty/blob/4.1/LICENSE.txt, Apache 2.0 annotations 13.0: http://www.jetbrains.org, Apache 2.0 @@ -302,7 +303,6 @@ The text of each license is the standard Apache 2.0 license. rxnetty 0.4.9: https://github.com/ReactiveX/rxnetty, Apache 2.0 servo 0.10.1: https://github.com/Netflix/servo, Apache 2.0 validation-api 1.1.0.Final: http://beanvalidation.org/licensing/, Apache 2.0 - zuul-core 1.3.0: https://github.com/Netflix/zuul, Apache 2.0 HikariCP 3.1.0: https://github.com/brettwooldridge/HikariCP, Apache 2.0 zipkin 2.9.1: https://github.com/openzipkin/zipkin, Apache 2.0 sharding-jdbc-core 2.0.3: https://github.com/sharding-sphere/sharding-sphere, Apache 2.0 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index aef45808b..a41cab834 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -61,4 +61,4 @@ services: ports: - 8080:8080 environment: - SW_OAP_ADDRESS: oap:12800 + SW_OAP_ADDRESS: http://oap:12800 diff --git a/docker/ui/Dockerfile.ui b/docker/ui/Dockerfile.ui index 5cb566c6c..d8003dfd5 100644 --- a/docker/ui/Dockerfile.ui +++ b/docker/ui/Dockerfile.ui @@ -18,12 +18,12 @@ FROM adoptopenjdk/openjdk8:alpine ENV DIST_NAME=apache-skywalking-apm-bin \ JAVA_OPTS=" -Xms256M " \ - SW_OAP_ADDRESS="127.0.0.1:12800" \ - SW_TIMEOUT="20000" + SW_OAP_ADDRESS="http://127.0.0.1:12800" COPY "$DIST_NAME.tar.gz" / RUN set -ex; \ + apk add bash; \ tar -xzf "$DIST_NAME.tar.gz"; \ rm -rf "$DIST_NAME.tar.gz"; \ rm -rf "$DIST_NAME/config"; \ @@ -37,4 +37,4 @@ COPY logback.xml webapp/ EXPOSE 8080 -ENTRYPOINT ["sh", "docker-entrypoint.sh"] \ No newline at end of file +ENTRYPOINT ["bash", "docker-entrypoint.sh"] \ No newline at end of file diff --git a/docker/ui/docker-entrypoint.sh b/docker/ui/docker-entrypoint.sh index 6771e22f2..80b85b772 100755 --- a/docker/ui/docker-entrypoint.sh +++ b/docker/ui/docker-entrypoint.sh @@ -20,7 +20,12 @@ set -e export LOGGING_CONFIG="webapp/logback.xml" -[[ ! -z "$SW_OAP_ADDRESS" ]] && export COLLECTOR_RIBBON_LISTOFSERVERS=${SW_OAP_ADDRESS} && echo "COLLECTOR_RIBBON_LISTOFSERVERS=$COLLECTOR_RIBBON_LISTOFSERVERS" -[[ ! -z "$SW_TIMEOUT" ]] && export COLLECTOR_RIBBON_READTIMEOUT=${SW_TIMEOUT} && echo "COLLECTOR_RIBBON_READTIMEOUT=$COLLECTOR_RIBBON_READTIMEOUT" +if [[ ! -z "$SW_OAP_ADDRESS" ]]; then + address_arr=(${SW_OAP_ADDRESS//,/ }) + for i in "${!address_arr[@]}" + do + JAVA_OPTS="${JAVA_OPTS} -Dspring.cloud.discovery.client.simple.instances.oap-service[$i].uri=${address_arr[$i]}" + done +fi -exec java -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -jar webapp/skywalking-webapp.jar "$@" +exec java ${JAVA_OPTS} -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -jar webapp/skywalking-webapp.jar "$@" diff --git a/docs/en/setup/backend/ui-setup.md b/docs/en/setup/backend/ui-setup.md index c85f9f355..9614e502c 100644 --- a/docs/en/setup/backend/ui-setup.md +++ b/docs/en/setup/backend/ui-setup.md @@ -13,13 +13,22 @@ Setting file of UI is `webapp/webapp.yml` in distribution package. It is consti ```yaml server: port: 8080 - -collector: - path: /graphql - ribbon: - ReadTimeout: 10000 - # Point to all backend's restHost:restPort, split by , - listOfServers: 10.2.34.1:12800,10.2.34.2:12800 +spring: + cloud: + gateway: + routes: + - id: oap-route + uri: lb://oap-service + predicates: + - Path=/graphql/** + discovery: + client: + simple: + instances: + oap-service: + # Point to all backend's restHost:restPort, split by URI arrays. + - uri: http://127.0.0.1:12800 + - uri: http://instance-2:12800 ``` diff --git a/test/e2e/e2e-common/src/test/resources/docker-compose.one.yml b/test/e2e/e2e-common/src/test/resources/docker-compose.one.yml index 80971892f..2d004b418 100644 --- a/test/e2e/e2e-common/src/test/resources/docker-compose.one.yml +++ b/test/e2e/e2e-common/src/test/resources/docker-compose.one.yml @@ -22,7 +22,7 @@ services: oap: condition: service_healthy environment: - SW_OAP_ADDRESS: oap:12800 + SW_OAP_ADDRESS: http://oap:12800 expose: - '8080' image: skywalking/ui:latest diff --git a/test/e2e/e2e-test/docker/base-compose.yml b/test/e2e/e2e-test/docker/base-compose.yml index 0674d4a11..292ec0ac2 100644 --- a/test/e2e/e2e-test/docker/base-compose.yml +++ b/test/e2e/e2e-test/docker/base-compose.yml @@ -76,7 +76,7 @@ services: networks: - e2e environment: - - SW_OAP_ADDRESS=oap:12800 + - SW_OAP_ADDRESS=http://oap:12800 provider: build: diff --git a/test/e2e/e2e-test/docker/cluster/docker-compose.yml b/test/e2e/e2e-test/docker/cluster/docker-compose.yml index 2f3d491f5..418c24e36 100644 --- a/test/e2e/e2e-test/docker/cluster/docker-compose.yml +++ b/test/e2e/e2e-test/docker/cluster/docker-compose.yml @@ -21,7 +21,7 @@ services: file: ../base-compose.yml service: ui environment: - - SW_OAP_ADDRESS=oap1:12800,oap2:12800 + - SW_OAP_ADDRESS=http://oap1:12800,http://oap2:12800 depends_on: oap1: condition: service_healthy diff --git a/test/e2e/e2e-test/docker/gateway/docker-compose.yml b/test/e2e/e2e-test/docker/gateway/docker-compose.yml index 03b37cd25..c94f240b9 100644 --- a/test/e2e/e2e-test/docker/gateway/docker-compose.yml +++ b/test/e2e/e2e-test/docker/gateway/docker-compose.yml @@ -86,7 +86,7 @@ services: file: ../base-compose.yml service: ui environment: - - SW_OAP_ADDRESS=oap1:12800,oap2:12800 + - SW_OAP_ADDRESS=http://oap1:12800,http://oap2:12800 depends_on: oap1: condition: service_healthy