From ae909556ce6a7efb5d3726da0ca44f56f56a0bbd Mon Sep 17 00:00:00 2001 From: 1289220708 <1289220708@qq.com> Date: Fri, 19 Jan 2024 19:52:42 +0800 Subject: [PATCH 1/6] chore(server): update swagger info for default server profile --- .../main/java/org/apache/hugegraph/api/profile/ProfileAPI.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java index c28b4878bf..8e9eaad1c3 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java @@ -55,6 +55,7 @@ public class ProfileAPI { private static final String SERVICE = "hugegraph"; private static final String DOC = "https://hugegraph.apache.org/docs/"; private static final String API_DOC = DOC + "clients/"; + private static final String SWAGGER_UI = "http://{ip/domain}:{port}/swagger-ui/index.html#/"; private static String SERVER_PROFILES = null; private static String API_PROFILES = null; @@ -73,6 +74,7 @@ public String getProfile(@Context Application application) { profiles.put("version", CoreVersion.VERSION.toString()); profiles.put("doc", DOC); profiles.put("api_doc", API_DOC); + profiles.put("swagger_ui", SWAGGER_UI); Set apis = new TreeSet<>(); for (Class clazz : application.getClasses()) { if (!isAnnotatedPathClass(clazz)) { From bb67693a8ed3b15ae0b4c5a7f24095210cedd57a Mon Sep 17 00:00:00 2001 From: 1289220708 <1289220708@qq.com> Date: Fri, 19 Jan 2024 19:54:11 +0800 Subject: [PATCH 2/6] chore(server): update swagger info for default server profile --- .../main/java/org/apache/hugegraph/api/profile/ProfileAPI.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java index 8e9eaad1c3..379e814dbd 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java @@ -55,7 +55,7 @@ public class ProfileAPI { private static final String SERVICE = "hugegraph"; private static final String DOC = "https://hugegraph.apache.org/docs/"; private static final String API_DOC = DOC + "clients/"; - private static final String SWAGGER_UI = "http://{ip/domain}:{port}/swagger-ui/index.html#/"; + private static final String SWAGGER_UI = "http://{domain/ip}:{port}/swagger-ui/index.html#/"; private static String SERVER_PROFILES = null; private static String API_PROFILES = null; From 13f916fdc5ddc6931eea7313b7631bb01aa7d491 Mon Sep 17 00:00:00 2001 From: 1289220708 <1289220708@qq.com> Date: Sat, 27 Jan 2024 22:00:25 +0800 Subject: [PATCH 3/6] fix(server): arthas default bind ip should not be 0.0.0.0 --- .../main/java/org/apache/hugegraph/config/ServerOptions.java | 2 +- .../src/assembly/static/conf/rest-server.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java index a8bbe5a5f2..a8d0dab92a 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java @@ -294,7 +294,7 @@ public static synchronized ServerOptions instance() { "arthas.ip", "The IP provided by Arthas, it can be accessible from the outside.", disallowEmpty(), - "0.0.0.0" + "127.0.0.1" ); public static final ConfigOption ARTHAS_DISABLED_COMMANDS = diff --git a/hugegraph-server/hugegraph-dist/src/assembly/static/conf/rest-server.properties b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/rest-server.properties index 23f78c5824..b67905fc19 100644 --- a/hugegraph-server/hugegraph-dist/src/assembly/static/conf/rest-server.properties +++ b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/rest-server.properties @@ -12,7 +12,7 @@ batch.max_write_threads=0 # configuration of arthas arthas.telnet_port=8562 arthas.http_port=8561 -arthas.ip=0.0.0.0 +arthas.ip=127.0.0.1 arthas.disabled_commands=jad # authentication configs From 2519b393216acd83ef2065d943c9b62672dc8bb1 Mon Sep 17 00:00:00 2001 From: 1289220708 <1289220708@qq.com> Date: Sat, 27 Jan 2024 22:12:17 +0800 Subject: [PATCH 4/6] fix(server): arthas default bind ip should not be 0.0.0.0 --- .../main/java/org/apache/hugegraph/api/profile/ProfileAPI.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java index 379e814dbd..c28b4878bf 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/ProfileAPI.java @@ -55,7 +55,6 @@ public class ProfileAPI { private static final String SERVICE = "hugegraph"; private static final String DOC = "https://hugegraph.apache.org/docs/"; private static final String API_DOC = DOC + "clients/"; - private static final String SWAGGER_UI = "http://{domain/ip}:{port}/swagger-ui/index.html#/"; private static String SERVER_PROFILES = null; private static String API_PROFILES = null; @@ -74,7 +73,6 @@ public String getProfile(@Context Application application) { profiles.put("version", CoreVersion.VERSION.toString()); profiles.put("doc", DOC); profiles.put("api_doc", API_DOC); - profiles.put("swagger_ui", SWAGGER_UI); Set apis = new TreeSet<>(); for (Class clazz : application.getClasses()) { if (!isAnnotatedPathClass(clazz)) { From 7d75e0db3d7cfb33439bd6833d1736ac623c72af Mon Sep 17 00:00:00 2001 From: 1289220708 <1289220708@qq.com> Date: Wed, 21 Feb 2024 21:56:18 +0800 Subject: [PATCH 5/6] fix(server): fix the bug which promtheus cant collect hg metric --- .../main/java/org/apache/hugegraph/config/ServerOptions.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java index b46735c8f0..63da169c99 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java @@ -294,7 +294,7 @@ public static synchronized ServerOptions instance() { "arthas.ip", "The IP provided by Arthas, it can be accessible from the outside.", disallowEmpty(), - "0.0.0.0" + "127.0.0.1" ); public static final ConfigOption ARTHAS_DISABLED_COMMANDS = From 552dcb8afeb391caa220d4d0d4861dabda27ad49 Mon Sep 17 00:00:00 2001 From: 1289220708 <1289220708@qq.com> Date: Tue, 27 Feb 2024 22:45:47 +0800 Subject: [PATCH 6/6] fix(server): fix the arthas default bind ip to 127.0.0.1 --- .../main/java/org/apache/hugegraph/api/ArthasApiTest.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java index d79fa772b5..7bdfa3ee1f 100644 --- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java @@ -43,16 +43,9 @@ public void testArthasApi() { " \"command\": \"version\"\n" + "}"; RestClient arthasApiClient = new RestClient(ARTHAS_API_BASE_URL, false); - // If the request header contains basic auth, - // and if we are not set auth when arthas attach hg, arthas will auth it and return 401. - // ref:https://arthas.aliyun.com/en/doc/auth.html#configure-username-and-password Response r = arthasApiClient.post(ARTHAS_API_PATH, body); String result = assertResponseStatus(200, r); assertJsonContains(result, "state"); assertJsonContains(result, "body"); - - RestClient arthasApiClientWithAuth = new RestClient(ARTHAS_API_BASE_URL); - r = arthasApiClientWithAuth.post(ARTHAS_API_PATH, body); - assertResponseStatus(401, r); } }