This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git
The following commit(s) were added to refs/heads/master by this push:
new 0efc733 Replace zuul proxy with spring cloud gateway 2.x. in webapp
module. (#7220)
0efc733 is described below
commit 0efc73390185f5eff301418303c4ec9c868a3920
Author: Jared Tan <[email protected]>
AuthorDate: Sun Jul 4 10:24:56 2021 +0800
Replace zuul proxy with spring cloud gateway 2.x. in webapp module. (#7220)
---
.github/workflows/e2e.istio.yaml | 5 +-
CHANGES.md | 1 +
apm-webapp/pom.xml | 49 +++++----------
apm-webapp/src/main/assembly/webapp.yml | 45 ++++++++++----
.../skywalking/apm/webapp/ApplicationStartUp.java | 7 +--
.../skywalking/apm/webapp/proxy/MvcConfig.java | 40 ------------
.../apm/webapp/proxy/NotFoundHandler.java | 49 ---------------
.../apm/webapp/proxy/RewritePathFilter.java | 71 ----------------------
apm-webapp/src/main/resources/application.yml | 44 +++++++-------
.../skywalking/apm/webapp/NotFoundHandlerTest.java | 63 -------------------
.../apache/skywalking/apm/webapp/WebAppTest.java | 67 --------------------
dist-material/release-docs/LICENSE | 6 +-
docker/docker-compose.yml | 2 +-
docker/ui/Dockerfile.ui | 6 +-
docker/ui/docker-entrypoint.sh | 11 +++-
docs/en/setup/backend/ui-setup.md | 23 ++++---
.../src/test/resources/docker-compose.one.yml | 2 +-
test/e2e/e2e-test/docker/base-compose.yml | 2 +-
.../e2e/e2e-test/docker/cluster/docker-compose.yml | 2 +-
.../e2e/e2e-test/docker/gateway/docker-compose.yml | 2 +-
20 files changed, 111 insertions(+), 386 deletions(-)
diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index baae1af..e635a1d 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 eef73ea..13e8235 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 b2dade8..43c2984 100644
--- a/apm-webapp/pom.xml
+++ b/apm-webapp/pom.xml
@@ -17,7 +17,8 @@
~
-->
-<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">
+<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>apm</artifactId>
<groupId>org.apache.skywalking</groupId>
@@ -29,18 +30,17 @@
<packaging>jar</packaging>
<properties>
+ <java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <spring.boot.version>1.5.22.RELEASE</spring.boot.version>
+ <spring.boot.version>2.4.8</spring.boot.version>
<log4j.version>2.6.2</log4j.version>
<gson.version>2.8.2</gson.version>
<apache-httpclient.version>4.5.3</apache-httpclient.version>
-
<spring-cloud-dependencies.version>Edgware.SR1</spring-cloud-dependencies.version>
+
<spring-cloud-dependencies.version>2020.0.3</spring-cloud-dependencies.version>
<frontend-maven-plugin.version>1.11.0</frontend-maven-plugin.version>
<logback-classic.version>1.2.3</logback-classic.version>
<jackson-version>2.12.2</jackson-version>
<yaml.version>1.28</yaml.version>
- <netty.version>4.1.65.Final</netty.version>
- <tomcat.version>8.5.66</tomcat.version>
<ui.path>${project.parent.basedir}/skywalking-ui</ui.path>
</properties>
@@ -59,10 +59,15 @@
<dependencies>
<dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- <version>${spring.boot.version}</version>
+ <groupId>org.springframework.cloud</groupId>
+ <artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.springframework.cloud</groupId>
+ <artifactId>spring-cloud-starter-loadbalancer</artifactId>
+ </dependency>
+
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
@@ -81,11 +86,6 @@
<version>${jackson-version}</version>
</dependency>
<dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-configuration-processor</artifactId>
- <version>${spring.boot.version}</version>
- </dependency>
- <dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
@@ -96,10 +96,6 @@
<version>${apache-httpclient.version}</version>
</dependency>
<dependency>
- <groupId>org.springframework.cloud</groupId>
- <artifactId>spring-cloud-starter-netflix-zuul</artifactId>
- </dependency>
- <dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback-classic.version}</version>
@@ -110,21 +106,6 @@
<version>${yaml.version}</version>
</dependency>
<dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-handler</artifactId>
- <version>${netty.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-core</artifactId>
- <version>${tomcat.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-websocket</artifactId>
- <version>${tomcat.version}</version>
- </dependency>
- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>${spring.boot.version}</version>
@@ -212,7 +193,9 @@
<executions>
<execution>
<goals>
- <goal>repackage</goal>
+ <goal>
+ repackage
+ </goal>
</goals>
</execution>
</executions>
diff --git a/apm-webapp/src/main/assembly/webapp.yml
b/apm-webapp/src/main/assembly/webapp.yml
index cb8e558..301a347 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://<oap-host-1>:<oap-port1>
+ # - uri: http://<oap-host-2>:<oap-port2>
+ 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 875ee13..cecf0ca 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 973d750..0000000
---
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 2ac55c9..0000000
---
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<String> 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 24f0331..0000000
---
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 b885b48..c4b0b86 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://<oap-host-1>:<oap-port1>
+ # - uri: http://<oap-host-2>:<oap-port2>
+
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 8a253cd..0000000
---
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<String> 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 e0b1e1d..0000000
--- 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("<title>SkyWalking</title>")));
-
- 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 8336e69..98a9dd8 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 aef4580..a41cab8 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 5cb566c..d8003df 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 6771e22..80b85b7 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 c85f9f3..9614e50 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 8097189..2d004b4 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 0674d4a..292ec0a 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 2f3d491..418c24e 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 03b37cd..c94f240 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